Chromium Code Reviews| 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/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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 - (void)willPaste { | 159 - (void)willPaste { |
| 160 editView_->WillPaste(); | 160 editView_->WillPaste(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 - (void)onDeleteBackward { | 163 - (void)onDeleteBackward { |
| 164 editView_->OnDeleteBackward(); | 164 editView_->OnDeleteBackward(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 @end | 167 @end |
| 168 | 168 |
| 169 OmniboxViewIOS::OmniboxViewIOS(OmniboxTextFieldIOS* field, | 169 OmniboxViewIOS::OmniboxViewIOS(OmniboxTextFieldIOS* field, |
|
rohitrao (ping after 24h)
2017/04/05 13:36:14
Mark and I chatted in person about this design. I
| |
| 170 WebOmniboxEditController* controller, | 170 WebOmniboxEditController* controller, |
| 171 ios::ChromeBrowserState* browser_state, | 171 ios::ChromeBrowserState* browser_state, |
| 172 id<PreloadProvider> preloader, | 172 id<PreloadProvider> preloader, |
| 173 id<OmniboxPopupPositioner> positioner) | 173 id<OmniboxPopupPositioner> positioner) |
| 174 : OmniboxView( | 174 : OmniboxView( |
| 175 controller, | 175 controller, |
| 176 base::MakeUnique<ChromeOmniboxClientIOS>(controller, browser_state)), | 176 base::MakeUnique<ChromeOmniboxClientIOS>(controller, browser_state)), |
| 177 browser_state_(browser_state), | 177 browser_state_(browser_state), |
| 178 field_(field), | 178 field_(field), |
| 179 controller_(controller), | 179 controller_(controller), |
| 180 preloader_(preloader), | 180 preloader_(preloader), |
| 181 ignore_popup_updates_(false), | 181 ignore_popup_updates_(false), |
| 182 attributing_display_string_(nil) { | 182 attributing_display_string_(nil) { |
| 183 DCHECK(field_); | |
| 183 popup_view_.reset(new OmniboxPopupViewIOS(this, model(), positioner)); | 184 popup_view_.reset(new OmniboxPopupViewIOS(this, model(), positioner)); |
| 184 field_delegate_.reset( | 185 field_delegate_.reset( |
| 185 [[AutocompleteTextFieldDelegate alloc] initWithEditView:this]); | 186 [[AutocompleteTextFieldDelegate alloc] initWithEditView:this]); |
| 186 [field_ setDelegate:field_delegate_]; | 187 [field_ setDelegate:field_delegate_]; |
| 187 [field_ addTarget:field_delegate_ | 188 [field_ addTarget:field_delegate_ |
| 188 action:@selector(textFieldDidChange:) | 189 action:@selector(textFieldDidChange:) |
| 189 forControlEvents:UIControlEventEditingChanged]; | 190 forControlEvents:UIControlEventEditingChanged]; |
| 190 } | 191 } |
| 191 | 192 |
| 192 OmniboxViewIOS::~OmniboxViewIOS() { | 193 OmniboxViewIOS::~OmniboxViewIOS() { |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 // is being left out for now because it was not present before the OmniboxView | 874 // is being left out for now because it was not present before the OmniboxView |
| 874 // rewrite. | 875 // rewrite. |
| 875 #if 0 | 876 #if 0 |
| 876 // When editing is in progress, the url text is not colored, so there is | 877 // When editing is in progress, the url text is not colored, so there is |
| 877 // nothing to emphasize. (Calling SetText() in that situation would also be | 878 // nothing to emphasize. (Calling SetText() in that situation would also be |
| 878 // harmful, as it would reset the carat position to the end of the text.) | 879 // harmful, as it would reset the carat position to the end of the text.) |
| 879 if (!IsEditingOrEmpty()) | 880 if (!IsEditingOrEmpty()) |
| 880 SetText(GetText()); | 881 SetText(GetText()); |
| 881 #endif | 882 #endif |
| 882 } | 883 } |
| OLD | NEW |