Chromium Code Reviews| Index: chrome/browser/ui/views/frame/system_menu_model_builder.cc |
| diff --git a/chrome/browser/ui/views/frame/system_menu_model_builder.cc b/chrome/browser/ui/views/frame/system_menu_model_builder.cc |
| index e877f978abed33e58fd8ba5a01dc8e57f4dec52a..ee418b7721d05dfe3262339bb71665779c04d75e 100644 |
| --- a/chrome/browser/ui/views/frame/system_menu_model_builder.cc |
| +++ b/chrome/browser/ui/views/frame/system_menu_model_builder.cc |
| @@ -21,10 +21,36 @@ |
| #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| #include "chrome/browser/ui/browser_window.h" |
| +#include "chrome/browser/ui/tabs/tab_strip_model.h" |
| +#include "chrome/common/url_constants.h" |
| #include "components/user_manager/user_info.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #endif |
| +namespace { |
| + |
| +// Check if the current browser window contains chrome://settings page or |
| +// subpages. |
|
Mr4D (OOO till 08-26)
2015/05/03 19:53:45
If not mistaken, we stated in the issue that we on
xdai1
2015/05/04 16:54:56
This function is only called by SystemMenuModelBui
Mr4D (OOO till 08-26)
2015/05/04 17:07:41
Right - but it has an impact on tabbed browser win
|
| +bool IsChromeSettingsWindow(Browser* browser) { |
| + const base::string16 kChromeSetting = |
| + base::ASCIIToUTF16(content::kChromeUIScheme) + |
| + base::ASCIIToUTF16(url::kStandardSchemeSeparator) + |
| + base::ASCIIToUTF16(chrome::kChromeUISettingsHost); |
| + |
| + if (browser) { |
| + TabStripModel* tab_strip = browser->tab_strip_model(); |
| + for (int i = 0; i < tab_strip->count(); i++) { |
| + const base::string16 gurl_spec = base::UTF8ToUTF16( |
| + browser->tab_strip_model()->GetWebContentsAt(i)->GetURL().spec()); |
| + if (gurl_spec.find(kChromeSetting) != base::string16::npos) |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +} // namespace |
| + |
| SystemMenuModelBuilder::SystemMenuModelBuilder( |
| ui::AcceleratorProvider* provider, |
| Browser* browser) |
| @@ -108,7 +134,9 @@ void SystemMenuModelBuilder::BuildSystemMenuForAppOrPopupWindow( |
| model->AddItemWithStringId(IDC_CLOSE_WINDOW, IDS_CLOSE); |
| #endif |
| - AppendTeleportMenu(model); |
| + // We don't append teleport menu for Chrome Settings window. |
| + if (!IsChromeSettingsWindow(browser())) |
| + AppendTeleportMenu(model); |
| } |
| void SystemMenuModelBuilder::AddFrameToggleItems(ui::SimpleMenuModel* model) { |