M128 stage 6

This commit is contained in:
Alexander Frick 2024-10-03 12:25:25 -05:00
parent bb9267f41d
commit e8eb255937
11 changed files with 624 additions and 439 deletions

View file

@ -182,6 +182,7 @@
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:components/metrics/machine_id_provider_nonwin.cc;bpv=1" ADD_DATE="1677772116" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">machine_id_provider_nonwin.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:components/metrics/machine_id_provider_win.cc;bpv=1" ADD_DATE="1677772120" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">machine_id_provider_win.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:services/preferences/tracked/device_id_win.cc;bpv=1" ADD_DATE="1677772194" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">device_id_win.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:services/preferences/tracked/tracked_split_preference.cc;bpv=1" ADD_DATE="1677772194" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">tracked_split_preference.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:chrome/browser/ui/views/accelerator_table.cc;bpv=1" ADD_DATE="1679172995" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">accelerator_table.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:chrome/browser/ui/browser.cc;bpv=1" ADD_DATE="1679164507" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">browser.cc - Chromium Code Search</A>
<DT><A HREF="https://source.chromium.org/chromium/chromium/src/+/refs/tags/128.0.6613.181:chrome/browser/ui/browser.h;bpv=1" ADD_DATE="1679164514" ICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADIUlEQVQ4jW1TXWwUZRQ955ufnZ3dlm4VpE2Q+lND1cSQYDBaKY2VEkUFa1d9K4laBROEIg+mDfvkg5Bu9MWoD/hkTJdqJBFCMRENEqONRkMbIiWGWn5SjWw7OzO7szPf9UFCCnrebu7JuTc55xA3QURYKkEtXw7+1gDm0mDWBtMm+GcAnb+P0VI+lw4fTIp7C6O7dU3nlKFyisxp0TmDRpMmmyDSCqLY96D1HUQIUsxrd9nfD3VrHDbDTi/ENi5V/TCdtmlQ0Y60dmwANNXT0HpodEx+2kNUb/4e45PSUhBR/1lcw6Gvf3fGf4gmJn6NBgGgUBBFAHj+vepdKSvp2r5m/pPu7juqA4fEOTcXvhaG2KAMVjOp5MjJ4eynBOTIz7Vnzs5Jcfoiej9+1TlHAHjyneArKrl/XcVtnQLcS/A/b23J9DzUBgQRcPo84JX90VOF7JCIGFsOBLMCTB/dl3lc9b+7uA1O+jHb4OuFAvVl+oOtLZmekc1JbUc36nt7pb6zK0mslL2n6+3wUZJJyuIuOm7Ps8Xyc8qP3Q+TMDj+2W73MABUatK5vg26vcVQf3navOqL+Ui7kay53dJeEG8AgPE33PEkDI6HSfZ9BRFAQJF/LSVYDSIQEBiKsE0lsRaGNSiTEl43X4SAQKWN8GUj427qG/XyAJB15IvTM+CJKW04FuoiEpd+1Grmj8BvzPIYAGwten2mm9mUsauDBIAnDvgnAHQMrHZX5/NMOguLBy07NXTPKhvVGnDhb0BH3pvfDjcelDExnpoNLormmS/3uT0KAFY0xDs2dhiLqXZsBoBThca9QK1z8mxlZPpCZZeq+2dMqi2AcGYtzOZG9dayrHoFACgiJCkTU9FAJZCtCxX7he3dvCFl60b8ta6lh2/T2Rdf2oam3gc4f2MXRLi7NOd0tq34iFS/aNFHIwBhJLGVSLRqZd3rWNYQfj+L5igOdb6YvoISNEC5LgBSDk9G6ynYScgVrbGgFMsQKSdiLIhIWSe6rGifzz/M8H/bCABjU2L781BeOCMrK5FcvfNeuexB8M1J7N+/MSEpS/n/AGH0clblBN69AAAAAElFTkSuQmCC">browser.h - Chromium Code Search</A>

View file

