| OLD | NEW |
| 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 "ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h" | 5 #include "ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "components/omnibox/browser/omnibox_edit_model.h" | 14 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 15 #include "components/security_state/core/security_state_ui.h" | 15 #include "components/security_state/core/security_state_ui.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "components/toolbar/toolbar_model.h" | 17 #include "components/toolbar/toolbar_model.h" |
| 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 19 #include "ios/chrome/browser/chrome_url_constants.h" | 19 #include "ios/chrome/browser/chrome_url_constants.h" |
| 20 #include "ios/chrome/browser/experimental_flags.h" | 20 #include "ios/chrome/browser/experimental_flags.h" |
| 21 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 21 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 22 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 22 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 23 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" | 23 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" |
| 24 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" | 24 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" |
| 25 #include "ios/chrome/browser/ui/ui_util.h" | 25 #include "ios/chrome/browser/ui/ui_util.h" |
| 26 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 26 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 27 #include "ios/chrome/grit/ios_strings.h" | 27 #include "ios/chrome/grit/ios_strings.h" |
| 28 #include "ios/chrome/grit/ios_theme_resources.h" | 28 #include "ios/chrome/grit/ios_theme_resources.h" |
| 29 #include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" | 29 #include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" |
| 30 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" | 30 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 31 #include "ios/web/public/navigation_item.h" | 31 #include "ios/web/public/navigation_item.h" |
| 32 #include "ios/web/public/navigation_manager.h" | 32 #include "ios/web/public/navigation_manager.h" |
| 33 #include "ios/web/public/ssl_status.h" | 33 #include "ios/web/public/ssl_status.h" |
| 34 #include "ios/web/public/web_state/web_state.h" | 34 #include "ios/web/public/web_state/web_state.h" |
| 35 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 36 | 36 |
| 37 #if !defined(__has_feature) || !__has_feature(objc_arc) | 37 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 38 #error "This file requires ARC support." | 38 #error "This file requires ARC support." |
| 39 #endif | 39 #endif |
| 40 | 40 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 forControlEvents:UIControlEventTouchUpInside]; | 275 forControlEvents:UIControlEventTouchUpInside]; |
| 276 [button setTag:IDC_SHOW_PAGE_INFO]; | 276 [button setTag:IDC_SHOW_PAGE_INFO]; |
| 277 SetA11yLabelAndUiAutomationName( | 277 SetA11yLabelAndUiAutomationName( |
| 278 button, IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL, | 278 button, IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL, |
| 279 @"Page Security Info"); | 279 @"Page Security Info"); |
| 280 [button setIsAccessibilityElement:YES]; | 280 [button setIsAccessibilityElement:YES]; |
| 281 | 281 |
| 282 // Set chip text options. | 282 // Set chip text options. |
| 283 [button setTitleColor:[UIColor colorWithWhite:0.631 alpha:1] | 283 [button setTitleColor:[UIColor colorWithWhite:0.631 alpha:1] |
| 284 forState:UIControlStateNormal]; | 284 forState:UIControlStateNormal]; |
| 285 [button titleLabel].font = | 285 [button titleLabel].font = [MDCTypography captionFont]; |
| 286 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; | |
| 287 [field_ setLeftView:button]; | 286 [field_ setLeftView:button]; |
| 288 | 287 |
| 289 // The placeholder image is only shown when in edit mode on iPhone, and always | 288 // The placeholder image is only shown when in edit mode on iPhone, and always |
| 290 // shown on iPad. | 289 // shown on iPad. |
| 291 if (IsIPadIdiom()) | 290 if (IsIPadIdiom()) |
| 292 [field_ setLeftViewMode:UITextFieldViewModeAlways]; | 291 [field_ setLeftViewMode:UITextFieldViewModeAlways]; |
| 293 else | 292 else |
| 294 [field_ setLeftViewMode:UITextFieldViewModeNever]; | 293 [field_ setLeftViewMode:UITextFieldViewModeNever]; |
| 295 } | 294 } |
| 296 | 295 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 if (IsIPadIdiom()) | 327 if (IsIPadIdiom()) |
| 329 [field_ setRightView:nil]; | 328 [field_ setRightView:nil]; |
| 330 } else if ([field_ displayedText].empty() && | 329 } else if ([field_ displayedText].empty() && |
| 331 ![field_ isShowingQueryRefinementChip]) { | 330 ![field_ isShowingQueryRefinementChip]) { |
| 332 [field_ setRightView:nil]; | 331 [field_ setRightView:nil]; |
| 333 } else { | 332 } else { |
| 334 [field_ setRightView:clear_text_button_]; | 333 [field_ setRightView:clear_text_button_]; |
| 335 [clear_text_button_ setAlpha:1]; | 334 [clear_text_button_ setAlpha:1]; |
| 336 } | 335 } |
| 337 } | 336 } |
| OLD | NEW |