Chromium Code Reviews| 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); |