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

Unified Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 10544021: Disable the new window context menu option in the bookmarks extension for Windows 8 metro mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
Index: chrome/browser/extensions/extension_tabs_module.cc
===================================================================
--- chrome/browser/extensions/extension_tabs_module.cc (revision 140583)
+++ chrome/browser/extensions/extension_tabs_module.cc (working copy)
@@ -77,6 +77,10 @@
#include "chrome/browser/ui/views/ash/panel_view_aura.h"
#endif
+#if defined(OS_WIN)
+#include "base/win/metro.h"
+#endif // OS_WIN
+
namespace Get = extensions::api::windows::Get;
namespace GetAll = extensions::api::windows::GetAll;
namespace GetCurrent = extensions::api::windows::GetCurrent;
@@ -215,6 +219,27 @@
return NOT_SET;
}
+Browser* CreateBrowserWindow(const Browser::CreateParams& params,
+ Profile* profile,
+ const std::string& extension_id) {
+ bool use_existing_browser_window = false;
+
+#if defined(OS_WIN)
+ // In Windows 8 metro mode we only allow new windows to be created if the
+ // extension id is valid in which case it is created as an application window
+ if (extension_id.empty() && base::win::GetMetroModule())
+ use_existing_browser_window = true;
+#endif // OS_WIN
+
+ Browser* new_window = NULL;
+ if (use_existing_browser_window)
+ new_window = browser::FindTabbedBrowser(profile, false);
Aaron Boodman 2012/06/06 01:46:26 Document the magic boolean or make it a named cons
ananta 2012/06/06 01:52:22 Done.
+
+ if (!new_window)
+ Browser* new_window = Browser::CreateWithParams(params);
+ return new_window;
+}
+
} // namespace
// Windows ---------------------------------------------------------------------
@@ -585,8 +610,10 @@
window_profile);
}
create_params.initial_show_state = ui::SHOW_STATE_NORMAL;
- Browser* new_window = Browser::CreateWithParams(create_params);
+ Browser* new_window = CreateBrowserWindow(create_params, window_profile,
+ extension_id);
+
for (std::vector<GURL>::iterator i = urls.begin(); i != urls.end(); ++i) {
TabContentsWrapper* tab = new_window->AddSelectedTabWithURL(
*i, content::PAGE_TRANSITION_LINK);

Powered by Google App Engine
This is Rietveld 408576698