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

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

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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
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/util.h"
10 #include "chrome/browser/search_engines/template_url_service.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/browser/ui/browser_finder.h" 10 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" 12 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
15 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
16 #include "win8/util/win8_util.h" 14 #include "win8/util/win8_util.h"
17 15
18 namespace chrome { 16 namespace chrome {
19 17
20 GURL GetURLToOpen(Profile* profile) { 18 GURL GetURLToOpen(Profile* profile) {
21 string16 params; 19 string16 params;
22 base::win::MetroLaunchType launch_type = 20 base::win::MetroLaunchType launch_type =
23 base::win::GetMetroLaunchParams(&params); 21 base::win::GetMetroLaunchParams(&params);
24 22
25 if ((launch_type == base::win::METRO_PROTOCOL) || 23 if ((launch_type == base::win::METRO_PROTOCOL) ||
26 (launch_type == base::win::METRO_LAUNCH)) { 24 (launch_type == base::win::METRO_LAUNCH))
27 return GURL(params); 25 return GURL(params);
28 } else if (launch_type == base::win::METRO_SEARCH) { 26 return (launch_type == base::win::METRO_SEARCH) ?
29 const TemplateURL* default_provider = 27 GetDefaultSearchURLForSearchTerms(profile, params) : GURL();
30 TemplateURLServiceFactory::GetForProfile(profile)->
31 GetDefaultSearchProvider();
32 if (default_provider) {
33 const TemplateURLRef& search_url = default_provider->url_ref();
34 DCHECK(search_url.SupportsReplacement());
35 return GURL(search_url.ReplaceSearchTerms(
36 TemplateURLRef::SearchTermsArgs(params)));
37 }
38 }
39 return GURL();
40 } 28 }
41 29
42 } // namespace chrome 30 } // namespace chrome
43 31
44 // static 32 // static
45 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( 33 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser(
46 Profile* profile, 34 Profile* profile,
47 const std::vector<GURL>& startup_urls) { 35 const std::vector<GURL>& startup_urls) {
48 if (!win8::IsSingleWindowMetroMode()) 36 if (!win8::IsSingleWindowMetroMode())
49 return false; 37 return false;
50 38
51 // We activate an existing browser window if we are opening just the new tab 39 // We activate an existing browser window if we are opening just the new tab
52 // page in metro mode. 40 // page in metro mode.
53 if (startup_urls.size() > 1) 41 if (startup_urls.size() > 1)
54 return false; 42 return false;
55 43
56 if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL)) 44 if (startup_urls[0] != GURL(chrome::kChromeUINewTabURL))
57 return false; 45 return false;
58 46
59 Browser* browser = chrome::FindBrowserWithProfile( 47 Browser* browser = chrome::FindBrowserWithProfile(
60 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 48 profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
61 49
62 if (!browser) 50 if (!browser)
63 return false; 51 return false;
64 52
65 browser->window()->Show(); 53 browser->window()->Show();
66 return true; 54 return true;
67 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/browser/ui/toolbar/toolbar_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698