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

Side by Side Diff: ios/chrome/browser/ui/omnibox/location_bar_view_ios.mm

Issue 2692173002: Update the Bling omnibox to be aware of HTTP_SHOW_WARNING and use ShouldAlwaysShowIcon(). (Closed)
Patch Set: Update the Bling omnibox to be aware of HTTP_SHOW_WARNING and use ShouldAlwaysShowIcon(). Created 3 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 (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 #import <UIKit/UIKit.h> 5 #import <UIKit/UIKit.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "components/omnibox/browser/omnibox_edit_model.h" 11 #include "components/omnibox/browser/omnibox_edit_model.h"
12 #include "components/security_state/core/security_state_ui.h"
12 #include "components/strings/grit/components_strings.h" 13 #include "components/strings/grit/components_strings.h"
13 #include "components/toolbar/toolbar_model.h" 14 #include "components/toolbar/toolbar_model.h"
14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
15 #include "ios/chrome/browser/chrome_url_constants.h" 16 #include "ios/chrome/browser/chrome_url_constants.h"
16 #include "ios/chrome/browser/experimental_flags.h" 17 #include "ios/chrome/browser/experimental_flags.h"
17 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" 18 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
18 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 19 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
19 #include "ios/chrome/browser/ui/omnibox/location_bar_view_ios.h" 20 #include "ios/chrome/browser/ui/omnibox/location_bar_view_ios.h"
20 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" 21 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h"
21 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" 22 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void LocationBarViewIOS::OnChanged() { 163 void LocationBarViewIOS::OnChanged() {
163 const bool page_is_offline = IsCurrentPageOffline(GetWebState()); 164 const bool page_is_offline = IsCurrentPageOffline(GetWebState());
164 const int resource_id = edit_view_->GetIcon(page_is_offline); 165 const int resource_id = edit_view_->GetIcon(page_is_offline);
165 [field_ setPlaceholderImage:resource_id]; 166 [field_ setPlaceholderImage:resource_id];
166 167
167 // TODO(rohitrao): Can we get focus information from somewhere other than the 168 // TODO(rohitrao): Can we get focus information from somewhere other than the
168 // model? 169 // model?
169 if (!IsIPadIdiom() && !edit_view_->model()->has_focus()) { 170 if (!IsIPadIdiom() && !edit_view_->model()->has_focus()) {
170 ToolbarModel* toolbarModel = [delegate_ toolbarModel]; 171 ToolbarModel* toolbarModel = [delegate_ toolbarModel];
171 if (toolbarModel) { 172 if (toolbarModel) {
172 bool page_is_secure = 173 bool show_icon_for_state = security_state::ShouldAlwaysShowIcon(
173 toolbarModel->GetSecurityLevel(false) != security_state::NONE; 174 toolbarModel->GetSecurityLevel(false));
174 bool page_has_downgraded_HTTPS = 175 bool page_has_downgraded_HTTPS =
175 experimental_flags::IsPageIconForDowngradedHTTPSEnabled() && 176 experimental_flags::IsPageIconForDowngradedHTTPSEnabled() &&
176 DoesCurrentPageHaveCertInfo(GetWebState()); 177 DoesCurrentPageHaveCertInfo(GetWebState());
177 if (page_is_secure || page_has_downgraded_HTTPS || page_is_offline) { 178 if (show_icon_for_state || page_has_downgraded_HTTPS || page_is_offline) {
178 [field_ showPlaceholderImage]; 179 [field_ showPlaceholderImage];
179 is_showing_placeholder_while_collapsed_ = true; 180 is_showing_placeholder_while_collapsed_ = true;
180 } else { 181 } else {
181 [field_ hidePlaceholderImage]; 182 [field_ hidePlaceholderImage];
182 is_showing_placeholder_while_collapsed_ = false; 183 is_showing_placeholder_while_collapsed_ = false;
183 } 184 }
184 } 185 }
185 } 186 }
186 UpdateRightDecorations(); 187 UpdateRightDecorations();
187 [delegate_ locationBarChanged]; 188 [delegate_ locationBarChanged];
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (IsIPadIdiom()) 320 if (IsIPadIdiom())
320 [field_ setRightView:nil]; 321 [field_ setRightView:nil];
321 } else if ([field_ displayedText].empty() && 322 } else if ([field_ displayedText].empty() &&
322 ![field_ isShowingQueryRefinementChip]) { 323 ![field_ isShowingQueryRefinementChip]) {
323 [field_ setRightView:nil]; 324 [field_ setRightView:nil];
324 } else { 325 } else {
325 [field_ setRightView:clear_text_button_]; 326 [field_ setRightView:clear_text_button_];
326 [clear_text_button_ setAlpha:1]; 327 [clear_text_button_ setAlpha:1];
327 } 328 }
328 } 329 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox/BUILD.gn ('k') | ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698