OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" | 5 #include "chrome/browser/metro_viewer/chrome_metro_viewer_process_host_aurawin.h
" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_process_platform_part_aurawin.h" | 10 #include "chrome/browser/browser_process_platform_part_aurawin.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/search_engines/template_url.h" | 12 #include "chrome/browser/search_engines/util.h" |
13 #include "chrome/browser/search_engines/template_url_service.h" | |
14 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
15 #include "chrome/browser/ui/ash/ash_init.h" | 13 #include "chrome/browser/ui/ash/ash_init.h" |
16 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
18 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
20 #include "chrome/browser/ui/host_desktop.h" | 18 #include "chrome/browser/ui/host_desktop.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
23 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 content::NotificationService::AllSources(), | 96 content::NotificationService::AllSources(), |
99 content::NotificationService::NoDetails()); | 97 content::NotificationService::NoDetails()); |
100 } | 98 } |
101 | 99 |
102 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { | 100 void ChromeMetroViewerProcessHost::OnOpenURL(const string16& url) { |
103 OpenURL(GURL(url)); | 101 OpenURL(GURL(url)); |
104 } | 102 } |
105 | 103 |
106 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( | 104 void ChromeMetroViewerProcessHost::OnHandleSearchRequest( |
107 const string16& search_string) { | 105 const string16& search_string) { |
108 const TemplateURL* default_provider = | 106 GURL url(GetDefaultSearchURLForSearchTerms( |
109 TemplateURLServiceFactory::GetForProfile( | 107 ProfileManager::GetDefaultProfileOrOffTheRecord(), search_string)); |
110 ProfileManager::GetDefaultProfileOrOffTheRecord())-> | 108 if (url.is_valid()) |
111 GetDefaultSearchProvider(); | 109 OpenURL(url); |
112 if (default_provider) { | |
113 const TemplateURLRef& search_url = default_provider->url_ref(); | |
114 DCHECK(search_url.SupportsReplacement()); | |
115 GURL request_url = GURL(search_url.ReplaceSearchTerms( | |
116 TemplateURLRef::SearchTermsArgs(search_string))); | |
117 OpenURL(request_url); | |
118 } | |
119 } | 110 } |
OLD | NEW |