@ -96,10 +96,6 @@
"external (e.g. `example.com`), or local (e.g. `file:///tmp/startpage.html`). "
"This applies for incognito windows as well when not set to a `chrome://` internal page.",
kOsDesktop, ORIGIN_LIST_VALUE_TYPE("custom-ntp", "")},
{"hide-sidepanel-button",
"Hide Side Panel Button",
"Hides the Thorium Side Panel Button.",
kOsDesktop, SINGLE_VALUE_TYPE("hide-sidepanel-button")},
{"scroll-tabs",
"Scroll Switches Active Tab",
"Switch to the left/right tab if a scroll wheel event happens over the tabstrip, or the empty space beside the tabstrip.",

View file

@ -93,6 +93,7 @@
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils.h"
#include "chrome/browser/ui/breadcrumb_manager_browser_agent.h"
#include "chrome/browser/ui/browser_actions.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
@ -109,7 +110,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_ui_prefs.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window_features.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
@ -138,11 +139,11 @@
#include "chrome/browser/ui/tabs/tab_group_deletion_dialog_controller.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_menu_model.h"
#include "chrome/browser/ui/tabs/tab_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/unload_controller.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/contents_web_view.h"
#include "chrome/browser/ui/views/message_box_dialog.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
@ -186,6 +187,7 @@
#include "components/paint_preview/buildflags/buildflags.h"
#include "components/permissions/permission_request_manager.h"
#include "components/prefs/pref_service.h"
#include "components/saved_tab_groups/features.h"
#include "components/search/search.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/sessions/core/session_types.h"
@ -283,7 +285,6 @@
#endif
#if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/color_chooser.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/display/types/display_constants.h"
@ -294,7 +295,6 @@
#endif
using base::UserMetricsAction;
using content::NativeWebKeyboardEvent;
using content::NavigationController;
using content::NavigationEntry;
using content::OpenURLParams;
@ -304,6 +304,7 @@ using content::SiteInstance;
using content::WebContents;
using custom_handlers::ProtocolHandler;
using extensions::Extension;
using input::NativeWebKeyboardEvent;
using ui::WebDialogDelegate;
using web_modal::WebContentsModalDialogManager;
@ -397,6 +398,26 @@ bool ShouldShowCookieMigrationNoticeForBrowser(const Browser& browser) {
return last_window_for_profile;
}
void UpdateTabGroupSessionMetadata(
Browser* browser,
const tab_groups::TabGroupId& group_id,
const std::optional<std::string> saved_group_id) {
SessionService* const session_service =
SessionServiceFactory::GetForProfile(browser->profile());
if (!session_service) {
return;
}
const tab_groups::TabGroupVisualData* visual_data =
browser->tab_strip_model()
->group_model()
->GetTabGroup(group_id)
->visual_data();
session_service->SetTabGroupMetadata(browser->session_id(), group_id,
visual_data, saved_group_id);
}
} // namespace
////////////////////////////////////////////////////////////////////////////////
@ -549,6 +570,7 @@ Browser::Browser(const CreateParams& params)
synced_window_delegate_(new BrowserSyncedWindowDelegate(this)),
app_controller_(web_app::MaybeCreateAppBrowserController(this)),
bookmark_bar_state_(BookmarkBar::HIDDEN),
browser_actions_(new BrowserActions(*this)),
command_controller_(new chrome::BrowserCommandController(this)),
tab_group_deletion_dialog_controller_(
std::make_unique<tab_groups::DeletionDialogController>(this)),
@ -569,6 +591,8 @@ Browser::Browser(const CreateParams& params)
overscroll_pref_manager_(std::make_unique<OverscrollPrefManager>(this))
#endif
{
browser_actions_->InitializeBrowserActions();
if (!profile_->IsOffTheRecord()) {
profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>(
params.profile->GetOriginalProfile(),
@ -577,6 +601,16 @@ Browser::Browser(const CreateParams& params)
tab_strip_model_->AddObserver(this);
if (tab_groups::IsTabGroupsSaveV2Enabled() &&
tab_strip_model_->SupportsTabGroups() && is_type_normal()) {
auto* saved_tab_group_keyed_service =
tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile_);
if (saved_tab_group_keyed_service) {
saved_tab_group_observation_.Observe(
saved_tab_group_keyed_service->model());
}
}
ThemeServiceFactory::GetForProfile(profile_)->AddObserver(this);
profile_pref_registrar_.Init(profile_->GetPrefs());
@ -633,10 +667,23 @@ Browser::Browser(const CreateParams& params)
->ListenToFullScreenChanges();
}
// Initialize the browser features that rely on the browser window now that it
// is initialized.
features_->InitPostWindowConstruction(this);
BrowserList::AddBrowser(this);
}
Browser::~Browser() {
// Tear down `BrowserWindowFeatures` and `BrowserUserData`s now to avoid
// exposing them to Browser in a partially-destroyed state. Eventually,
// all BrowserUserData should be converted to features. Until then,
// destroy `features_` because that's what breaks things the least :)
features_.reset();
ClearAllUserData();
saved_tab_group_observation_.Reset();
// Stop observing notifications and destroy the tab monitor before continuing
// with destruction. Profile destruction will unload extensions and reentrant
// calls to Browser:: should be avoided while it is being torn down.
@ -940,8 +987,9 @@ Browser::WarnBeforeClosingResult Browser::MaybeWarnBeforeClosing(
// true or there are no pending downloads we need to prompt about) then
// there's no need to warn.
if (force_skip_warning_user_on_close_) {
if (CanCloseWithMultipleTabs())
if (CanCloseWithMultipleTabs()) {
return WarnBeforeClosingResult::kOkToClose;
}
}
// `CanCloseWithInProgressDownloads()` may trigger a modal dialog.
@ -1061,7 +1109,7 @@ views::WebView* Browser::GetWebView() {
return window_->GetContentsWebView();
}
void Browser::OpenURL(const GURL& gurl, WindowOpenDisposition disposition) {
void Browser::OpenGURL(const GURL& gurl, WindowOpenDisposition disposition) {
OpenURL(content::OpenURLParams(gurl, content::Referrer(), disposition,
ui::PAGE_TRANSITION_LINK,
/*is_renderer_initiated=*/false),
@ -1072,6 +1120,27 @@ const SessionID& Browser::GetSessionID() {
return session_id_;
}
bool Browser::IsTabStripVisible() {
return window_ && window_->IsToolbarShowing();
}
views::View* Browser::TopContainer() {
return window_->GetTopContainer();
}
tabs::TabInterface* Browser::GetActiveTabInterface() {
return tab_strip_model_->GetActiveTab();
}
BrowserWindowFeatures& Browser::GetFeatures() {
return *features_.get();
}
web_modal::WebContentsModalDialogHost*
Browser::GetWebContentsModalDialogHostForWindow() {
return window_->GetWebContentsModalDialogHost();
}
void Browser::OnWindowClosing() {
if (const auto closing_status = HandleBeforeClose();
closing_status != BrowserClosingStatus::kPermitted) {
@ -1229,9 +1298,9 @@ void Browser::OpenFile() {
ui::SelectFileDialog::FileTypeInfo file_types;
file_types.allowed_paths =
ui::SelectFileDialog::FileTypeInfo::ANY_PATH_OR_URL;
select_file_dialog_->SelectFile(
ui::SelectFileDialog::SELECT_OPEN_FILE, std::u16string(), directory,
&file_types, 0, base::FilePath::StringType(), parent_window, nullptr);
select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE,
std::u16string(), directory, &file_types, 0,
base::FilePath::StringType(), parent_window);
}
void Browser::UpdateDownloadShelfVisibility(bool visible) {
@ -1379,29 +1448,19 @@ void Browser::OnTabGroupChanged(const TabGroupChange& change) {
DCHECK(!IsRelevantToAppSessionService(type_));
DCHECK(tab_strip_model_->group_model());
if (change.type == TabGroupChange::kVisualsChanged) {
SessionService* const session_service =
SessionServiceFactory::GetForProfile(profile_);
if (session_service) {
const tab_groups::TabGroupVisualData* visual_data =
tab_strip_model_->group_model()
->GetTabGroup(change.group)
->visual_data();
const tab_groups::SavedTabGroupKeyedService* const
saved_tab_group_keyed_service =
tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile_);
std::optional<std::string> saved_guid;
std::optional<std::string> saved_guid;
if (saved_tab_group_keyed_service) {
const tab_groups::SavedTabGroup* const saved_group =
saved_tab_group_keyed_service->model()->Get(change.group);
if (saved_group) {
saved_guid = saved_group->saved_guid().AsLowercaseString();
}
const tab_groups::SavedTabGroupKeyedService* const
saved_tab_group_keyed_service =
tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile_);
if (saved_tab_group_keyed_service) {
const tab_groups::SavedTabGroup* const saved_group =
saved_tab_group_keyed_service->model()->Get(change.group);
if (saved_group) {
saved_guid = saved_group->saved_guid().AsLowercaseString();
}
session_service->SetTabGroupMetadata(session_id(), change.group,
visual_data, std::move(saved_guid));
}
UpdateTabGroupSessionMetadata(this, change.group, std::move(saved_guid));
} else if (change.type == TabGroupChange::kClosed) {
sessions::TabRestoreService* tab_restore_service =
TabRestoreServiceFactory::GetForProfile(profile());
@ -1454,6 +1513,48 @@ void Browser::TabStripEmpty() {
instant_controller_.reset();
}
void Browser::SavedTabGroupAddedLocally(const base::Uuid& guid) {
// See comment in Browser::OnTabGroupChanged
DCHECK(!IsRelevantToAppSessionService(type_));
DCHECK(tab_strip_model_->group_model());
const tab_groups::SavedTabGroupKeyedService* const
saved_tab_group_keyed_service =
tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile_);
CHECK(saved_tab_group_keyed_service);
const tab_groups::SavedTabGroup* const added_group =
saved_tab_group_keyed_service->model()->Get(guid);
CHECK(added_group);
if (!added_group->local_group_id().has_value()) {
return;
}
if (tab_strip_model()->group_model()->ContainsTabGroup(
added_group->local_group_id().value())) {
UpdateTabGroupSessionMetadata(this, added_group->local_group_id().value(),
guid.AsLowercaseString());
}
}
void Browser::SavedTabGroupRemovedLocally(
const tab_groups::SavedTabGroup& removed_group) {
// See comment in Browser::OnTabGroupChanged
DCHECK(!IsRelevantToAppSessionService(type_));
DCHECK(tab_strip_model_->group_model());
if (!removed_group.local_group_id().has_value()) {
return;
}
if (tab_strip_model()->group_model()->ContainsTabGroup(
removed_group.local_group_id().value())) {
UpdateTabGroupSessionMetadata(this, removed_group.local_group_id().value(),
std::nullopt);
}
}
void Browser::SetTopControlsShownRatio(content::WebContents* web_contents,
float ratio) {
window_->SetTopControlsShownRatio(web_contents, ratio);
@ -1614,7 +1715,7 @@ void Browser::ExitPictureInPicture() {
PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
}
bool Browser::IsBackForwardCacheSupported() {
bool Browser::IsBackForwardCacheSupported(content::WebContents& web_contents) {
return true;
}
@ -1625,20 +1726,6 @@ content::PreloadingEligibility Browser::IsPrerender2Supported(
return prefetch::IsSomePreloadingEnabled(*profile->GetPrefs());
}
void Browser::UpdateInspectedWebContentsIfNecessary(
content::WebContents* old_contents,
content::WebContents* new_contents,
base::OnceCallback<void()> callback) {
DevToolsWindow* dev_tools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(old_contents);
if (dev_tools_window) {
dev_tools_window->UpdateInspectedWebContents(new_contents,
std::move(callback));
} else {
std::move(callback).Run();
}
}
bool Browser::ShouldShowStaleContentOnEviction(content::WebContents* source) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
return source == tab_strip_model_->GetActiveWebContents();
@ -1902,16 +1989,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
const ui::EventType type = event.type();
const bool exited = type == ui::ET_MOUSE_EXITED;
const bool exited = type == ui::EventType::kMouseExited;
// Disregard synthesized events, and mouse enter and exit, which may occur
// without explicit user input events during window state changes.
if (type != ui::ET_MOUSE_ENTERED && !exited && !event.IsSynthesized()) {
if (type != ui::EventType::kMouseEntered && !exited &&
!event.IsSynthesized()) {
exclusive_access_manager_->OnUserInput();
}
// Mouse motion events update the status bubble, if it exists.
if (GetStatusBubble() && source == tab_strip_model_->GetActiveWebContents() &&
(type == ui::ET_MOUSE_MOVED || exited)) {
(type == ui::EventType::kMouseMoved || exited)) {
GetStatusBubble()->MouseMoved(exited);
if (exited) {
GetStatusBubble()->SetURL(GURL());
@ -2062,15 +2150,6 @@ bool Browser::GuestSaveFrame(content::WebContents* guest_web_contents) {
return guest_view && guest_view->PluginDoSave();
}
#if BUILDFLAG(IS_MAC)
std::unique_ptr<content::ColorChooser> Browser::OpenColorChooser(
WebContents* web_contents,
SkColor initial_color,
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions) {
return chrome::ShowColorChooser(web_contents, initial_color);
}
#endif // BUILDFLAG(IS_MAC)
std::unique_ptr<content::EyeDropper> Browser::OpenEyeDropper(
content::RenderFrameHost* frame,
content::EyeDropperListener* listener) {
@ -2310,7 +2389,8 @@ void Browser::RegisterProtocolHandler(
// At this point, there will be UI presented, and running a dialog causes an
// exit to webpage-initiated fullscreen. http://crbug.com/728276
base::ScopedClosureRunner fullscreen_block =
web_contents->ForSecurityDropFullscreen();
web_contents->ForSecurityDropFullscreen(
/*display_id=*/display::kInvalidDisplayId);
permission_request_manager->AddRequest(
requesting_frame,
@ -2510,9 +2590,7 @@ void Browser::OnZoomChanged(
///////////////////////////////////////////////////////////////////////////////
// Browser, ui::SelectFileDialog::Listener implementation:
void Browser::FileSelected(const ui::SelectedFileInfo& file_info,
int index,
void* params) {
void Browser::FileSelected(const ui::SelectedFileInfo& file_info, int index) {
// Transfer the ownership of select file dialog so that the ref count is
// released after the function returns. This is needed because the passed-in
// data such as |file_info| and |params| could be owned by the dialog.
@ -2531,7 +2609,7 @@ void Browser::FileSelected(const ui::SelectedFileInfo& file_info,
/*navigation_handle_callback=*/{});
}
void Browser::FileSelectionCanceled(void* params) {
void Browser::FileSelectionCanceled() {
select_file_dialog_.reset();
}

View file

@ -17,6 +17,8 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/scoped_observation_traits.h"
#include "base/supports_user_data.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
@ -35,6 +37,7 @@
#include "chrome/browser/ui/unload_controller.h"
#include "components/paint_preview/buildflags/buildflags.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/saved_tab_groups/saved_tab_group_model_observer.h"
#include "components/sessions/core/session_id.h"
#include "components/translate/content/browser/content_translate_driver.h"
#include "components/zoom/zoom_observer.h"
@ -57,6 +60,7 @@
class BackgroundContents;
class BreadcrumbManagerBrowserAgent;
class BrowserActions;
class BrowserContentSettingBubbleModelDelegate;
class BrowserInstantController;
class BrowserSyncedWindowDelegate;
@ -78,6 +82,7 @@ class TabMenuModelDelegate;
namespace tab_groups {
class DeletionDialogController;
class SavedTabGroupModel;
}
namespace blink {
@ -114,6 +119,10 @@ namespace web_modal {
class WebContentsModalDialogHost;
}
namespace views {
class View;
}
// This enum is not a member of `Browser` so that it can be forward
// declared in `unload_controller.h` to avoid circular includes.
enum class BrowserClosingStatus {
@ -128,13 +137,13 @@ enum class BrowserClosingStatus {
// scoped to an instance of this class, usually via direct or indirect ownership
// of a std::unique_ptr. See BrowserWindowFeatures and TabFeatures.
class Browser : public TabStripModelObserver,
public tab_groups::SavedTabGroupModelObserver,
public WebContentsCollection::Observer,
public content::WebContentsDelegate,
public ChromeWebModalDialogManagerDelegate,
public base::SupportsUserData,
public BookmarkTabHelperObserver,
public zoom::ZoomObserver,
public content::PageNavigator,
public ThemeServiceObserver,
public translate::ContentTranslateDriver::TranslationObserver,
public ui::SelectFileDialog::Listener,
@ -501,6 +510,8 @@ class Browser : public TabStripModelObserver,
return tab_menu_model_delegate_.get();
}
BrowserActions* browser_actions() const { return browser_actions_.get(); }
chrome::BrowserCommandController* command_controller() {
return command_controller_.get();
}
@ -740,12 +751,6 @@ class Browser : public TabStripModelObserver,
// Interface implementations ////////////////////////////////////////////////
// Overridden from content::PageNavigator:
content::WebContents* OpenURL(
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>
navigation_handle_callback) override;
// Overridden from TabStripModelObserver:
void OnTabStripModelChanged(
TabStripModel* tab_strip_model,
@ -760,6 +765,11 @@ class Browser : public TabStripModelObserver,
int index) override;
void TabStripEmpty() override;
// Overridden from tab_groups::SavedTabGroupModelObserver:
void SavedTabGroupAddedLocally(const base::Uuid& guid) override;
void SavedTabGroupRemovedLocally(
const tab_groups::SavedTabGroup& removed_group) override;
// Overridden from content::WebContentsDelegate:
void ActivateContents(content::WebContents* contents) override;
void SetTopControlsShownRatio(content::WebContents* web_contents,
@ -774,10 +784,9 @@ class Browser : public TabStripModelObserver,
void SetFocusToLocationBar() override;
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) override;
const input::NativeWebKeyboardEvent& event) override;
bool HandleKeyboardEvent(content::WebContents* source,
const input::NativeWebKeyboardEvent& event) override;
bool PreHandleGestureEvent(content::WebContents* source,
const blink::WebGestureEvent& event) override;
bool CanDragEnter(content::WebContents* source,
@ -800,13 +809,9 @@ class Browser : public TabStripModelObserver,
content::PictureInPictureResult EnterPictureInPicture(
content::WebContents* web_contents) override;
void ExitPictureInPicture() override;
bool IsBackForwardCacheSupported() override;
bool IsBackForwardCacheSupported(content::WebContents& web_contents) override;
content::PreloadingEligibility IsPrerender2Supported(
content::WebContents& web_contents) override;
void UpdateInspectedWebContentsIfNecessary(
content::WebContents* old_contents,
content::WebContents* new_contents,
base::OnceCallback<void()> callback) override;
bool ShouldShowStaleContentOnEviction(content::WebContents* source) override;
void MediaWatchTimeChanged(
const content::MediaPlayerWatchTime& watch_time) override;
@ -866,8 +871,18 @@ class Browser : public TabStripModelObserver,
// BrowserWindowInterface overrides:
views::WebView* GetWebView() override;
void OpenURL(const GURL& gurl, WindowOpenDisposition disposition) override;
void OpenGURL(const GURL& gurl, WindowOpenDisposition disposition) override;
content::WebContents* OpenURL(
const content::OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>
navigation_handle_callback) override;
const SessionID& GetSessionID() override;
bool IsTabStripVisible() override;
views::View* TopContainer() override;
tabs::TabInterface* GetActiveTabInterface() override;
BrowserWindowFeatures& GetFeatures() override;
web_modal::WebContentsModalDialogHost*
GetWebContentsModalDialogHostForWindow() override;
private:
friend class BrowserTest;
@ -990,13 +1005,6 @@ class Browser : public TabStripModelObserver,
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
content::WebContents* source) override;
bool GuestSaveFrame(content::WebContents* guest_web_contents) override;
#if BUILDFLAG(IS_MAC)
std::unique_ptr<content::ColorChooser> OpenColorChooser(
content::WebContents* web_contents,
SkColor color,
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
override;
#endif // BUILDFLAG(IS_MAC)
void RunFileChooser(content::RenderFrameHost* render_frame_host,
scoped_refptr<content::FileSelectListener> listener,
const blink::mojom::FileChooserParams& params) override;
@ -1094,10 +1102,8 @@ class Browser : public TabStripModelObserver,
const zoom::ZoomController::ZoomChangedEventData& data) override;
// Overridden from SelectFileDialog::Listener:
void FileSelected(const ui::SelectedFileInfo& file_info,
int index,
void* params) override;
void FileSelectionCanceled(void* params) override;
void FileSelected(const ui::SelectedFileInfo& file_info, int index) override;
void FileSelectionCanceled() override;
// Overridden from ThemeServiceObserver:
void OnThemeChanged() override;
@ -1199,11 +1205,6 @@ class Browser : public TabStripModelObserver,
// is is removed as a delegate.
void SetAsDelegate(content::WebContents* web_contents, bool set_delegate);
// Shows the Find Bar, optionally selecting the next entry that matches the
// existing search string for that Tab. |forward_direction| controls the
// search direction.
void FindInPage(bool find_next, bool forward_direction);
void TabDetachedAtImpl(content::WebContents* contents,
bool was_active,
DetachType type);
@ -1411,6 +1412,8 @@ class Browser : public TabStripModelObserver,
std::unique_ptr<extensions::BrowserExtensionWindowController>
extension_window_controller_;
std::unique_ptr<BrowserActions> browser_actions_;
std::unique_ptr<chrome::BrowserCommandController> command_controller_;
// Dialog controller that handles the showing of the deletion dialog.
@ -1431,6 +1434,12 @@ class Browser : public TabStripModelObserver,
std::unique_ptr<ScopedKeepAlive> keep_alive_;
// Observe saved tab group model events for normal browser type to
// update the session restore metadata with the correct saved group ID.
base::ScopedObservation<tab_groups::SavedTabGroupModel,
tab_groups::SavedTabGroupModelObserver>
saved_tab_group_observation_{this};
WarnBeforeClosingCallback warn_before_closing_callback_;
// Tells if the browser should skip warning the user when closing the window.

View file

@ -38,6 +38,7 @@
#include "chrome/browser/search/search.h"
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/signin_util.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils.h"
@ -46,6 +47,7 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/global_error/global_error.h"
#include "chrome/browser/ui/global_error/global_error_service.h"
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
@ -53,10 +55,12 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/lens/lens_overlay_controller.h"
#include "chrome/browser/ui/managed_ui.h"
#include "chrome/browser/ui/profiles/profile_colors_util.h"
#include "chrome/browser/ui/profiles/profile_view_utils.h"
#include "chrome/browser/ui/safety_hub/menu_notification_service_factory.h"
#include "chrome/browser/ui/safety_hub/safety_hub_constants.h"
#include "chrome/browser/ui/side_panel/companion/companion_utils.h"
#include "chrome/browser/ui/safety_hub/safety_hub_hats_service.h"
#include "chrome/browser/ui/safety_hub/safety_hub_hats_service_factory.h"
#include "chrome/browser/ui/startup/default_browser_prompt/default_browser_prompt_manager.h"
#include "chrome/browser/ui/tabs/organization/tab_organization_service_factory.h"
#include "chrome/browser/ui/tabs/organization/tab_organization_utils.h"
@ -68,11 +72,13 @@
#include "chrome/browser/ui/toolbar/chrome_labs/chrome_labs_prefs.h"
#include "chrome/browser/ui/toolbar/chrome_labs/chrome_labs_utils.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/side_panel/companion/companion_utils.h"
#include "chrome/browser/ui/web_applications/web_app_dialog_utils.h"
#include "chrome/browser/ui/web_applications/web_app_launch_utils.h"
#include "chrome/browser/ui/webui/whats_new/whats_new_util.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/proto/web_app_install_state.pb.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_tab_helper.h"
@ -93,7 +99,6 @@
#include "components/password_manager/content/common/web_ui_constants.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/performance_manager/public/features.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "components/profile_metrics/browser_profile_type.h"
@ -120,6 +125,7 @@
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
@ -132,6 +138,7 @@
#endif
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/ui/lens/lens_overlay_entry_point_controller.h"
#include "components/lens/lens_features.h"
#endif
@ -150,6 +157,8 @@
using base::UserMetricsAction;
using content::WebContents;
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kProfileMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kProfileOpenGuestItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kBookmarksMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kTabGroupsMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kDownloadsMenuItem);
@ -164,8 +173,8 @@ DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kShowLensOverlay);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kShowSearchCompanion);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kSaveAndShareMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kCastTitleItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kPerformanceMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kInstallAppItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel, kCreateShortcutItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(AppMenuModel,
kSetBrowserAsDefaultMenuItem);
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(ToolsMenuModel, kPerformanceMenuItem);
@ -203,30 +212,20 @@ void AddSubMenuWithStringIdAndVectorIcon(ui::SimpleMenuModel* model,
ui::SimpleMenuModel::kDefaultIconSize));
}
struct MenuItemStrings {
std::u16string title_text;
std::u16string minor_text;
};
// Conditionally return the update app menu item title and minor text based on
// upgrade detector state.
MenuItemStrings GetUpgradeDialogTitleAndMinorText() {
// Conditionally return the update app menu item title based on upgrade detector
// state.
std::u16string GetUpgradeDialogTitleText() {
if (UpgradeDetector::GetInstance()->is_outdated_install() ||
UpgradeDetector::GetInstance()->is_outdated_install_no_au()) {
return {.title_text =
l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_MENU_ITEM)};
} else {
return l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_MENU_ITEM);
}
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && \
(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
if (base::FeatureList::IsEnabled(features::kUpdateTextOptions)) {
return {
.title_text = l10n_util::GetStringUTF16(IDS_RELAUNCH_TO_UPDATE_ALT),
.minor_text =
l10n_util::GetStringUTF16(IDS_RELAUNCH_TO_UPDATE_ALT_MINOR_TEXT)};
}
#endif
return {.title_text = l10n_util::GetStringUTF16(IDS_RELAUNCH_TO_UPDATE)};
if (base::FeatureList::IsEnabled(features::kUpdateTextOptions)) {
return l10n_util::GetStringUTF16(IDS_RELAUNCH_TO_UPDATE_ALT);
}
#endif
return l10n_util::GetStringUTF16(IDS_RELAUNCH_TO_UPDATE);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
@ -236,16 +235,6 @@ std::u16string GetLacrosDataMigrationMenuItemName() {
}
#endif
// ChromeOS does not support DIY app install, and uses the legacy shortcut
// creation flow to create web apps.
bool IsDiyAppInstallSupported() {
#if BUILDFLAG(IS_CHROMEOS)
return false;
#else
return base::FeatureList::IsEnabled(features::kWebAppUniversalInstall);
#endif // BUILDFLAG(IS_CHROMEOS)
}
// Returns the appropriate menu label for the IDC_INSTALL_PWA command if
// available.
std::u16string GetInstallPWALabel(const Browser* browser) {
@ -269,48 +258,84 @@ std::u16string GetInstallPWALabel(const Browser* browser) {
web_app::WebAppTabHelper::GetAppId(web_contents);
web_app::WebAppProvider* const provider =
web_app::WebAppProvider::GetForLocalAppsUnchecked(browser->profile());
if (app_id && provider->registrar_unsafe().IsLocallyInstalled(*app_id) &&
if (app_id &&
provider->registrar_unsafe().IsInstallState(
*app_id, {web_app::proto::INSTALLED_WITH_OS_INTEGRATION}) &&
provider->registrar_unsafe().GetAppUserDisplayMode(*app_id) !=
web_app::mojom::UserDisplayMode::kBrowser) {
return std::u16string();
}
std::u16string install_page_as_app_label =
l10n_util::GetStringUTF16(IDS_INSTALL_DIY_TO_OS_LAUNCH_SURFACE);
webapps::AppBannerManager* banner =
webapps::AppBannerManager::FromWebContents(web_contents);
if (!banner) {
// Showing `Install Page as App` allows the user to refetch the manifest and
// go through the install flow without relying on the AppBannerManager to
// finish working.
if (base::FeatureList::IsEnabled(features::kWebAppUniversalInstall)) {
return install_page_as_app_label;
}
return std::u16string();
}
std::optional<webapps::InstallBannerConfig> install_config =
banner->GetCurrentBannerConfig();
if (!install_config) {
// In some edge cases where the `AppBannerManager` pipeline hasn't run yet,
// the information populated to be used for determining installability and
// other parameters is not available. In this case, allow users to try
// installability by refetching the manifest.
if (base::FeatureList::IsEnabled(features::kWebAppUniversalInstall)) {
return install_page_as_app_label;
}
return std::u16string();
}
CHECK_EQ(install_config->mode, webapps::AppBannerMode::kWebApp);
webapps::InstallableWebAppCheckResult installable =
banner->GetInstallableWebAppCheckResult();
std::u16string app_name;
switch (installable) {
case webapps::InstallableWebAppCheckResult::kUnknown:
// Loading of the menu model is synchronous, so there could be a condition
// where the `AppBannerManager` has not yet finished the pipeline while
// the menu item has been triggered. In such a case,
// `banner->GetInstallableWebAppCheckResult()` returns the default value
// of `kUnknown`.
// Show `Install Page as App` for that use-case, since that allows the
// user to trigger the install flow to verify all the data required for
// installability. The correct dialog will be shown to the user depending
// on whether the app turns out to be installable or not.
if (base::FeatureList::IsEnabled(features::kWebAppUniversalInstall)) {
return install_page_as_app_label;
}
return std::u16string();
case webapps::InstallableWebAppCheckResult::kNo_AlreadyInstalled:
// Returning an empty string here allows the `launch page as app` field to
// get populated in place of the `install` strings.
return std::u16string();
case webapps::InstallableWebAppCheckResult::kNo:
// Returning an empty string prevents menu item creation.
if (IsDiyAppInstallSupported()) {
return l10n_util::GetStringUTF16(IDS_INSTALL_DIY_TO_OS_LAUNCH_SURFACE);
if (base::FeatureList::IsEnabled(features::kWebAppUniversalInstall)) {
return install_page_as_app_label;
}
return std::u16string();
case webapps::InstallableWebAppCheckResult::kYes_ByUserRequest:
case webapps::InstallableWebAppCheckResult::kYes_Promotable:
app_name = install_config->GetWebOrNativeAppName();
break;
std::u16string app_name = install_config->GetWebOrNativeAppName();
if (app_name.empty()) {
// Prefer showing `Install Page as App` here, as users can set the name
// of the installed app on the DIY app dialog anyway.
if (base::FeatureList::IsEnabled(features::kWebAppUniversalInstall)) {
return install_page_as_app_label;
} else {
return std::u16string();
}
}
return l10n_util::GetStringFUTF16(
IDS_INSTALL_TO_OS_LAUNCH_SURFACE,
ui::EscapeMenuLabelAmpersands(app_name));
}
if (app_name.empty()) {
return std::u16string();
}
return l10n_util::GetStringFUTF16(IDS_INSTALL_TO_OS_LAUNCH_SURFACE,
ui::EscapeMenuLabelAmpersands(app_name));
}
// TODO(b/328077967): Implement async updates of menu for app icon.
@ -339,8 +364,10 @@ ui::ImageModel GetInstallPWAIcon(Browser* browser) {
// For sites that are not installable (DIY apps), do not return any icons,
// instead use the default chrome refresh icon for installing.
if (banner->GetInstallableWebAppCheckResult() ==
webapps::InstallableWebAppCheckResult::kNo) {
auto installable_check_result = banner->GetInstallableWebAppCheckResult();
if (installable_check_result == webapps::InstallableWebAppCheckResult::kNo ||
installable_check_result ==
webapps::InstallableWebAppCheckResult::kUnknown) {
return app_icon_to_use;
}
@ -390,11 +417,29 @@ std::u16string GetOpenPWALabel(const Browser* browser) {
gfx::CHARACTER_BREAK)));
}
std::u16string GetSyncSectionTitle(Profile* profile,
signin::IdentityManager* identity_manager) {
const AccountInfo account = GetAccountInfoFromProfile(profile);
if (IsSyncPaused(profile) || account.IsEmpty()) {
return l10n_util::GetStringUTF16(IDS_PROFILES_LOCAL_PROFILE_STATE);
}
if (signin_util::IsSigninPending(identity_manager)) {
return base::UTF8ToUTF16(account.email);
}
return l10n_util::GetStringFUTF16(
IDS_PROFILE_ROW_SIGNED_IN_MESSAGE_WITH_EMAIL,
{base::UTF8ToUTF16(account.email)});
}
class ProfileSubMenuModel : public ui::SimpleMenuModel,
public ui::SimpleMenuModel::Delegate {
public:
ProfileSubMenuModel(ui::SimpleMenuModel::Delegate* delegate,
Profile* profile);
Profile* profile,
const ui::ColorProvider* color_provider);
ProfileSubMenuModel(const ProfileSubMenuModel&) = delete;
ProfileSubMenuModel& operator=(const ProfileSubMenuModel&) = delete;
~ProfileSubMenuModel() override = default;
@ -431,7 +476,8 @@ class ProfileSubMenuModel : public ui::SimpleMenuModel,
ProfileSubMenuModel::ProfileSubMenuModel(
ui::SimpleMenuModel::Delegate* delegate,
Profile* profile)
Profile* profile,
const ui::ColorProvider* color_provider)
: SimpleMenuModel(this),
profile_(profile),
app_menu_model_delegate_(delegate),
@ -440,6 +486,7 @@ ProfileSubMenuModel::ProfileSubMenuModel(
GetLayoutConstant(APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE);
avatar_image_model_ = ui::ImageModel::FromVectorIcon(
kAccountCircleChromeRefreshIcon, ui::kColorMenuIcon, avatar_icon_size);
if (profile->IsIncognitoProfile()) {
avatar_image_model_ = ui::ImageModel::FromVectorIcon(
kIncognitoIcon, ui::kColorAvatarIconIncognito, avatar_icon_size);
@ -457,7 +504,10 @@ ProfileSubMenuModel::ProfileSubMenuModel(
AccountInfo account_info = GetAccountInfoFromProfile(profile);
gfx::Image avatar_image =
account_info.IsEmpty()
? profile_attributes->GetAvatarIcon(avatar_icon_size)
? profile_attributes->GetAvatarIcon(
avatar_icon_size, /*use_high_res_file=*/true,
/*icon_params=*/
{.has_padding = false, .has_background = false})
: account_info.account_image;
// The avatar image can be empty if the account image hasn't been
// fetched yet, if there is no image, or in tests.
@ -502,24 +552,32 @@ ProfileSubMenuModel::ProfileSubMenuModel(
AddSeparator(ui::NORMAL_SEPARATOR);
AddTitle(l10n_util::GetStringUTF16(IDS_OTHER_CHROME_PROFILES_TITLE));
auto profile_entries = GetAllOtherProfileEntriesForProfileSubMenu(profile);
profiles::PlaceholderAvatarIconParams icon_params =
GetPlaceholderAvatarIconParamsVisibleAgainstColor(
color_provider->GetColor(ui::kColorMenuBackground));
for (ProfileAttributesEntry* profile_entry : profile_entries) {
std::u16string display_name = GetProfileMenuDisplayName(profile_entry);
int menu_id = GetAndIncrementNextMenuID();
AddItemWithIcon(menu_id,
ui::EscapeMenuLabelAmpersands(gfx::TruncateString(
display_name,
GetLayoutConstant(APP_MENU_MAXIMUM_CHARACTER_LENGTH),
gfx::CHARACTER_BREAK)),
ui::ImageModel::FromImage(profiles::GetSizedAvatarIcon(
profile_entry->GetAvatarIcon(), avatar_icon_size,
avatar_icon_size, profiles::SHAPE_CIRCLE)));
AddItemWithIcon(
menu_id,
ui::EscapeMenuLabelAmpersands(gfx::TruncateString(
display_name,
GetLayoutConstant(APP_MENU_MAXIMUM_CHARACTER_LENGTH),
gfx::CHARACTER_BREAK)),
ui::ImageModel::FromImage(profiles::GetSizedAvatarIcon(
profile_entry->GetAvatarIcon(
avatar_icon_size, /*use_high_res_file=*/true, icon_params),
avatar_icon_size, avatar_icon_size, profiles::SHAPE_CIRCLE)));
other_profiles_.insert({menu_id, profile_entry->GetPath()});
}
if (profiles::IsGuestModeEnabled()) {
if (profiles::IsGuestModeEnabled(*profile)) {
AddItemWithStringIdAndVectorIcon(
this, IDC_OPEN_GUEST_PROFILE, IDS_OPEN_GUEST_PROFILE,
vector_icons::kAccountCircleChromeRefreshIcon);
SetElementIdentifierAt(
GetIndexOfCommandId(IDC_OPEN_GUEST_PROFILE).value(),
AppMenuModel::kProfileOpenGuestItem);
}
AddSeparator(ui::NORMAL_SEPARATOR);
if (profiles::IsProfileCreationAllowed()) {
@ -579,18 +637,10 @@ bool ProfileSubMenuModel::BuildSyncSection() {
return false;
}
const AccountInfo account_info = GetAccountInfoFromProfile(profile_);
const std::u16string signed_in_status =
(IsSyncPaused(profile_) || account_info.IsEmpty())
? l10n_util::GetStringUTF16(IDS_PROFILES_LOCAL_PROFILE_STATE)
: l10n_util::GetStringFUTF16(
IDS_PROFILE_ROW_SIGNED_IN_MESSAGE_WITH_EMAIL,
{base::UTF8ToUTF16(account_info.email)});
AddTitle(signed_in_status);
signin::IdentityManager* const identity_manager =
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(profile_);
AddTitle(GetSyncSectionTitle(profile_, identity_manager));
const bool is_sync_feature_enabled =
identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync);
// First, check for sync errors. They may exist even if sync-the-feature is
@ -611,7 +661,12 @@ bool ProfileSubMenuModel::BuildSyncSection() {
}
return true;
}
if (is_sync_feature_enabled) {
if (signin_util::IsSigninPending(identity_manager)) {
AddItemWithStringIdAndVectorIcon(
this, IDC_SHOW_SIGNIN_WHEN_PAUSED, IDS_PROFILES_VERIFY_ACCOUNT_BUTTON,
vector_icons::kAccountCircleOffChromeRefreshIcon);
} else if (is_sync_feature_enabled) {
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_SYNC_SETTINGS,
IDS_PROFILE_ROW_SYNC_IS_ON,
vector_icons::kSyncChromeRefreshIcon);
@ -681,9 +736,7 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
ui::SimpleMenuModel::Delegate* delegate,
Browser* browser)
: SimpleMenuModel(delegate) {
if (media_router::MediaRouterEnabled(browser->profile()) &&
base::FeatureList::IsEnabled(features::kCastAppMenuExperiment) &&
features::kCastListedFirst.Get()) {
if (media_router::MediaRouterEnabled(browser->profile())) {
AddTitle(l10n_util::GetStringUTF16(IDS_SAVE_AND_SHARE_MENU_CAST));
SetElementIdentifierAt(GetItemCount() - 1, AppMenuModel::kCastTitleItem);
AddItemWithStringIdAndVectorIcon(this, IDC_ROUTE_MEDIA,
@ -709,6 +762,7 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
AddItemWithStringIdAndVectorIcon(this, IDC_CREATE_SHORTCUT,
IDS_ADD_TO_OS_LAUNCH_SURFACE,
kDriveShortcutChromeRefreshIcon);
SetElementIdentifierAt(GetItemCount() - 1, AppMenuModel::kCreateShortcutItem);
if (!sharing_hub::SharingIsDisabledByPolicy(browser->profile()) ||
media_router::MediaRouterEnabled(browser->profile())) {
AddSeparator(ui::NORMAL_SEPARATOR);
@ -723,14 +777,6 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
IDS_APP_MENU_CREATE_QR_CODE,
kQrCodeChromeRefreshIcon);
}
if (media_router::MediaRouterEnabled(browser->profile()) &&
(!base::FeatureList::IsEnabled(features::kCastAppMenuExperiment) ||
!features::kCastListedFirst.Get())) {
AddItemWithStringIdAndVectorIcon(this, IDC_ROUTE_MEDIA,
IDS_MEDIA_ROUTER_MENU_ITEM_TITLE,
kCastChromeRefreshIcon);
}
}
if (sharing_hub::DesktopScreenshotsFeatureEnabled(browser->profile())) {
AddItemWithStringIdAndVectorIcon(this, IDC_SHARING_HUB_SCREENSHOT,
@ -827,29 +873,33 @@ void ToolsMenuModel::Build(Browser* browser) {
AddItemWithStringIdAndVectorIcon(this, IDC_NAME_WINDOW, IDS_NAME_WINDOW,
kNameWindowIcon);
if (features::IsSidePanelPinningEnabled()) {
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_READING_MODE_SIDE_PANEL,
IDS_SHOW_READING_MODE_SIDE_PANEL,
kMenuBookChromeRefreshIcon);
SetElementIdentifierAt(
GetIndexOfCommandId(IDC_SHOW_READING_MODE_SIDE_PANEL).value(),
kReadingModeMenuItem);
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_READING_MODE_SIDE_PANEL,
IDS_SHOW_READING_MODE_SIDE_PANEL,
kMenuBookChromeRefreshIcon);
SetElementIdentifierAt(
GetIndexOfCommandId(IDC_SHOW_READING_MODE_SIDE_PANEL).value(),
kReadingModeMenuItem);
if (base::FeatureList::IsEnabled(features::kToolbarPinning)) {
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL,
IDS_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL,
kEditChromeRefreshIcon);
}
AddSeparator(ui::NORMAL_SEPARATOR);
if (!features::IsExtensionMenuInRootAppMenu()) {
AddItemWithStringId(IDC_MANAGE_EXTENSIONS, IDS_SHOW_EXTENSIONS);
}
if (!base::FeatureList::IsEnabled(
performance_manager::features::kPerformanceControlsSidePanel)) {
AddItemWithStringIdAndVectorIcon(this, IDC_PERFORMANCE,
IDS_SHOW_PERFORMANCE, kPerformanceIcon);
SetElementIdentifierAt(GetIndexOfCommandId(IDC_PERFORMANCE).value(),
kPerformanceMenuItem);
}
if (chrome::CanOpenTaskManager())
AddItemWithStringIdAndVectorIcon(this, IDC_PERFORMANCE, IDS_SHOW_PERFORMANCE,
kPerformanceIcon);
SetElementIdentifierAt(GetIndexOfCommandId(IDC_PERFORMANCE).value(),
kPerformanceMenuItem);
if (chrome::CanOpenTaskManager()) {
AddItemWithStringIdAndVectorIcon(this, IDC_TASK_MANAGER, IDS_TASK_MANAGER,
kTaskManagerIcon);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
AddItemWithStringId(IDC_TAKE_SCREENSHOT, IDS_TAKE_SCREENSHOT);
#endif
@ -873,8 +923,7 @@ void ToolsMenuModel::Build(Browser* browser) {
if (show_chrome_labs_item.GetValue()) {
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_CHROME_LABS,
IDS_CHROMELABS,
kChromeLabsChromeRefreshIcon);
IDS_CHROMELABS, kScienceIcon);
SetElementIdentifierAt(
GetIndexOfCommandId(IDC_SHOW_CHROME_LABS).value(),
kChromeLabsMenuItem);
@ -990,10 +1039,9 @@ void AppMenuModel::LogSafetyHubInteractionMetrics(
safety_hub::SafetyHubEntryPoint::kMenuNotifications);
base::UmaHistogramEnumeration("Settings.SafetyHub.MenuNotificationClicked",
sh_module);
if (TrustSafetySentimentService* sentiment_service =
TrustSafetySentimentServiceFactory::GetForProfile(
browser_->profile())) {
sentiment_service->SafetyHubNotificationClicked();
if (SafetyHubHatsService* hats_service =
SafetyHubHatsServiceFactory::GetForProfile(browser_->profile())) {
hats_service->SafetyHubNotificationClicked();
}
}
@ -1004,26 +1052,22 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
case IDC_UPGRADE_DIALOG:
LogMenuAction(MENU_ACTION_UPGRADE_DIALOG);
break;
case IDC_SHOW_PASSWORD_CHECKUP:
LogMenuAction(MENU_ACTION_SHOW_PASSWORD_CHECKUP);
break;
case IDC_OPEN_SAFETY_HUB:
LogMenuAction(MENU_ACTION_SHOW_SAFETY_HUB);
break;
#if BUILDFLAG(IS_CHROMEOS_ASH)
case IDC_LACROS_DATA_MIGRATION:
LogMenuAction(MENU_ACTION_LACROS_DATA_MIGRATION);
break;
#endif
case IDC_NEW_TAB:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.NewTab", delta);
}
LogMenuAction(MENU_ACTION_NEW_TAB);
break;
case IDC_NEW_WINDOW:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.NewWindow",
delta);
}
LogMenuAction(MENU_ACTION_NEW_WINDOW);
break;
case IDC_NEW_INCOGNITO_WINDOW:
@ -1116,9 +1160,10 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
break;
// Recent tabs menu.
case IDC_RESTORE_TAB:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.RestoreTab",
delta);
}
LogMenuAction(MENU_ACTION_RESTORE_TAB);
break;
case IDC_OPEN_RECENT_TAB:
@ -1136,13 +1181,15 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
LogMenuAction(MENU_ACTION_RECENT_TABS_LOGIN_FOR_DEVICE_TABS);
break;
case IDC_FIND:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Find", delta);
}
LogMenuAction(MENU_ACTION_FIND);
break;
case IDC_PRINT:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Print", delta);
}
LogMenuAction(MENU_ACTION_PRINT);
break;
@ -1156,18 +1203,21 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
// Edit menu.
case IDC_CUT:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Cut", delta);
}
LogMenuAction(MENU_ACTION_CUT);
break;
case IDC_COPY:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Copy", delta);
}
LogMenuAction(MENU_ACTION_COPY);
break;
case IDC_PASTE:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Paste", delta);
}
LogMenuAction(MENU_ACTION_PASTE);
break;
@ -1250,15 +1300,17 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
LogMenuAction(MENU_ACTION_CLEAR_BROWSING_DATA);
break;
case IDC_VIEW_SOURCE:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.ViewSource",
delta);
}
LogMenuAction(MENU_ACTION_VIEW_SOURCE);
break;
case IDC_DEV_TOOLS:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.DevTools",
delta);
}
LogMenuAction(MENU_ACTION_DEV_TOOLS);
break;
case IDC_DEV_TOOLS_CONSOLE:
@ -1306,7 +1358,16 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
browser()->window()->NotifyFeatureEngagementEvent(
feature_engagement::events::kSidePanelFromMenuShown);
break;
case IDC_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL:
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes(
"WrenchMenu.TimeToAction.ShowCustomizeChromeSidePanel", delta);
}
LogMenuAction(MENU_ACTION_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL);
// Close IPH for side panel menu, if shown.
browser()->window()->NotifyFeatureEngagementEvent(
feature_engagement::events::kSidePanelFromMenuShown);
break;
// Zoom menu
case IDC_ZOOM_MINUS:
if (!uma_action_recorded_) {
@ -1349,45 +1410,51 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
profile_metrics::GetBrowserProfileType(browser_->profile()));
break;
case IDC_OPTIONS:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Settings",
delta);
}
LogMenuAction(MENU_ACTION_OPTIONS);
base::UmaHistogramEnumeration(
"Settings.OpenSettingsFromMenu.PerProfileType",
profile_metrics::GetBrowserProfileType(browser_->profile()));
break;
case IDC_ABOUT:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.About", delta);
}
LogMenuAction(MENU_ACTION_ABOUT);
break;
// Help menu.
case IDC_HELP_PAGE_VIA_MENU:
base::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu"));
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.HelpPage",
delta);
}
LogMenuAction(MENU_ACTION_HELP_PAGE_VIA_MENU);
break;
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
case IDC_SHOW_BETA_FORUM:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.BetaForum",
delta);
}
LogMenuAction(MENU_ACTION_BETA_FORUM);
break;
case IDC_FEEDBACK:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Feedback",
delta);
}
LogMenuAction(MENU_ACTION_FEEDBACK);
break;
case IDC_CHROME_TIPS:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.ChromeTips",
delta);
}
LogMenuAction(MENU_ACTION_CHROME_TIPS);
break;
case IDC_CHROME_WHATS_NEW:
@ -1407,8 +1474,9 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
LogMenuAction(MENU_ACTION_TOGGLE_REQUEST_TABLET_SITE);
break;
case IDC_EXIT:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.Exit", delta);
}
LogMenuAction(MENU_ACTION_EXIT);
break;
@ -1421,8 +1489,9 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
LogMenuAction(MENU_ACTION_OPEN_IN_CHROME);
break;
case IDC_WEB_APP_MENU_APP_INFO:
if (!uma_action_recorded_)
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes("WrenchMenu.TimeToAction.AppInfo", delta);
}
LogMenuAction(MENU_ACTION_APP_INFO);
break;
case IDC_VIEW_PASSWORDS:
@ -1552,6 +1621,30 @@ void AppMenuModel::LogMenuMetrics(int command_id) {
}
LogMenuAction(MENU_ACTION_SET_BROWSER_AS_DEFAULT);
break;
case IDC_SAFETY_HUB_SHOW_PASSWORD_CHECKUP:
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes(
"WrenchMenu.TimeToAction.SafetyHubNotificationPasswordCheck",
delta);
}
LogMenuAction(MENU_ACTION_SAFETY_HUB_SHOW_PASSWORD_CHECKUP);
break;
case IDC_OPEN_SAFETY_HUB:
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes(
"WrenchMenu.TimeToAction.SafetyHubNotificationOpenSafetyHub",
delta);
}
LogMenuAction(MENU_ACTION_SHOW_SAFETY_HUB);
break;
case IDC_SAFETY_HUB_MANAGE_EXTENSIONS:
if (!uma_action_recorded_) {
base::UmaHistogramMediumTimes(
"WrenchMenu.TimeToAction.SafetyHubNotificationManageExtensions",
delta);
}
LogMenuAction(MENU_ACTION_SAFETY_HUB_MANAGE_EXTENSIONS);
break;
default: {
if (IsOtherProfileCommand(command_id)) {
if (!uma_action_recorded_) {
@ -1575,10 +1668,12 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
return browser_->profile()->GetPrefs()->GetBoolean(
bookmarks::prefs::kShowBookmarkBar);
}
if (command_id == IDC_PROFILING_ENABLED)
if (command_id == IDC_PROFILING_ENABLED) {
return content::Profiling::BeingProfiled();
if (command_id == IDC_TOGGLE_REQUEST_TABLET_SITE)
}
if (command_id == IDC_TOGGLE_REQUEST_TABLET_SITE) {
return chrome::IsRequestingTabletSite(browser_);
}
return false;
}
@ -1587,8 +1682,9 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
GlobalError* error =
GlobalErrorServiceFactory::GetForProfile(browser_->profile())
->GetGlobalErrorByMenuItemCommandID(command_id);
if (error)
if (error) {
return true;
}
switch (command_id) {
case IDC_NEW_INCOGNITO_WINDOW:
@ -1634,24 +1730,18 @@ void AppMenuModel::Build() {
// Build (and, by extension, Init) should only be called once.
DCHECK_EQ(0u, GetItemCount());
auto from_vector_icon = [](const gfx::VectorIcon& vector_icon) {
return ui::ImageModel::FromVectorIcon(vector_icon, ui::kColorMenuIcon,
kDefaultIconSize);
};
bool need_separator = false;
if (app_menu_icon_controller_ &&
app_menu_icon_controller_->GetTypeAndSeverity().type ==
AppMenuIconController::IconType::UPGRADE_NOTIFICATION) {
const auto update_icon =
from_vector_icon(kBrowserToolsUpdateChromeRefreshIcon);
AddSeparator(ui::SPACING_SEPARATOR);
const auto update_icon = ui::ImageModel::FromVectorIcon(
kBrowserToolsUpdateChromeRefreshIcon,
ui::kColorMenuIconOnEmphasizedBackground, kDefaultIconSize);
if (browser_defaults::kShowUpgradeMenuItem) {
const MenuItemStrings upgrade_strings =
GetUpgradeDialogTitleAndMinorText();
AddItemWithIcon(IDC_UPGRADE_DIALOG, upgrade_strings.title_text,
AddItemWithIcon(IDC_UPGRADE_DIALOG, GetUpgradeDialogTitleText(),
update_icon);
SetMinorText(GetIndexOfCommandId(IDC_UPGRADE_DIALOG).value(),
upgrade_strings.minor_text);
AddSeparator(ui::SPACING_SEPARATOR);
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
AddItemWithIcon(IDC_LACROS_DATA_MIGRATION,
@ -1689,14 +1779,17 @@ void AppMenuModel::Build() {
AddSeparator(ui::NORMAL_SEPARATOR);
#if !BUILDFLAG(IS_CHROMEOS_ASH)
sub_menus_.push_back(
std::make_unique<ProfileSubMenuModel>(this, browser()->profile()));
sub_menus_.push_back(std::make_unique<ProfileSubMenuModel>(
this, browser()->profile(), browser()->window()->GetColorProvider()));
auto* const profile_submenu_model =
static_cast<ProfileSubMenuModel*>(sub_menus_.back().get());
AddSubMenu(IDC_PROFILE_MENU_IN_APP_MENU,
profile_submenu_model->profile_name(), profile_submenu_model);
SetIcon(GetIndexOfCommandId(IDC_PROFILE_MENU_IN_APP_MENU).value(),
profile_submenu_model->avatar_image_model());
SetElementIdentifierAt(
GetIndexOfCommandId(IDC_PROFILE_MENU_IN_APP_MENU).value(),
kProfileMenuItem);
AddSeparator(ui::SPACING_SEPARATOR);
#endif
@ -1770,7 +1863,10 @@ void AppMenuModel::Build() {
AddItemWithStringIdAndVectorIcon(this, IDC_PRINT, IDS_PRINT, kPrintMenuIcon);
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (LensOverlayController::IsEnabled(browser()->profile())) {
if (browser()
->GetFeatures()
.lens_overlay_entry_point_controller()
->IsEnabled()) {
AddItemWithStringIdAndVectorIcon(
this, IDC_CONTENT_CONTEXT_LENS_OVERLAY, IDS_SHOW_LENS_OVERLAY,
vector_icons::kGoogleLensMonochromeLogoIcon);
@ -1796,17 +1892,12 @@ void AppMenuModel::Build() {
if (tab_organization_service) {
AddItemWithStringIdAndVectorIcon(
this, IDC_ORGANIZE_TABS, IDS_TAB_ORGANIZE_MENU, kAutoTabGroupsIcon);
SetIsNewFeatureAt(GetIndexOfCommandId(IDC_ORGANIZE_TABS).value(), true);
SetIsNewFeatureAt(GetIndexOfCommandId(IDC_ORGANIZE_TABS).value(),
browser()->window()->MaybeShowNewBadgeFor(
features::kTabOrganization));
}
}
if (base::FeatureList::IsEnabled(
performance_manager::features::kPerformanceControlsSidePanel)) {
AddItemWithStringId(IDC_PERFORMANCE, IDS_SHOW_PERFORMANCE);
SetElementIdentifierAt(GetIndexOfCommandId(IDC_PERFORMANCE).value(),
kPerformanceMenuItem);
}
AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_TRANSLATE, IDS_SHOW_TRANSLATE,
kTranslateIcon);
@ -1814,12 +1905,9 @@ void AppMenuModel::Build() {
sub_menus_.push_back(
std::make_unique<SaveAndShareSubMenuModel>(this, browser_));
int string_id =
media_router::MediaRouterEnabled(browser()->profile()) &&
base::FeatureList::IsEnabled(features::kCastAppMenuExperiment)
? (features::kCastListedFirst.Get() ? IDS_CAST_SAVE_AND_SHARE_MENU
: IDS_SAVE_SHARE_AND_CAST_MENU)
: IDS_SAVE_AND_SHARE_MENU;
int string_id = media_router::MediaRouterEnabled(browser()->profile())
? IDS_CAST_SAVE_AND_SHARE_MENU
: IDS_SAVE_AND_SHARE_MENU;
AddSubMenuWithStringIdAndVectorIcon(this, IDC_SAVE_AND_SHARE_MENU, string_id,
sub_menus_.back().get(),
kFileSaveChromeRefreshIcon);
@ -1873,10 +1961,11 @@ void AppMenuModel::Build() {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
if (chrome::ShouldDisplayManagedUi(browser_->profile())) {
AddSeparator(ui::NORMAL_SEPARATOR);
AddItemWithIcon(
IDC_SHOW_MANAGEMENT_PAGE,
chrome::GetManagedUiMenuItemLabel(browser_->profile()),
from_vector_icon(chrome::GetManagedUiIcon(browser_->profile())));
AddItemWithIcon(IDC_SHOW_MANAGEMENT_PAGE,
chrome::GetManagedUiMenuItemLabel(browser_->profile()),
ui::ImageModel::FromVectorIcon(
chrome::GetManagedUiIcon(browser_->profile()),
ui::kColorMenuIcon, kDefaultIconSize));
SetAccessibleNameAt(
GetIndexOfCommandId(IDC_SHOW_MANAGEMENT_PAGE).value(),
@ -2001,8 +2090,9 @@ void AppMenuModel::UpdateSettingsItemState() {
g_browser_process->local_state());
std::optional<size_t> index = GetIndexOfCommandId(IDC_OPTIONS);
if (index.has_value())
if (index.has_value()) {
SetEnabledAt(index.value(), !is_disabled);
}
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
index = GetIndexOfCommandId(IDC_HELP_MENU);
@ -2010,13 +2100,15 @@ void AppMenuModel::UpdateSettingsItemState() {
ui::SimpleMenuModel* help_menu =
static_cast<ui::SimpleMenuModel*>(GetSubmenuModelAt(index.value()));
index = help_menu->GetIndexOfCommandId(IDC_ABOUT);
if (index.has_value())
if (index.has_value()) {
help_menu->SetEnabledAt(index.value(), !is_disabled);
}
}
#else // BUILDFLAG(GOOGLE_CHROME_BRANDING)
index = GetIndexOfCommandId(IDC_ABOUT);
if (index.has_value())
if (index.has_value()) {
SetEnabledAt(index.value(), !is_disabled);
}
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
}
#endif // BUILDFLAG(IS_CHROMEOS)

View file

@ -149,8 +149,10 @@ const AcceleratorMapping kAcceleratorMap[] = {
{ui::VKEY_F6, ui::EF_SHIFT_DOWN, IDC_FOCUS_PREVIOUS_PANE},
{ui::VKEY_F6, ui::EF_CONTROL_DOWN, IDC_FOCUS_WEB_CONTENTS_PANE},
#if BUILDFLAG(IS_CHROMEOS_ASH)
// On Chrome OS, Control + Search + 7 toggles caret browsing.
// Note that VKEY_F7 is not a typo; Search + 7 maps to F7 for accelerators.
// On Chrome OS, Control + Search + the seventh key from escape (most
// commonly Brightness Up) toggles caret browsing.
// Note that VKEY_F7 is not a typo; Search + the seventh function key maps
// to F7 for accelerators.
{ui::VKEY_F7, ui::EF_CONTROL_DOWN, IDC_CARET_BROWSING_TOGGLE},
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
{ui::VKEY_F10, ui::EF_NONE, IDC_FOCUS_MENU_BAR},
@ -253,11 +255,6 @@ const AcceleratorMapping kAcceleratorMap[] = {
{ui::VKEY_OEM_PLUS, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN, IDC_ZOOM_PLUS},
#endif // !BUILDFLAG(IS_CHROMEOS)
#endif // !BUILDFLAG(IS_MAC)
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) && \
(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
{ui::VKEY_S, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
IDC_CONTENT_CONTEXT_RUN_LAYOUT_EXTRACTION},
#endif
};
const AcceleratorMapping kDevToolsAcceleratorMap[] = {

View file

@ -43,7 +43,6 @@
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/browser/ui/intent_picker_tab_helper.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/side_panel/companion/companion_utils.h"
#include "chrome/browser/ui/side_search/side_search_utils.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.h"
@ -69,8 +68,8 @@
#include "chrome/browser/ui/views/page_action/page_action_icon_controller.h"
#include "chrome/browser/ui/views/performance_controls/battery_saver_button.h"
#include "chrome/browser/ui/views/performance_controls/performance_intervention_button.h"
#include "chrome/browser/ui/views/profiles/management_toolbar_button.h"
#include "chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_toolbar_icon_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel_toolbar_container.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/app_menu.h"
#include "chrome/browser/ui/views/toolbar/back_forward_button.h"
@ -79,7 +78,6 @@
#include "chrome/browser/ui/views/toolbar/home_button.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/reload_button.h"
#include "chrome/browser/ui/views/toolbar/side_panel_toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
@ -148,6 +146,8 @@
using base::UserMetricsAction;
using content::WebContents;
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kActionItemUnderlineIndicatorKey, false)
namespace {
// Gets the display mode for a given browser.
@ -202,6 +202,7 @@ class TabstripLikeBackground : public views::Background {
const raw_ptr<BrowserView> browser_view_;
};
} // namespace
class ToolbarView::ContainerView : public views::View {
@ -232,7 +233,7 @@ ToolbarView::ToolbarView(Browser* browser, BrowserView* browser_view)
container_view_ = AddChildView(std::make_unique<ContainerView>());
SetAccessibleRole(ax::mojom::Role::kToolbar);
GetViewAccessibility().SetRole(ax::mojom::Role::kToolbar);
if (display_mode_ == DisplayMode::NORMAL) {
container_view_->SetBackground(
@ -246,8 +247,13 @@ ToolbarView::ToolbarView(Browser* browser, BrowserView* browser_view)
}
ToolbarView::~ToolbarView() {
if (display_mode_ != DisplayMode::NORMAL)
if (display_mode_ != DisplayMode::NORMAL) {
return;
}
if (base::FeatureList::IsEnabled(features::kResponsiveToolbar)) {
overflow_button_->set_toolbar_controller(nullptr);
}
for (const auto& view_and_command : GetViewCommandMap())
chrome::RemoveCommandObserver(browser_, view_and_command.second, this);
@ -263,7 +269,6 @@ void ToolbarView::Init() {
#endif
// The background views must be behind container_view_.
if (features::IsChromeRefresh2023()) {
background_view_left_ = AddChildViewAt(std::make_unique<View>(), 0);
background_view_left_->SetBackground(
std::make_unique<TabstripLikeBackground>(browser_view_));
@ -274,7 +279,6 @@ void ToolbarView::Init() {
active_state_subscription_ =
GetWidget()->RegisterPaintAsActiveChangedCallback(base::BindRepeating(
&ToolbarView::ActiveStateChanged, base::Unretained(this)));
}
auto location_bar = std::make_unique<LocationBarView>(
browser_, browser_->profile(), browser_->command_controller(), this,
@ -360,9 +364,7 @@ void ToolbarView::Init() {
extensions_container =
std::make_unique<ExtensionsToolbarContainer>(browser_);
if (features::IsChromeRefresh2023()) {
toolbar_divider = std::make_unique<views::View>();
}
toolbar_divider = std::make_unique<views::View>();
}
std::unique_ptr<media_router::CastToolbarButton> cast;
if (media_router::MediaRouterEnabled(browser_->profile()))
@ -406,10 +408,8 @@ void ToolbarView::Init() {
GetLayoutConstant(TOOLBAR_DIVIDER_HEIGHT)));
}
if (features::IsSidePanelPinningEnabled()) {
pinned_toolbar_actions_container_ = container_view_->AddChildView(
std::make_unique<PinnedToolbarActionsContainer>(browser_view_));
}
pinned_toolbar_actions_container_ = container_view_->AddChildView(
std::make_unique<PinnedToolbarActionsContainer>(browser_view_));
if (IsChromeLabsEnabled()) {
chrome_labs_model_ = std::make_unique<ChromeLabsModel>();
@ -431,20 +431,17 @@ void ToolbarView::Init() {
}
}
// Only show the Battery Saver button when it is not controlled by the OS and
// the performance side panel is not enabled. On ChromeOS the battery icon in
// the shelf shows the same information.
if (!performance_manager::user_tuning::IsBatterySaverModeManagedByOS() &&
!base::FeatureList::IsEnabled(
performance_manager::features::kPerformanceControlsSidePanel)) {
// Only show the Battery Saver button when it is not controlled by the OS. On
// ChromeOS the battery icon in the shelf shows the same information.
if (!performance_manager::user_tuning::IsBatterySaverModeManagedByOS()) {
battery_saver_button_ = container_view_->AddChildView(
std::make_unique<BatterySaverButton>(browser_view_));
}
if (base::FeatureList::IsEnabled(
performance_manager::features::kPerformanceIntervention)) {
if (performance_manager::features::
ShouldUsePerformanceInterventionBackend()) {
performance_intervention_button_ = container_view_->AddChildView(
std::make_unique<PerformanceInterventionButton>());
std::make_unique<PerformanceInterventionButton>(browser_view_));
}
if (cast)
@ -461,16 +458,11 @@ void ToolbarView::Init() {
send_tab_to_self_button_ =
container_view_->AddChildView(std::move(send_tab_to_self_button));
if (!features::IsSidePanelPinningEnabled() &&
!base::CommandLine::ForCurrentProcess()->HasSwitch("hide-sidepanel-button")) {
if (companion::IsCompanionFeatureEnabled()) {
side_panel_container_ = container_view_->AddChildView(
std::make_unique<SidePanelToolbarContainer>(browser_view_));
} else {
side_panel_button_ = container_view_->AddChildView(
std::make_unique<SidePanelToolbarButton>(browser_));
}
}
#if !BUILDFLAG(IS_CHROMEOS)
management_toolbar_button_ =
container_view_->AddChildView(std::make_unique<ManagementToolbarButton>(
browser_view_, browser_->profile()));
#endif
avatar_ = container_view_->AddChildView(
std::make_unique<AvatarToolbarButton>(browser_view_));
@ -485,6 +477,11 @@ void ToolbarView::Init() {
browser_->profile()->GetOTRProfileID().IsCaptivePortal());
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
show_avatar_toolbar_button = !chromeos::IsManagedGuestSession();
#else
// DevTools profiles are OffTheRecord, so hide it there.
show_avatar_toolbar_button = browser_->profile()->IsIncognitoProfile() ||
browser_->profile()->IsGuestSession() ||
browser_->profile()->IsRegularProfile();
#endif
const std::string sab_value = base::CommandLine::ForCurrentProcess()->
@ -521,7 +518,7 @@ void ToolbarView::Init() {
auto app_menu_button = std::make_unique<BrowserAppMenuButton>(this);
app_menu_button->SetFlipCanvasOnPaintForRTLUI(true);
app_menu_button->SetAccessibleName(
app_menu_button->GetViewAccessibility().SetName(
l10n_util::GetStringUTF16(IDS_ACCNAME_APP));
app_menu_button->SetTooltipText(
l10n_util::GetStringUTF16(IDS_APPMENU_TOOLTIP));
@ -588,10 +585,6 @@ void ToolbarView::Update(WebContents* tab) {
pinned_toolbar_actions_container_->UpdateAllIcons();
}
if (side_panel_container_) {
side_panel_container_->UpdateAllIcons();
}
if (reload_)
reload_->SetMenuEnabled(chrome::IsDebuggerAttachedToCurrentTab(browser_));
}
@ -704,13 +697,6 @@ ExtensionsToolbarButton* ToolbarView::GetExtensionsButton() const {
return extensions_container_->GetExtensionsButton();
}
SidePanelToolbarButton* ToolbarView::GetSidePanelButton() {
if (side_panel_container_) {
return side_panel_container_->GetSidePanelButton();
}
return side_panel_button_;
}
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, LocationBarView::Delegate implementation:
@ -822,14 +808,12 @@ void ToolbarView::Layout(PassKey) {
// The container view should be the exact same size/position as ToolbarView.
container_view_->SetSize(size());
if (features::IsChromeRefresh2023()) {
// The background views should be behind the top-left and top-right corners
// of the container_view_.
const int corner_radius = GetLayoutConstant(TOOLBAR_CORNER_RADIUS);
background_view_left_->SetBounds(0, 0, corner_radius, corner_radius);
background_view_right_->SetBounds(width() - corner_radius, 0, corner_radius,
corner_radius);
}
// The background views should be behind the top-left and top-right corners
// of the container_view_.
const int corner_radius = GetLayoutConstant(TOOLBAR_CORNER_RADIUS);
background_view_left_->SetBounds(0, 0, corner_radius, corner_radius);
background_view_right_->SetBounds(width() - corner_radius, 0, corner_radius,
corner_radius);
if (display_mode_ == DisplayMode::CUSTOM_TAB) {
custom_tab_bar_->SetBounds(0, 0, width(),
@ -840,10 +824,7 @@ void ToolbarView::Layout(PassKey) {
if (display_mode_ == DisplayMode::NORMAL) {
LayoutCommon();
if (features::IsChromeRefresh2023()) {
UpdateClipPath();
}
UpdateClipPath();
}
// Use two-pass solution to avoid the overflow button interfering with toolbar
@ -1018,19 +999,9 @@ void ToolbarView::InitLayout() {
pinned_toolbar_actions_container_->SetProperty(
views::kFlexBehaviorKey,
views::FlexSpecification(
base::BindRepeating(
&PinnedToolbarActionsContainer::CustomFlexRule,
base::Unretained(pinned_toolbar_actions_container_)))
.WithOrder(kToolbarActionsFlexOrder));
} else if (side_panel_container_) {
const views::FlexSpecification side_panel_flex_rule =
views::FlexSpecification(
side_panel_container_->GetAnimatingLayoutManager()
pinned_toolbar_actions_container_->GetAnimatingLayoutManager()
->GetDefaultFlexRule())
.WithOrder(kToolbarActionsFlexOrder);
side_panel_container_->SetProperty(views::kFlexBehaviorKey,
side_panel_flex_rule);
.WithOrder(kToolbarActionsFlexOrder));
}
if (toolbar_divider_) {
@ -1047,10 +1018,7 @@ void ToolbarView::InitLayout() {
ToolbarController::GetDefaultResponsiveElements(browser_),
ToolbarController::GetDefaultOverflowOrder(), kToolbarFlexOrderStart,
container_view_, overflow_button_, pinned_toolbar_actions_container_);
overflow_button_->set_create_menu_model_callback(
base::BindRepeating(&ToolbarController::CreateOverflowMenuModel,
base::Unretained(toolbar_controller_.get())));
overflow_button_->set_toolbar_controller(toolbar_controller_.get());
}
LayoutCommon();
@ -1064,7 +1032,7 @@ void ToolbarView::LayoutCommon() {
? LayoutInset::WEBUI_TAB_STRIP_TOOLBAR_INTERIOR_MARGIN
: LayoutInset::TOOLBAR_INTERIOR_MARGIN);
if (features::IsChromeRefresh2023() && !browser_view_->webui_tab_strip()) {
if (!browser_view_->webui_tab_strip()) {
if (app_menu_button_->IsLabelPresentAndVisible()) {
// The interior margin in an expanded state should be more than in a
// collapsed state.
@ -1127,7 +1095,7 @@ void ToolbarView::UpdateTypeAndSeverity(
accname_app = l10n_util::GetStringFUTF16(
IDS_ACCNAME_APP_UPGRADE_RECOMMENDED, accname_app);
}
app_menu_button_->SetAccessibleName(accname_app);
app_menu_button_->GetViewAccessibility().SetName(accname_app);
app_menu_button_->SetTypeAndSeverity(type_and_severity);
if (base::FeatureList::IsEnabled(features::kDefaultBrowserPromptRefresh) &&
@ -1141,25 +1109,6 @@ void ToolbarView::UpdateTypeAndSeverity(
}
}
SkColor ToolbarView::GetDefaultColorForSeverity(
AppMenuIconController::Severity severity) const {
ui::ColorId color_id;
switch (severity) {
case AppMenuIconController::Severity::NONE:
return GetColorProvider()->GetColor(kColorToolbarButtonIcon);
case AppMenuIconController::Severity::LOW:
color_id = kColorAppMenuHighlightSeverityLow;
break;
case AppMenuIconController::Severity::MEDIUM:
color_id = kColorAppMenuHighlightSeverityMedium;
break;
case AppMenuIconController::Severity::HIGH:
color_id = kColorAppMenuHighlightSeverityHigh;
break;
}
return GetColorProvider()->GetColor(color_id);
}
ExtensionsToolbarContainer* ToolbarView::GetExtensionsToolbarContainer() {
return extensions_container_;
}
@ -1210,6 +1159,18 @@ views::AccessiblePaneView* ToolbarView::GetAsAccessiblePaneView() {
views::View* ToolbarView::GetAnchorView(
std::optional<PageActionIconType> type) {
if (features::IsToolbarPinningEnabled()) {
if (pinned_toolbar_actions_container_ && type.has_value()) {
const std::optional<actions::ActionId> action_id =
GetPageActionIconView(type.value())->action_id();
if (action_id.has_value() &&
pinned_toolbar_actions_container_->IsActionPinnedOrPoppedOut(
action_id.value())) {
return pinned_toolbar_actions_container_->GetButtonFor(
action_id.value());
}
}
}
return location_bar_;
}
@ -1219,10 +1180,11 @@ void ToolbarView::ZoomChangedForActiveTab(bool can_show_bubble) {
}
AvatarToolbarButton* ToolbarView::GetAvatarToolbarButton() {
if (avatar_)
return avatar_;
return avatar_;
}
return nullptr;
ManagementToolbarButton* ToolbarView::GetManagementToolbarButton() {
return management_toolbar_button_;
}
ToolbarButton* ToolbarView::GetBackButton() {

View file

@ -43,14 +43,14 @@ std::string MachineIdProvider::GetMachineId() {
base::FilePath executable_path;
if (!base::PathService::Get(base::FILE_EXE, &executable_path)) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return std::string();
}
std::vector<base::FilePath::StringType> path_components =
executable_path.GetComponents();
if (path_components.empty()) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return std::string();
}
base::FilePath::StringType drive_name = L"\\\\.\\" + path_components[0];

View file

@ -7,6 +7,8 @@
#include <windows.h>
#include "base/base64.h"
#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/command_line.h"
@ -290,7 +292,6 @@ OSCrypt::InitResult OSCryptImpl::InitWithExistingKey(PrefService* local_state) {
if (!base::StartsWith(encrypted_key_with_header, kDPAPIKeyPrefix,
base::CompareCase::SENSITIVE)) {
DUMP_WILL_BE_NOTREACHED_NORETURN() << "Invalid key format.";
return OSCrypt::kInvalidKeyFormat;
}
@ -342,6 +343,9 @@ std::string OSCryptImpl::GetRawEncryptionKey() {
}
bool OSCryptImpl::IsEncryptionAvailable() {
if (use_mock_key_) {
return !GetRawEncryptionKey().empty();
}
return !encryption_key_.empty();
}

View file

@ -30,6 +30,22 @@ if (is_mac) {
}
if (is_android) {
import("//third_party/jni_zero/jni_zero.gni")
rust_static_library("fontations_name_table_ffi") {
allow_unsafe = true # Needed for FFI that underpins the `cxx` crate.
crate_root = "font_unique_name_lookup/name_table_ffi.rs"
sources = [ "font_unique_name_lookup/name_table_ffi.rs" ]
cxx_bindings = [ "font_unique_name_lookup/name_table_ffi.rs" ]
visibility = [
":browser",
"//content/test:*",
]
deps = [
"//third_party/rust/font_types/v0_5:lib",
"//third_party/rust/read_fonts/v0_19:lib",
"//third_party/rust/skrifa/v0_19:lib",
]
}
}
source_set("browser") {
@ -72,6 +88,7 @@ source_set("browser") {
"//cc/animation",
"//cc/mojo_embedder",
"//cc/paint",
"//components/attribution_reporting:data_host_mojom",
"//components/attribution_reporting:mojom",
"//components/back_forward_cache:enum",
"//components/browsing_topics/common:common",
@ -82,12 +99,11 @@ source_set("browser") {
"//components/download/public/common:public",
"//components/file_access",
"//components/filename_generation",
"//components/input",
"//components/link_header_util",
"//components/metrics",
"//components/metrics:single_sample_metrics",
"//components/miracle_parameter/common",
"//components/ml/mojom",
"//components/ml/webnn:features",
"//components/network_session_configurator/browser",
"//components/offline_pages/buildflags",
"//components/offline_pages/core/request_header",
@ -174,6 +190,7 @@ source_set("browser") {
"//media/mojo:buildflags",
"//media/mojo/clients",
"//media/mojo/mojom",
"//media/mojo/mojom:web_speech_recognition",
"//media/mojo/services",
"//media/webrtc",
"//mojo/core/embedder",
@ -228,6 +245,7 @@ source_set("browser") {
"//services/viz/public/mojom",
"//services/webnn:webnn_service",
"//services/webnn:webnn_switches",
"//services/webnn/public/mojom",
"//skia",
"//skia/public/mojom",
"//storage/browser",
@ -242,7 +260,6 @@ source_set("browser") {
"//third_party/blink/public/common:common",
"//third_party/blink/public/common:font_enumeration_table_proto",
"//third_party/blink/public/strings",
"//third_party/blink/public/strings:accessibility_strings",
"//third_party/boringssl",
"//third_party/brotli:dec",
"//third_party/distributed_point_functions",
@ -291,6 +308,7 @@ source_set("browser") {
"//ui/resources",
"//ui/shell_dialogs",
"//ui/snapshot",
"//ui/strings:auto_image_annotation_strings",
"//ui/strings:ax_strings",
"//ui/touch_selection",
"//v8:v8_version",
@ -385,6 +403,8 @@ source_set("browser") {
"accessibility/web_contents_accessibility.h",
"after_startup_task_utils.cc",
"after_startup_task_utils.h",
"agent_cluster_key.cc",
"agent_cluster_key.h",
"aggregation_service/aggregatable_report.cc",
"aggregation_service/aggregatable_report.h",
"aggregation_service/aggregatable_report_assembler.cc",
@ -415,8 +435,16 @@ source_set("browser") {
"aggregation_service/public_key_parsing_utils.h",
"aggregation_service/report_scheduler_timer.cc",
"aggregation_service/report_scheduler_timer.h",
"ai/echo_ai_manager_impl.cc",
"ai/echo_ai_manager_impl.h",
"ai/echo_ai_text_session.cc",
"ai/echo_ai_text_session.h",
"attribution_reporting/aggregatable_attribution_utils.cc",
"attribution_reporting/aggregatable_attribution_utils.h",
"attribution_reporting/aggregatable_debug_rate_limit_table.cc",
"attribution_reporting/aggregatable_debug_rate_limit_table.h",
"attribution_reporting/aggregatable_debug_report.cc",
"attribution_reporting/aggregatable_debug_report.h",
"attribution_reporting/attribution_background_registrations_id.h",
"attribution_reporting/attribution_beacon_id.h",
"attribution_reporting/attribution_config.cc",
@ -454,11 +482,13 @@ source_set("browser") {
"attribution_reporting/attribution_report_network_sender.cc",
"attribution_reporting/attribution_report_network_sender.h",
"attribution_reporting/attribution_report_sender.h",
"attribution_reporting/attribution_storage.h",
"attribution_reporting/attribution_storage_delegate.cc",
"attribution_reporting/attribution_storage_delegate.h",
"attribution_reporting/attribution_storage_delegate_impl.cc",
"attribution_reporting/attribution_storage_delegate_impl.h",
"attribution_reporting/attribution_resolver.h",
"attribution_reporting/attribution_resolver_delegate.cc",
"attribution_reporting/attribution_resolver_delegate.h",
"attribution_reporting/attribution_resolver_delegate_impl.cc",
"attribution_reporting/attribution_resolver_delegate_impl.h",
"attribution_reporting/attribution_resolver_impl.cc",
"attribution_reporting/attribution_resolver_impl.h",
"attribution_reporting/attribution_storage_sql.cc",
"attribution_reporting/attribution_storage_sql.h",
"attribution_reporting/attribution_storage_sql_migrations.cc",
@ -478,6 +508,7 @@ source_set("browser") {
"attribution_reporting/rate_limit_result.h",
"attribution_reporting/rate_limit_table.cc",
"attribution_reporting/rate_limit_table.h",
"attribution_reporting/send_result.cc",
"attribution_reporting/send_result.h",
"attribution_reporting/sql_queries.h",
"attribution_reporting/sql_utils.cc",
@ -744,6 +775,8 @@ source_set("browser") {
"compute_pressure/pressure_service_for_frame.h",
"compute_pressure/pressure_service_for_worker.cc",
"compute_pressure/pressure_service_for_worker.h",
"compute_pressure/web_contents_pressure_manager_proxy.cc",
"compute_pressure/web_contents_pressure_manager_proxy.h",
"contacts/contacts_manager_impl.cc",
"contacts/contacts_manager_impl.h",
"contacts/contacts_provider.h",
@ -936,8 +969,6 @@ source_set("browser") {
"download/mhtml_extra_parts_impl.h",
"download/mhtml_generation_manager.cc",
"download/mhtml_generation_manager.h",
"download/network_download_pending_url_loader_factory.cc",
"download/network_download_pending_url_loader_factory.h",
"download/save_file.cc",
"download/save_file.h",
"download/save_file_manager.cc",
@ -978,6 +1009,10 @@ source_set("browser") {
"file_system/file_system_url_loader_factory.h",
"file_system_access/features.cc",
"file_system_access/features.h",
"file_system_access/file_path_watcher/file_path_watcher.cc",
"file_system_access/file_path_watcher/file_path_watcher.h",
"file_system_access/file_path_watcher/file_path_watcher_histogram.cc",
"file_system_access/file_path_watcher/file_path_watcher_histogram.h",
"file_system_access/file_system_access_access_handle_host_impl.cc",
"file_system_access/file_system_access_access_handle_host_impl.h",
"file_system_access/file_system_access_bucket_path_watcher.cc",
@ -1094,6 +1129,7 @@ source_set("browser") {
"image_capture/image_capture_impl.h",
"indexed_db/indexed_db_internals_ui.cc",
"indexed_db/indexed_db_internals_ui.h",
"installedapp/fetch_related_apps_task.h",
"installedapp/installed_app_provider_impl.cc",
"installedapp/installed_app_provider_impl.h",
"interest_group/ad_auction_document_data.cc",
@ -1175,6 +1211,10 @@ source_set("browser") {
"interest_group/subresource_url_authorizations.h",
"interest_group/subresource_url_builder.cc",
"interest_group/subresource_url_builder.h",
"interest_group/trusted_signals_cache_impl.cc",
"interest_group/trusted_signals_cache_impl.h",
"interest_group/trusted_signals_fetcher.cc",
"interest_group/trusted_signals_fetcher.h",
"isolated_origin_util.cc",
"isolated_origin_util.h",
"isolation_context.cc",
@ -1312,6 +1352,8 @@ source_set("browser") {
"media/session/audio_focus_delegate.h",
"media/session/media_metadata_sanitizer.cc",
"media/session/media_metadata_sanitizer.h",
"media/session/media_players_callback_aggregator.cc",
"media/session/media_players_callback_aggregator.h",
"media/session/media_session_controller.cc",
"media/session/media_session_controller.h",
"media/session/media_session_controllers_manager.cc",
@ -1345,14 +1387,6 @@ source_set("browser") {
"metrics/histograms_monitor.h",
"mime_registry_impl.cc",
"mime_registry_impl.h",
"ml/ml_service_factory.cc",
"ml/ml_service_factory.h",
"ml/ml_service_impl.cc",
"ml/ml_service_impl.h",
"model_execution/mock_model_execution_session.cc",
"model_execution/mock_model_execution_session.h",
"model_execution/mock_model_manager.cc",
"model_execution/mock_model_manager.h",
"mojo_binder_policy_applier.cc",
"mojo_binder_policy_applier.h",
"mojo_binder_policy_map_impl.cc",
@ -1549,6 +1583,8 @@ source_set("browser") {
"preloading/prerender/prerender_new_tab_handle.h",
"preloading/prerender/prerender_no_vary_search_commit_deferring_condition.cc",
"preloading/prerender/prerender_no_vary_search_commit_deferring_condition.h",
"preloading/prerender/prerender_no_vary_search_hint_commit_deferring_condition.cc",
"preloading/prerender/prerender_no_vary_search_hint_commit_deferring_condition.h",
"preloading/prerender/prerender_subframe_navigation_throttle.cc",
"preloading/prerender/prerender_subframe_navigation_throttle.h",
"preloading/prerenderer.h",
@ -1641,8 +1677,6 @@ source_set("browser") {
"renderer_host/cookie_utils.h",
"renderer_host/cross_process_frame_connector.cc",
"renderer_host/cross_process_frame_connector.h",
"renderer_host/cursor_manager.cc",
"renderer_host/cursor_manager.h",
"renderer_host/data_transfer_util.cc",
"renderer_host/data_transfer_util.h",
"renderer_host/debug_urls.cc",
@ -1682,17 +1716,14 @@ source_set("browser") {
"renderer_host/input/motion_event_web.h",
"renderer_host/input/mouse_wheel_phase_handler.cc",
"renderer_host/input/mouse_wheel_phase_handler.h",
"renderer_host/input/render_widget_host_latency_tracker.cc",
"renderer_host/input/render_widget_host_latency_tracker.h",
"renderer_host/input/stylus_text_selector.cc",
"renderer_host/input/stylus_text_selector.h",
"renderer_host/input/synthetic_gesture_target_aura.cc",
"renderer_host/input/synthetic_gesture_target_aura.h",
"renderer_host/input/synthetic_gesture_target_base.cc",
"renderer_host/input/synthetic_gesture_target_base.h",
"renderer_host/input/touch_emulator.cc",
"renderer_host/input/touch_emulator.h",
"renderer_host/input/touch_emulator_client.h",
"renderer_host/input/touch_emulator_impl.cc",
"renderer_host/input/touch_emulator_impl.h",
"renderer_host/input/touch_selection_controller_client_aura.cc",
"renderer_host/input/touch_selection_controller_client_aura.h",
"renderer_host/input/touch_selection_controller_client_child_frame.cc",
@ -1776,7 +1807,6 @@ source_set("browser") {
"renderer_host/navigation_controller_delegate.h",
"renderer_host/navigation_controller_impl.cc",
"renderer_host/navigation_controller_impl.h",
"renderer_host/navigation_discard_reason.h",
"renderer_host/navigation_entry_impl.cc",
"renderer_host/navigation_entry_impl.h",
"renderer_host/navigation_entry_restore_context_impl.cc",
@ -1799,6 +1829,8 @@ source_set("browser") {
"renderer_host/navigation_transitions/navigation_entry_screenshot_cache.h",
"renderer_host/navigation_transitions/navigation_entry_screenshot_manager.cc",
"renderer_host/navigation_transitions/navigation_entry_screenshot_manager.h",
"renderer_host/navigation_transitions/navigation_transition_data.cc",
"renderer_host/navigation_transitions/navigation_transition_data.h",
"renderer_host/navigation_transitions/navigation_transition_utils.cc",
"renderer_host/navigation_transitions/navigation_transition_utils.h",
"renderer_host/navigation_type.h",
@ -1848,6 +1880,7 @@ source_set("browser") {
"renderer_host/render_process_host_creation_observer.cc",
"renderer_host/render_process_host_impl.cc",
"renderer_host/render_process_host_impl.h",
"renderer_host/render_process_host_impl_receiver_bindings.cc",
"renderer_host/render_process_host_internal_observer.cc",
"renderer_host/render_process_host_internal_observer.h",
"renderer_host/render_view_host_delegate.cc",
@ -1867,8 +1900,6 @@ source_set("browser") {
"renderer_host/render_widget_host_factory.h",
"renderer_host/render_widget_host_impl.cc",
"renderer_host/render_widget_host_impl.h",
"renderer_host/render_widget_host_input_event_router.cc",
"renderer_host/render_widget_host_input_event_router.h",
"renderer_host/render_widget_host_owner_delegate.h",
"renderer_host/render_widget_host_view_aura.cc",
"renderer_host/render_widget_host_view_aura.h",
@ -1876,8 +1907,6 @@ source_set("browser") {
"renderer_host/render_widget_host_view_base.h",
"renderer_host/render_widget_host_view_child_frame.cc",
"renderer_host/render_widget_host_view_child_frame.h",
"renderer_host/render_widget_targeter.cc",
"renderer_host/render_widget_targeter.h",
"renderer_host/renderer_cancellation_throttle.cc",
"renderer_host/renderer_cancellation_throttle.h",
"renderer_host/renderer_sandboxed_process_launcher_delegate.cc",
@ -1898,8 +1927,6 @@ source_set("browser") {
"renderer_host/transient_allow_popup.h",
"renderer_host/transient_focus_source_user_activation.cc",
"renderer_host/transient_focus_source_user_activation.h",
"renderer_host/ui_events_helper.cc",
"renderer_host/ui_events_helper.h",
"renderer_host/view_transition_commit_deferring_condition.cc",
"renderer_host/view_transition_commit_deferring_condition.h",
"renderer_host/view_transition_opt_in_state.cc",
@ -1946,6 +1973,7 @@ source_set("browser") {
"security/coop/coop_related_group.cc",
"security/coop/coop_related_group.h",
"security/coop/coop_swap_result.h",
"security/coop/cross_origin_isolation_mode.h",
"security/coop/cross_origin_opener_policy_access_report_manager.cc",
"security/coop/cross_origin_opener_policy_access_report_manager.h",
"security/coop/cross_origin_opener_policy_reporter.cc",
@ -1962,6 +1990,8 @@ source_set("browser") {
"service_worker/service_worker_cache_storage_matcher.h",
"service_worker/service_worker_cache_writer.cc",
"service_worker/service_worker_cache_writer.h",
"service_worker/service_worker_client.cc",
"service_worker/service_worker_client.h",
"service_worker/service_worker_client_utils.cc",
"service_worker/service_worker_client_utils.h",
"service_worker/service_worker_consts.h",
@ -2055,6 +2085,8 @@ source_set("browser") {
"service_worker/url_loader_client_checker.h",
"shared_storage/shared_storage_budget_charger.cc",
"shared_storage/shared_storage_budget_charger.h",
"shared_storage/shared_storage_code_cache_host_proxy.cc",
"shared_storage/shared_storage_code_cache_host_proxy.h",
"shared_storage/shared_storage_document_service_impl.cc",
"shared_storage/shared_storage_document_service_impl.h",
"shared_storage/shared_storage_event_params.cc",
@ -2065,7 +2097,6 @@ source_set("browser") {
"shared_storage/shared_storage_render_thread_worklet_driver.h",
"shared_storage/shared_storage_url_loader_factory_proxy.cc",
"shared_storage/shared_storage_url_loader_factory_proxy.h",
"shared_storage/shared_storage_worklet_driver.h",
"shared_storage/shared_storage_worklet_host.cc",
"shared_storage/shared_storage_worklet_host.h",
"shared_storage/shared_storage_worklet_host_manager.cc",
@ -2129,8 +2160,6 @@ source_set("browser") {
"synthetic_trial_syncer.cc",
"theme_helper.cc",
"theme_helper.h",
"tracing/background_startup_tracing_observer.cc",
"tracing/background_startup_tracing_observer.h",
"tracing/background_tracing_active_scenario.cc",
"tracing/background_tracing_active_scenario.h",
"tracing/background_tracing_agent_client_impl.cc",
@ -2222,6 +2251,8 @@ source_set("browser") {
"web_package/signed_exchange_error.h",
"web_package/signed_exchange_handler.cc",
"web_package/signed_exchange_handler.h",
"web_package/signed_exchange_inner_response_url_loader.cc",
"web_package/signed_exchange_inner_response_url_loader.h",
"web_package/signed_exchange_loader.cc",
"web_package/signed_exchange_loader.h",
"web_package/signed_exchange_prefetch_handler.cc",
@ -2238,13 +2269,13 @@ source_set("browser") {
"web_package/signed_exchange_signature_verifier.h",
"web_package/signed_exchange_utils.cc",
"web_package/signed_exchange_utils.h",
"web_package/subresource_signed_exchange_url_loader_factory.cc",
"web_package/subresource_signed_exchange_url_loader_factory.h",
"web_ui_browser_interface_broker_registry.cc",
"webauth/client_data_json.cc",
"webauth/client_data_json.h",
"webauth/webauth_request_security_checker.cc",
"webauth/webauth_request_security_checker.h",
"webid/digital_credentials/digital_identity_provider_utils.cc",
"webid/digital_credentials/digital_identity_provider_utils.h",
"webid/digital_credentials/digital_identity_request_impl.cc",
"webid/digital_credentials/digital_identity_request_impl.h",
"webid/fake_identity_request_dialog_controller.cc",
@ -2334,13 +2365,6 @@ source_set("browser") {
"worker_host/worker_script_loader_factory.h",
]
if (use_starscan) {
sources += [
"starscan_load_observer.cc",
"starscan_load_observer.h",
]
}
# TODO(crbug.com/40226169): Remove `permissions_common`.
# DO NOT add unrelated entries to this block.
deps += [ "//components/permissions:permissions_common" ]
@ -2376,6 +2400,8 @@ source_set("browser") {
"child_process_launcher_helper_linux.cc",
"child_thread_type_switcher_linux.cc",
"child_thread_type_switcher_linux.h",
"file_system_access/file_path_watcher/file_path_watcher_inotify.cc",
"file_system_access/file_path_watcher/file_path_watcher_inotify.h",
"font_access/font_enumeration_data_source_linux.cc",
"font_access/font_enumeration_data_source_linux.h",
"font_service.cc",
@ -2402,6 +2428,10 @@ source_set("browser") {
]
}
if (is_win) {
deps += [ "//components/services/font_data:lib" ]
}
if (allow_oop_video_decoder) {
sources += [ "media/stable_video_decoder_factory.cc" ]
deps += [ "//media/mojo/mojom/stable:stable_video_decoder" ]
@ -2417,8 +2447,6 @@ source_set("browser") {
"lock_screen/lock_screen_service_impl.h",
"lock_screen/lock_screen_storage_impl.cc",
"lock_screen/lock_screen_storage_impl.h",
"ml/ml_service_impl_cros.cc",
"ml/ml_service_impl_cros.h",
"smart_card/smart_card_service.cc",
"smart_card/smart_card_service.h",
]
@ -2491,6 +2519,8 @@ source_set("browser") {
"accessibility/browser_accessibility_manager_fuchsia.cc",
"accessibility/browser_accessibility_manager_fuchsia.h",
"child_process_launcher_helper_fuchsia.cc",
"file_system_access/file_path_watcher/file_path_watcher_stub.cc", # See
# crbug.com/42050618
"font_access/font_enumeration_data_source_fuchsia.cc",
"font_access/font_enumeration_data_source_fuchsia.h",
"memory/swap_metrics_driver_impl_fuchsia.cc",
@ -2574,6 +2604,11 @@ source_set("browser") {
"cocoa/system_hotkey_map.h",
"cocoa/system_hotkey_map.mm",
"devtools/protocol/native_input_event_builder_mac.mm",
"file_system_access/file_path_watcher/file_path_watcher_fsevents.cc",
"file_system_access/file_path_watcher/file_path_watcher_fsevents.h",
"file_system_access/file_path_watcher/file_path_watcher_kqueue.cc",
"file_system_access/file_path_watcher/file_path_watcher_kqueue.h",
"file_system_access/file_path_watcher/file_path_watcher_mac.cc",
"gpu/browser_child_process_backgrounded_bridge.h",
"gpu/browser_child_process_backgrounded_bridge.mm",
"gpu/ca_transaction_gpu_coordinator.cc",
@ -2630,6 +2665,7 @@ source_set("browser") {
"AppKit.framework",
"AVFAudio.framework",
"Carbon.framework",
"Cocoa.framework",
"CoreGraphics.framework",
"QuartzCore.framework",
"IOSurface.framework",
@ -2796,18 +2832,20 @@ source_set("browser") {
"device_posture/device_posture_platform_provider_win.h",
"device_posture/device_posture_registry_watcher_win.cc",
"device_posture/device_posture_registry_watcher_win.h",
"file_system_access/file_path_watcher/file_path_watcher_change_tracker.cc",
"file_system_access/file_path_watcher/file_path_watcher_change_tracker.h",
"file_system_access/file_path_watcher/file_path_watcher_win.cc",
"font_access/font_enumeration_data_source_win.cc",
"font_access/font_enumeration_data_source_win.h",
"installedapp/installed_app_provider_impl_win.cc",
"installedapp/installed_app_provider_impl_win.h",
"installedapp/fetch_related_win_apps_task.cc",
"installedapp/fetch_related_win_apps_task.h",
"installedapp/native_win_app_fetcher.h",
"installedapp/native_win_app_fetcher_impl.cc",
"installedapp/native_win_app_fetcher_impl.h",
"media/dcomp_surface_registry_broker.cc",
"media/dcomp_surface_registry_broker.h",
"media/key_system_support_win.cc",
"media/key_system_support_win.h",
"media/web_app_system_media_controls.cc",
"media/web_app_system_media_controls.h",
"media/web_app_system_media_controls_manager.cc",
"media/web_app_system_media_controls_manager.h",
"memory/swap_metrics_driver_impl_win.cc",
"network/network_service_process_tracker_win.cc",
"network/network_service_process_tracker_win.h",
@ -2825,6 +2863,8 @@ source_set("browser") {
"renderer_host/virtual_keyboard_controller_win.h",
"screenlock_monitor/screenlock_monitor_device_source_win.cc",
"speech/tts_win.cc",
"speech/tts_win_utils.cc",
"speech/tts_win_utils.h",
"utility_sandbox_delegate_win.cc",
]
deps += [
@ -2849,6 +2889,15 @@ source_set("browser") {
]
}
if (is_win || is_mac) {
sources += [
"media/web_app_system_media_controls.cc",
"media/web_app_system_media_controls.h",
"media/web_app_system_media_controls_manager.cc",
"media/web_app_system_media_controls_manager.h",
]
}
if (is_android || is_linux) {
deps += [ "//content/browser/system_dns_resolution" ]
}
@ -3066,10 +3115,6 @@ source_set("browser") {
"android/java/gin_java_bound_object_delegate.h",
"android/java/gin_java_bridge_dispatcher_host.cc",
"android/java/gin_java_bridge_dispatcher_host.h",
"android/java/gin_java_bridge_message_filter.cc",
"android/java/gin_java_bridge_message_filter.h",
"android/java/gin_java_bridge_object_deletion_message_filter.cc",
"android/java/gin_java_bridge_object_deletion_message_filter.h",
"android/java/gin_java_method_invocation_helper.cc",
"android/java/gin_java_method_invocation_helper.h",
"android/java/gin_java_script_to_java_types_coercion.cc",
@ -3159,6 +3204,8 @@ source_set("browser") {
"navigation_transitions/back_forward_transition_animator.h",
"navigation_transitions/physics_model.cc",
"navigation_transitions/physics_model.h",
"navigation_transitions/progress_bar.cc",
"navigation_transitions/progress_bar.h",
"renderer_host/compositor_dependencies_android.cc",
"renderer_host/compositor_dependencies_android.h",
"renderer_host/compositor_impl_android.cc",
@ -3195,16 +3242,15 @@ source_set("browser") {
"web_contents/web_contents_android.h",
"web_contents/web_contents_view_android.cc",
"web_contents/web_contents_view_android.h",
"webid/digital_credentials/digital_identity_provider_android.cc",
"webid/digital_credentials/digital_identity_provider_android.h",
]
deps += [
":fontations_name_table_ffi",
":reflection_jni_headers",
"//build/config/freetype",
"//cc/slim",
"//components/tracing:graphics_provider",
"//content/public/android:jni",
"//content/public/android:browser_jni",
"//device/gamepad/public/mojom",
"//gpu/command_buffer/service:gles2",
"//media",
@ -3245,6 +3291,11 @@ source_set("browser") {
"hid/hid_service.cc",
"hid/hid_service.h",
# These fetch web app tasks, used by getInstalledRelatedApps API, are not
# supported in Android.
"installedapp/fetch_related_web_apps_task.cc",
"installedapp/fetch_related_web_apps_task.h",
# Non-Android platforms that don't presently support
# enable_screen_capture, like Fuchsia, nevertheless compile
# these files. This follows the pattern of #ifdef-ing around Android
@ -3271,12 +3322,6 @@ source_set("browser") {
"service_worker/service_worker_usb_delegate_observer.h",
# Most speech code is non-Android.
"speech/endpointer/endpointer.cc",
"speech/endpointer/endpointer.h",
"speech/endpointer/energy_endpointer.cc",
"speech/endpointer/energy_endpointer.h",
"speech/endpointer/energy_endpointer_params.cc",
"speech/endpointer/energy_endpointer_params.h",
"speech/network_speech_recognition_engine_impl.cc",
"speech/network_speech_recognition_engine_impl.h",
"speech/speech_recognition_engine.cc",
@ -3317,6 +3362,8 @@ source_set("browser") {
"speech/soda_speech_recognition_engine_impl.cc",
"speech/soda_speech_recognition_engine_impl.h",
]
deps += [ "//media/mojo/mojom:web_speech_recognition" ]
}
deps += [

View file

@ -39,7 +39,7 @@ void TrackedSplitPreference::OnNewValue(
const base::Value* value,
PrefHashStoreTransaction* transaction) const {
if (value && !value->is_dict()) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return;
}
@ -85,7 +85,6 @@ bool TrackedSplitPreference::EnforceAndReport(
pref_path_, invalid_keys, external_validation_invalid_keys, value_state,
external_validation_value_state, helper_.IsPersonal());
}
TrackedPreferenceHelper::ResetAction reset_action =
helper_.GetAction(value_state);