| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/web/shell/view_controller.h" | 5 #import "ios/web/shell/view_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 - (void)updateToolbar { | 180 - (void)updateToolbar { |
| 181 // Do not update the URL if the text field is currently being edited. | 181 // Do not update the URL if the text field is currently being edited. |
| 182 if ([_field isFirstResponder]) { | 182 if ([_field isFirstResponder]) { |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 | 185 |
| 186 const GURL& visibleURL = _webState->GetVisibleURL(); | 186 const GURL& visibleURL = _webState->GetVisibleURL(); |
| 187 [_field setText:base::SysUTF8ToNSString(visibleURL.spec())]; | 187 [_field setText:base::SysUTF8ToNSString(visibleURL.spec())]; |
| 188 } | 188 } |
| 189 | 189 |
| 190 - (web::WebState*)webState { |
| 191 return _webState.get(); |
| 192 } |
| 193 |
| 190 // ----------------------------------------------------------------------- | 194 // ----------------------------------------------------------------------- |
| 191 #pragma mark Bikeshedding Implementation | 195 #pragma mark Bikeshedding Implementation |
| 192 | 196 |
| 193 // Overridden to allow this view controller to receive motion events by being | 197 // Overridden to allow this view controller to receive motion events by being |
| 194 // first responder when no other views are. | 198 // first responder when no other views are. |
| 195 - (BOOL)canBecomeFirstResponder { | 199 - (BOOL)canBecomeFirstResponder { |
| 196 return YES; | 200 return YES; |
| 197 } | 201 } |
| 198 | 202 |
| 199 - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent*)event { | 203 - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent*)event { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 (const web::LoadCommittedDetails&)details { | 256 (const web::LoadCommittedDetails&)details { |
| 253 [self updateToolbar]; | 257 [self updateToolbar]; |
| 254 } | 258 } |
| 255 | 259 |
| 256 - (void)webStateDidLoadPage:(web::WebState*)webState { | 260 - (void)webStateDidLoadPage:(web::WebState*)webState { |
| 257 DCHECK_EQ(_webState.get(), webState); | 261 DCHECK_EQ(_webState.get(), webState); |
| 258 [self updateToolbar]; | 262 [self updateToolbar]; |
| 259 } | 263 } |
| 260 | 264 |
| 261 @end | 265 @end |
| OLD | NEW |