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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_win.cc

Issue 11195050: Merge 162279 - If chrome in desktop mode on Windows 8 defers to Windows 8 metro chrome, then we onl… (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
13 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
15 #include "chrome/common/url_constants.h"
12 16
13 namespace chrome { 17 namespace chrome {
14 18
15 GURL GetURLToOpen(Profile* profile) { 19 GURL GetURLToOpen(Profile* profile) {
16 string16 params; 20 string16 params;
17 base::win::MetroLaunchType launch_type = 21 base::win::MetroLaunchType launch_type =
18 base::win::GetMetroLaunchParams(&params); 22 base::win::GetMetroLaunchParams(&params);
19 23
20 if ((launch_type == base::win::METRO_PROTOCOL) || 24 if ((launch_type == base::win::METRO_PROTOCOL) ||
21 (launch_type == base::win::METRO_LAUNCH)) { 25 (launch_type == base::win::METRO_LAUNCH)) {
22 return GURL(params); 26 return GURL(params);
23 } else if (launch_type == base::win::METRO_SEARCH) { 27 } else if (launch_type == base::win::METRO_SEARCH) {
24 const TemplateURL* default_provider = 28 const TemplateURL* default_provider =
25 TemplateURLServiceFactory::GetForProfile(profile)-> 29 TemplateURLServiceFactory::GetForProfile(profile)->
26 GetDefaultSearchProvider(); 30 GetDefaultSearchProvider();
27 if (default_provider) { 31 if (default_provider) {
28 const TemplateURLRef& search_url = default_provider->url_ref(); 32 const TemplateURLRef& search_url = default_provider->url_ref();
29 DCHECK(search_url.SupportsReplacement()); 33 DCHECK(search_url.SupportsReplacement());
30 return GURL(search_url.ReplaceSearchTerms( 34 return GURL(search_url.ReplaceSearchTerms(
31 TemplateURLRef::SearchTermsArgs(params))); 35 TemplateURLRef::SearchTermsArgs(params)));
32 } 36 }
33 } 37 }
34 return GURL(); 38 return GURL();
35 } 39 }
36 40
37 } // namespace chrome 41 } // namespace chrome
42
43 #if !defined(USE_AURA)
44 // static
45 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
46 Profile* profile,
47 const std::vector<GURL>& startup_urls) {
48 if (!base::win::IsMetroProcess())
49 return false;
50
51 // We activate an existing browser window if we are opening just the new tab
52 // page in metro mode.
53 if (startup_urls.size() > 1)
54 return false;
55
56 if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL))
57 return false;
58
59 Browser* browser = browser::FindBrowserWithProfile(
60 profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
61
62 if (!browser)
63 return false;
64
65 browser->window()->Show();
66 return true;
67 }
68 #endif
69
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698