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

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

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 search_engine_urls_.end()) { 183 search_engine_urls_.end()) {
184 // The search engine is not in our white-list, bail. 184 // The search engine is not in our white-list, bail.
185 return; 185 return;
186 } 186 }
187 const TemplateURL* const default_provider = 187 const TemplateURL* const default_provider =
188 TemplateURLServiceFactory::GetForProfile(tab_->profile())-> 188 TemplateURLServiceFactory::GetForProfile(tab_->profile())->
189 GetDefaultSearchProvider(); 189 GetDefaultSearchProvider();
190 if (!default_provider) 190 if (!default_provider)
191 return; 191 return;
192 192
193 if (default_provider->url()->GetHost() == entry->GetURL().host()) 193 if (default_provider->url_ref().GetHost() == entry->GetURL().host())
194 ShowInfoBar(); 194 ShowInfoBar();
195 } else if (type == chrome::NOTIFICATION_OMNIBOX_OPENED_URL) { 195 } else if (type == chrome::NOTIFICATION_OMNIBOX_OPENED_URL) {
196 AutocompleteLog* log = content::Details<AutocompleteLog>(details).ptr(); 196 AutocompleteLog* log = content::Details<AutocompleteLog>(details).ptr();
197 AutocompleteMatch::Type type = 197 AutocompleteMatch::Type type =
198 log->result.match_at(log->selected_index).type; 198 log->result.match_at(log->selected_index).type;
199 if (type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || 199 if (type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED ||
200 type == AutocompleteMatch::SEARCH_HISTORY || 200 type == AutocompleteMatch::SEARCH_HISTORY ||
201 type == AutocompleteMatch::SEARCH_SUGGEST) { 201 type == AutocompleteMatch::SEARCH_SUGGEST) {
202 // The user performed a search from the omnibox, don't show the infobar 202 // The user performed a search from the omnibox, don't show the infobar
203 // again. 203 // again.
(...skipping 29 matching lines...) Expand all
233 } 233 }
234 234
235 // static 235 // static
236 bool OmniboxSearchHint::IsEnabled(Profile* profile) { 236 bool OmniboxSearchHint::IsEnabled(Profile* profile) {
237 // The infobar can only be shown if the correct switch has been provided and 237 // The infobar can only be shown if the correct switch has been provided and
238 // the user did not dismiss the infobar before. 238 // the user did not dismiss the infobar before.
239 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && 239 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) &&
240 CommandLine::ForCurrentProcess()->HasSwitch( 240 CommandLine::ForCurrentProcess()->HasSwitch(
241 switches::kSearchInOmniboxHint); 241 switches::kSearchInOmniboxHint);
242 } 242 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_loader.cc ('k') | chrome/browser/policy/configuration_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698