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

Side by Side Diff: chrome/browser/omnibox_search_hint.cc

Issue 8956059: Rename NavigationController to NavigationControllerImpl and put it into the content namespace. Al... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 12 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/memory_details.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/omnibox_search_hint.h" 5 #include "chrome/browser/omnibox_search_hint.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 21 matching lines...) Expand all
32 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/navigation_entry.h" 33 #include "content/public/browser/navigation_entry.h"
34 #include "content/public/browser/notification_details.h" 34 #include "content/public/browser/notification_details.h"
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
37 #include "grit/generated_resources.h" 37 #include "grit/generated_resources.h"
38 #include "grit/theme_resources_standard.h" 38 #include "grit/theme_resources_standard.h"
39 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
40 #include "ui/base/resource/resource_bundle.h" 40 #include "ui/base/resource/resource_bundle.h"
41 41
42 using content::NavigationEntry;
43
42 // The URLs of search engines for which we want to trigger the infobar. 44 // The URLs of search engines for which we want to trigger the infobar.
43 const char* const kSearchEngineURLs[] = { 45 const char* const kSearchEngineURLs[] = {
44 "http://www.google.com/", 46 "http://www.google.com/",
45 "http://www.yahoo.com/", 47 "http://www.yahoo.com/",
46 "http://www.bing.com/", 48 "http://www.bing.com/",
47 "http://www.altavista.com/", 49 "http://www.altavista.com/",
48 "http://www.ask.com/", 50 "http://www.ask.com/",
49 "http://www.wolframalpha.com/", 51 "http://www.wolframalpha.com/",
50 }; 52 };
51 53
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 content::Source<Profile>(tab->profile())); 170 content::Source<Profile>(tab->profile()));
169 } 171 }
170 172
171 OmniboxSearchHint::~OmniboxSearchHint() { 173 OmniboxSearchHint::~OmniboxSearchHint() {
172 } 174 }
173 175
174 void OmniboxSearchHint::Observe(int type, 176 void OmniboxSearchHint::Observe(int type,
175 const content::NotificationSource& source, 177 const content::NotificationSource& source,
176 const content::NotificationDetails& details) { 178 const content::NotificationDetails& details) {
177 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 179 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
178 content::NavigationEntry* entry = 180 NavigationEntry* entry =
179 tab_->tab_contents()->GetController().GetActiveEntry(); 181 tab_->tab_contents()->GetController().GetActiveEntry();
180 if (search_engine_urls_.find(entry->GetURL().spec()) == 182 if (search_engine_urls_.find(entry->GetURL().spec()) ==
181 search_engine_urls_.end()) { 183 search_engine_urls_.end()) {
182 // The search engine is not in our white-list, bail. 184 // The search engine is not in our white-list, bail.
183 return; 185 return;
184 } 186 }
185 const TemplateURL* const default_provider = 187 const TemplateURL* const default_provider =
186 TemplateURLServiceFactory::GetForProfile(tab_->profile())-> 188 TemplateURLServiceFactory::GetForProfile(tab_->profile())->
187 GetDefaultSearchProvider(); 189 GetDefaultSearchProvider();
188 if (!default_provider) 190 if (!default_provider)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 234 }
233 235
234 // static 236 // static
235 bool OmniboxSearchHint::IsEnabled(Profile* profile) { 237 bool OmniboxSearchHint::IsEnabled(Profile* profile) {
236 // The infobar can only be shown if the correct switch has been provided and 238 // The infobar can only be shown if the correct switch has been provided and
237 // the user did not dismiss the infobar before. 239 // the user did not dismiss the infobar before.
238 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && 240 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) &&
239 CommandLine::ForCurrentProcess()->HasSwitch( 241 CommandLine::ForCurrentProcess()->HasSwitch(
240 switches::kSearchInOmniboxHint); 242 switches::kSearchInOmniboxHint);
241 } 243 }
OLDNEW
« no previous file with comments | « chrome/browser/memory_details.cc ('k') | chrome/browser/printing/print_dialog_cloud.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698