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

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

Issue 2707963002: [ObjC ARC] Converts ios/chrome/browser/ui/omnibox:omnibox_internal to ARC. (Closed)
Patch Set: ARC in new code Created 3 years, 9 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"
(...skipping 13 matching lines...) Expand all
24 #import "ios/chrome/browser/ui/uikit_ui_util.h" 24 #import "ios/chrome/browser/ui/uikit_ui_util.h"
25 #include "ios/chrome/grit/ios_strings.h" 25 #include "ios/chrome/grit/ios_strings.h"
26 #include "ios/chrome/grit/ios_theme_resources.h" 26 #include "ios/chrome/grit/ios_theme_resources.h"
27 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" 27 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h"
28 #include "ios/web/public/navigation_item.h" 28 #include "ios/web/public/navigation_item.h"
29 #include "ios/web/public/navigation_manager.h" 29 #include "ios/web/public/navigation_manager.h"
30 #include "ios/web/public/ssl_status.h" 30 #include "ios/web/public/ssl_status.h"
31 #include "ios/web/public/web_state/web_state.h" 31 #include "ios/web/public/web_state/web_state.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 33
34 #if !defined(__has_feature) || !__has_feature(objc_arc)
35 #error "This file requires ARC support."
36 #endif
37
34 namespace { 38 namespace {
35 const CGFloat kClearTextButtonWidth = 28; 39 const CGFloat kClearTextButtonWidth = 28;
36 const CGFloat kClearTextButtonHeight = 28; 40 const CGFloat kClearTextButtonHeight = 28;
37 41
38 // Workaround for https://crbug.com/527084 . If there is connection 42 // Workaround for https://crbug.com/527084 . If there is connection
39 // information, always show the icon. Remove this once connection info 43 // information, always show the icon. Remove this once connection info
40 // is available via other UI: https://crbug.com/533581 44 // is available via other UI: https://crbug.com/533581
41 bool DoesCurrentPageHaveCertInfo(web::WebState* webState) { 45 bool DoesCurrentPageHaveCertInfo(web::WebState* webState) {
42 if (!webState) 46 if (!webState)
43 return false; 47 return false;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 303
300 CGRect frame = CGRectZero; 304 CGRect frame = CGRectZero;
301 frame.size = CGSizeMake(kClearTextButtonWidth, kClearTextButtonHeight); 305 frame.size = CGSizeMake(kClearTextButtonWidth, kClearTextButtonHeight);
302 [button setFrame:frame]; 306 [button setFrame:frame];
303 307
304 clear_button_bridge_.reset( 308 clear_button_bridge_.reset(
305 [[OmniboxClearButtonBridge alloc] initWithOmniboxView:edit_view_.get()]); 309 [[OmniboxClearButtonBridge alloc] initWithOmniboxView:edit_view_.get()]);
306 [button addTarget:clear_button_bridge_ 310 [button addTarget:clear_button_bridge_
307 action:@selector(clearText) 311 action:@selector(clearText)
308 forControlEvents:UIControlEventTouchUpInside]; 312 forControlEvents:UIControlEventTouchUpInside];
309 clear_text_button_.reset([button retain]); 313 clear_text_button_.reset(button);
310 314
311 SetA11yLabelAndUiAutomationName(clear_text_button_, 315 SetA11yLabelAndUiAutomationName(clear_text_button_,
312 IDS_IOS_ACCNAME_CLEAR_TEXT, @"Clear Text"); 316 IDS_IOS_ACCNAME_CLEAR_TEXT, @"Clear Text");
313 } 317 }
314 318
315 void LocationBarViewIOS::UpdateRightDecorations() { 319 void LocationBarViewIOS::UpdateRightDecorations() {
316 DCHECK(clear_text_button_); 320 DCHECK(clear_text_button_);
317 if (!edit_view_->model()->has_focus()) { 321 if (!edit_view_->model()->has_focus()) {
318 // Do nothing for iPhone. The right view will be set to nil after the 322 // Do nothing for iPhone. The right view will be set to nil after the
319 // omnibox animation is completed. 323 // omnibox animation is completed.
320 if (IsIPadIdiom()) 324 if (IsIPadIdiom())
321 [field_ setRightView:nil]; 325 [field_ setRightView:nil];
322 } else if ([field_ displayedText].empty() && 326 } else if ([field_ displayedText].empty() &&
323 ![field_ isShowingQueryRefinementChip]) { 327 ![field_ isShowingQueryRefinementChip]) {
324 [field_ setRightView:nil]; 328 [field_ setRightView:nil];
325 } else { 329 } else {
326 [field_ setRightView:clear_text_button_]; 330 [field_ setRightView:clear_text_button_];
327 [clear_text_button_ setAlpha:1]; 331 [clear_text_button_ setAlpha:1];
328 } 332 }
329 } 333 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox/location_bar_view_ios.h ('k') | ios/chrome/browser/ui/omnibox/omnibox_popup_material_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698