Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1089)

Unified Diff: chrome/browser/ui/views/frame/system_menu_model_builder.cc

Issue 1109393011: Pull back windows to the original user desktop when clicking on the correspond window list bubble i… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address pkasting@'s comment. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0e5d48fb30939ff9f0b6900653728431ef8f3462 100644
--- a/chrome/browser/ui/views/frame/system_menu_model_builder.cc
+++ b/chrome/browser/ui/views/frame/system_menu_model_builder.cc
@@ -9,8 +9,10 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/wrench_menu_model.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/models/simple_menu_model.h"
@@ -25,6 +27,24 @@
#include "ui/base/l10n/l10n_util.h"
#endif
+namespace {
+
+// Given a |browser| that's an app or popup window, checks if it's hosting the
+// settings page.
+bool IsChromeSettingsAppOrPopupWindow(Browser* browser) {
+ DCHECK(browser);
+ TabStripModel* tab_strip = browser->tab_strip_model();
+ DCHECK_EQ(1, tab_strip->count());
+ const GURL gurl(tab_strip->GetWebContentsAt(0)->GetURL());
+ if (gurl.SchemeIs(content::kChromeUIScheme) &&
+ gurl.host().find(chrome::kChromeUISettingsHost) != std::string::npos) {
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
SystemMenuModelBuilder::SystemMenuModelBuilder(
ui::AcceleratorProvider* provider,
Browser* browser)
@@ -108,7 +128,13 @@ void SystemMenuModelBuilder::BuildSystemMenuForAppOrPopupWindow(
model->AddItemWithStringId(IDC_CLOSE_WINDOW, IDS_CLOSE);
#endif
- AppendTeleportMenu(model);
+ // Avoid appending the teleport menu for the settings window. This window's
+ // presentation is unique: it's a normal browser window with an app-like
+ // frame, which doesn't have a user icon badge. Thus if teleported it's not
+ // clear what user it applies to. Rather than bother to implement badging just
+ // for this rare case, simply prevent the user from teleporting the window.
+ if (!IsChromeSettingsAppOrPopupWindow(browser()))
+ AppendTeleportMenu(model);
}
void SystemMenuModelBuilder::AddFrameToggleItems(ui::SimpleMenuModel* model) {
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698