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

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

Issue 287543002: Remove origin chip v1 and "hide on input" v2 behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 10 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return (input_in_progress() && !ignore_editing) ? 179 return (input_in_progress() && !ignore_editing) ?
180 NONE : GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); 180 NONE : GetSecurityLevelForWebContents(delegate_->GetActiveWebContents());
181 } 181 }
182 182
183 int ToolbarModelImpl::GetIcon() const { 183 int ToolbarModelImpl::GetIcon() const {
184 if (WouldPerformSearchTermReplacement(false)) { 184 if (WouldPerformSearchTermReplacement(false)) {
185 // The secured version of the search icon is necessary if neither the search 185 // The secured version of the search icon is necessary if neither the search
186 // button nor origin chip are present to indicate the security state. 186 // button nor origin chip are present to indicate the security state.
187 return (chrome::GetDisplaySearchButtonConditions() == 187 return (chrome::GetDisplaySearchButtonConditions() ==
188 chrome::DISPLAY_SEARCH_BUTTON_NEVER) && 188 chrome::DISPLAY_SEARCH_BUTTON_NEVER) &&
189 !chrome::ShouldDisplayOriginChipV2() ? 189 !chrome::ShouldDisplayOriginChip() ?
190 IDR_OMNIBOX_SEARCH_SECURED : IDR_OMNIBOX_SEARCH; 190 IDR_OMNIBOX_SEARCH_SECURED : IDR_OMNIBOX_SEARCH;
191 } 191 }
192 192
193 // When the original site chip experiment is running, the icon in the location
194 // bar, when not the search icon, should be the page icon.
195 if (chrome::ShouldDisplayOriginChip())
196 return GetIconForSecurityLevel(NONE);
197
198 return GetIconForSecurityLevel(GetSecurityLevel(false)); 193 return GetIconForSecurityLevel(GetSecurityLevel(false));
199 } 194 }
200 195
201 int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const { 196 int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const {
202 static int icon_ids[NUM_SECURITY_LEVELS] = { 197 static int icon_ids[NUM_SECURITY_LEVELS] = {
203 IDR_LOCATION_BAR_HTTP, 198 IDR_LOCATION_BAR_HTTP,
204 IDR_OMNIBOX_HTTPS_VALID, 199 IDR_OMNIBOX_HTTPS_VALID,
205 IDR_OMNIBOX_HTTPS_VALID, 200 IDR_OMNIBOX_HTTPS_VALID,
206 IDR_OMNIBOX_HTTPS_WARNING, 201 IDR_OMNIBOX_HTTPS_WARNING,
207 IDR_OMNIBOX_HTTPS_POLICY_WARNING, 202 IDR_OMNIBOX_HTTPS_POLICY_WARNING,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 273 }
279 } 274 }
280 275
281 if (!delegate_->InTabbedBrowser() || !ShouldDisplayURL() || 276 if (!delegate_->InTabbedBrowser() || !ShouldDisplayURL() ||
282 !url_replacement_enabled()) 277 !url_replacement_enabled())
283 return false; 278 return false;
284 279
285 if (chrome::ShouldDisplayOriginChip()) 280 if (chrome::ShouldDisplayOriginChip())
286 return true; 281 return true;
287 282
288 const chrome::OriginChipV2Condition chip_condition = 283 const chrome::OriginChipCondition chip_condition =
289 chrome::GetOriginChipV2Condition(); 284 chrome::GetOriginChipCondition();
290 return (chip_condition != chrome::ORIGIN_CHIP_V2_DISABLED) && 285 return (chip_condition == chrome::ORIGIN_CHIP_ALWAYS) ||
291 ((chip_condition != chrome::ORIGIN_CHIP_V2_ON_SRP) || 286 ((chip_condition == chrome::ORIGIN_CHIP_ON_SRP) &&
292 WouldPerformSearchTermReplacement(false)); 287 WouldPerformSearchTermReplacement(false));
293 } 288 }
294 289
295 NavigationController* ToolbarModelImpl::GetNavigationController() const { 290 NavigationController* ToolbarModelImpl::GetNavigationController() const {
296 // This |current_tab| can be NULL during the initialization of the 291 // This |current_tab| can be NULL during the initialization of the
297 // toolbar during window creation (i.e. before any tabs have been added 292 // toolbar during window creation (i.e. before any tabs have been added
298 // to the window). 293 // to the window).
299 WebContents* current_tab = delegate_->GetActiveWebContents(); 294 WebContents* current_tab = delegate_->GetActiveWebContents();
300 return current_tab ? &current_tab->GetController() : NULL; 295 return current_tab ? &current_tab->GetController() : NULL;
301 } 296 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (entry && 330 if (entry &&
336 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL())) 331 google_util::StartsWithCommandLineGoogleBaseURL(entry->GetVirtualURL()))
337 return search_terms; 332 return search_terms;
338 333
339 // Otherwise, extract search terms for HTTPS pages that do not have a security 334 // Otherwise, extract search terms for HTTPS pages that do not have a security
340 // error. 335 // error.
341 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); 336 ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing);
342 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? 337 return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ?
343 base::string16() : search_terms; 338 base::string16() : search_terms;
344 } 339 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_model.cc ('k') | chrome/browser/ui/toolbar/toolbar_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698