| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/win/metro.h" | 8 #include "base/win/metro.h" |
| 9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
| 10 #include "chrome/browser/search_engines/template_url_service.h" | 10 #include "chrome/browser/search_engines/template_url_service.h" |
| 11 #include "chrome/browser/search_engines/template_url_service_factory.h" | 11 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 14 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "win8/util/win8_util.h" |
| 16 | 17 |
| 17 namespace chrome { | 18 namespace chrome { |
| 18 | 19 |
| 19 GURL GetURLToOpen(Profile* profile) { | 20 GURL GetURLToOpen(Profile* profile) { |
| 20 string16 params; | 21 string16 params; |
| 21 base::win::MetroLaunchType launch_type = | 22 base::win::MetroLaunchType launch_type = |
| 22 base::win::GetMetroLaunchParams(¶ms); | 23 base::win::GetMetroLaunchParams(¶ms); |
| 23 | 24 |
| 24 if ((launch_type == base::win::METRO_PROTOCOL) || | 25 if ((launch_type == base::win::METRO_PROTOCOL) || |
| 25 (launch_type == base::win::METRO_LAUNCH)) { | 26 (launch_type == base::win::METRO_LAUNCH)) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 return GURL(); | 39 return GURL(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace chrome | 42 } // namespace chrome |
| 42 | 43 |
| 43 #if !defined(USE_AURA) | 44 #if !defined(USE_AURA) |
| 44 // static | 45 // static |
| 45 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( | 46 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( |
| 46 Profile* profile, | 47 Profile* profile, |
| 47 const std::vector<GURL>& startup_urls) { | 48 const std::vector<GURL>& startup_urls) { |
| 48 if (!base::win::IsMetroProcess()) | 49 if (!win8::IsSingleWindowMetroMode()) |
| 49 return false; | 50 return false; |
| 50 | 51 |
| 51 // We activate an existing browser window if we are opening just the new tab | 52 // We activate an existing browser window if we are opening just the new tab |
| 52 // page in metro mode. | 53 // page in metro mode. |
| 53 if (startup_urls.size() > 1) | 54 if (startup_urls.size() > 1) |
| 54 return false; | 55 return false; |
| 55 | 56 |
| 56 if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL)) | 57 if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL)) |
| 57 return false; | 58 return false; |
| 58 | 59 |
| 59 Browser* browser = browser::FindBrowserWithProfile( | 60 Browser* browser = browser::FindBrowserWithProfile( |
| 60 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 61 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 61 | 62 |
| 62 if (!browser) | 63 if (!browser) |
| 63 return false; | 64 return false; |
| 64 | 65 |
| 65 browser->window()->Show(); | 66 browser->window()->Show(); |
| 66 return true; | 67 return true; |
| 67 } | 68 } |
| 68 #endif | 69 #endif |
| 69 | |
| OLD | NEW |