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

Side by Side Diff: ios/chrome/browser/ui/omnibox/omnibox_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 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" 5 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h"
6 6
7 #import <CoreText/CoreText.h> 7 #import <CoreText/CoreText.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 20 matching lines...) Expand all
31 #include "ios/chrome/grit/ios_theme_resources.h" 31 #include "ios/chrome/grit/ios_theme_resources.h"
32 #include "ios/web/public/referrer.h" 32 #include "ios/web/public/referrer.h"
33 #import "net/base/mac/url_conversions.h" 33 #import "net/base/mac/url_conversions.h"
34 #include "skia/ext/skia_utils_ios.h" 34 #include "skia/ext/skia_utils_ios.h"
35 #include "ui/base/page_transition_types.h" 35 #include "ui/base/page_transition_types.h"
36 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
37 #include "ui/base/window_open_disposition.h" 37 #include "ui/base/window_open_disposition.h"
38 #include "ui/gfx/color_palette.h" 38 #include "ui/gfx/color_palette.h"
39 #include "ui/gfx/image/image.h" 39 #include "ui/gfx/image/image.h"
40 40
41 #if !defined(__has_feature) || !__has_feature(objc_arc)
42 #error "This file requires ARC support."
43 #endif
44
41 using base::UserMetricsAction; 45 using base::UserMetricsAction;
42 46
43 namespace { 47 namespace {
44 // The color of the rest of the URL (i.e. after the TLD) in the omnibox. 48 // The color of the rest of the URL (i.e. after the TLD) in the omnibox.
45 UIColor* BaseTextColor() { 49 UIColor* BaseTextColor() {
46 return [UIColor colorWithWhite:(161 / 255.0) alpha:1.0]; 50 return [UIColor colorWithWhite:(161 / 255.0) alpha:1.0];
47 } 51 }
48 52
49 // The color of the https when there is an error. 53 // The color of the https when there is an error.
50 UIColor* ErrorTextColor() { 54 UIColor* ErrorTextColor() {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 168
165 OmniboxViewIOS::OmniboxViewIOS(OmniboxTextFieldIOS* field, 169 OmniboxViewIOS::OmniboxViewIOS(OmniboxTextFieldIOS* field,
166 WebOmniboxEditController* controller, 170 WebOmniboxEditController* controller,
167 ios::ChromeBrowserState* browser_state, 171 ios::ChromeBrowserState* browser_state,
168 id<PreloadProvider> preloader, 172 id<PreloadProvider> preloader,
169 id<OmniboxPopupPositioner> positioner) 173 id<OmniboxPopupPositioner> positioner)
170 : OmniboxView( 174 : OmniboxView(
171 controller, 175 controller,
172 base::MakeUnique<ChromeOmniboxClientIOS>(controller, browser_state)), 176 base::MakeUnique<ChromeOmniboxClientIOS>(controller, browser_state)),
173 browser_state_(browser_state), 177 browser_state_(browser_state),
174 field_([field retain]), 178 field_(field),
175 controller_(controller), 179 controller_(controller),
176 preloader_(preloader), 180 preloader_(preloader),
177 ignore_popup_updates_(false), 181 ignore_popup_updates_(false),
178 attributing_display_string_(nil) { 182 attributing_display_string_(nil) {
179 popup_view_.reset(new OmniboxPopupViewIOS(this, model(), positioner)); 183 popup_view_.reset(new OmniboxPopupViewIOS(this, model(), positioner));
180 field_delegate_.reset( 184 field_delegate_.reset(
181 [[AutocompleteTextFieldDelegate alloc] initWithEditView:this]); 185 [[AutocompleteTextFieldDelegate alloc] initWithEditView:this]);
182 [field_ setDelegate:field_delegate_]; 186 [field_ setDelegate:field_delegate_];
183 [field_ addTarget:field_delegate_ 187 [field_ addTarget:field_delegate_
184 action:@selector(textFieldDidChange:) 188 action:@selector(textFieldDidChange:)
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 UIColor* color = GetSecureTextColor(security_level, [field_ incognito]); 681 UIColor* color = GetSecureTextColor(security_level, [field_ incognito]);
678 if (color) { 682 if (color) {
679 [attributing_display_string_ addAttribute:NSForegroundColorAttributeName 683 [attributing_display_string_ addAttribute:NSForegroundColorAttributeName
680 value:color 684 value:color
681 range:range.ToNSRange()]; 685 range:range.ToNSRange()];
682 } 686 }
683 } 687 }
684 688
685 NSAttributedString* OmniboxViewIOS::ApplyTextAttributes( 689 NSAttributedString* OmniboxViewIOS::ApplyTextAttributes(
686 const base::string16& text) { 690 const base::string16& text) {
687 NSMutableAttributedString* as = [[[NSMutableAttributedString alloc] 691 NSMutableAttributedString* as = [[NSMutableAttributedString alloc]
688 initWithString:base::SysUTF16ToNSString(text)] autorelease]; 692 initWithString:base::SysUTF16ToNSString(text)];
689 // Cache a pointer to the attributed string to allow the superclass' 693 // Cache a pointer to the attributed string to allow the superclass'
690 // virtual method invocations to add attributes. 694 // virtual method invocations to add attributes.
691 DCHECK(attributing_display_string_ == nil); 695 DCHECK(attributing_display_string_ == nil);
692 base::AutoReset<NSMutableAttributedString*> resetter( 696 base::AutoReset<NSMutableAttributedString*> resetter(
693 &attributing_display_string_, as); 697 &attributing_display_string_, as);
694 UpdateTextStyle(text, AutocompleteSchemeClassifierImpl()); 698 UpdateTextStyle(text, AutocompleteSchemeClassifierImpl());
695 return as; 699 return as;
696 } 700 }
697 701
698 void OmniboxViewIOS::UpdateAppearance() { 702 void OmniboxViewIOS::UpdateAppearance() {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 // is being left out for now because it was not present before the OmniboxView 873 // is being left out for now because it was not present before the OmniboxView
870 // rewrite. 874 // rewrite.
871 #if 0 875 #if 0
872 // When editing is in progress, the url text is not colored, so there is 876 // When editing is in progress, the url text is not colored, so there is
873 // nothing to emphasize. (Calling SetText() in that situation would also be 877 // nothing to emphasize. (Calling SetText() in that situation would also be
874 // harmful, as it would reset the carat position to the end of the text.) 878 // harmful, as it would reset the carat position to the end of the text.)
875 if (!IsEditingOrEmpty()) 879 if (!IsEditingOrEmpty())
876 SetText(GetText()); 880 SetText(GetText());
877 #endif 881 #endif
878 } 882 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox/omnibox_view_ios.h ('k') | ios/chrome/browser/ui/omnibox/page_info_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698