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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 749693005: Remove SearchButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-origin-2
Patch Set: Merge to HEAD Created 5 years, 10 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
OLDNEW
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/ui/toolbar/toolbar_model_impl.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 250 }
251 251
252 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( 252 ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel(
253 bool ignore_editing) const { 253 bool ignore_editing) const {
254 // When editing, assume no security style. 254 // When editing, assume no security style.
255 return (input_in_progress() && !ignore_editing) ? 255 return (input_in_progress() && !ignore_editing) ?
256 NONE : GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); 256 NONE : GetSecurityLevelForWebContents(delegate_->GetActiveWebContents());
257 } 257 }
258 258
259 int ToolbarModelImpl::GetIcon() const { 259 int ToolbarModelImpl::GetIcon() const {
260 if (WouldPerformSearchTermReplacement(false)) { 260 if (WouldPerformSearchTermReplacement(false))
261 // The secured version of the search icon is necessary if the search button 261 return IDR_OMNIBOX_SEARCH_SECURED;
262 // is not present to indicate the security state.
263 return (chrome::GetDisplaySearchButtonConditions() ==
264 chrome::DISPLAY_SEARCH_BUTTON_NEVER) ?
265 IDR_OMNIBOX_SEARCH_SECURED : IDR_OMNIBOX_SEARCH;
266 }
267 262
268 return GetIconForSecurityLevel(GetSecurityLevel(false)); 263 return GetIconForSecurityLevel(GetSecurityLevel(false));
269 } 264 }
270 265
271 int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const { 266 int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const {
272 static int icon_ids[NUM_SECURITY_LEVELS] = { 267 static int icon_ids[NUM_SECURITY_LEVELS] = {
273 IDR_LOCATION_BAR_HTTP, 268 IDR_LOCATION_BAR_HTTP,
274 IDR_OMNIBOX_HTTPS_VALID, 269 IDR_OMNIBOX_HTTPS_VALID,
275 IDR_OMNIBOX_HTTPS_VALID, 270 IDR_OMNIBOX_HTTPS_VALID,
276 IDR_OMNIBOX_HTTPS_WARNING, 271 IDR_OMNIBOX_HTTPS_WARNING,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (entry && 367 if (entry &&
373 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) 368 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL()))
374 return search_terms; 369 return search_terms;
375 370
376 // Otherwise, extract search terms for HTTPS pages that do not have a security 371 // Otherwise, extract search terms for HTTPS pages that do not have a security
377 // error. 372 // error.
378 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); 373 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing);
379 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? 374 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ?
380 base::string16() : search_terms; 375 base::string16() : search_terms;
381 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698