| 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_view/shell/shell_view_controller.h" | 5 #import "ios/web_view/shell/shell_view_controller.h" |
| 6 | 6 |
| 7 #import "ios/web_view/public/criwv.h" | 7 #import "ios/web_view/public/criwv.h" |
| 8 #import "ios/web_view/public/cwv_web_view.h" | 8 #import "ios/web_view/public/cwv_web_view.h" |
| 9 #import "ios/web_view/shell/translate_controller.h" | 9 #import "ios/web_view/shell/translate_controller.h" |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 - (void)updateToolbar { | 166 - (void)updateToolbar { |
| 167 // Do not update the URL if the text field is currently being edited. | 167 // Do not update the URL if the text field is currently being edited. |
| 168 if ([_field isFirstResponder]) { | 168 if ([_field isFirstResponder]) { |
| 169 return; | 169 return; |
| 170 } | 170 } |
| 171 | 171 |
| 172 [_field setText:[[_webView visibleURL] absoluteString]]; | 172 [_field setText:[[_webView visibleURL] absoluteString]]; |
| 173 } | 173 } |
| 174 | 174 |
| 175 #pragma mark CRIWVWebViewDelegate methods | 175 #pragma mark CWVWebViewDelegate methods |
| 176 | 176 |
| 177 - (void)webView:(CWVWebView*)webView | 177 - (void)webView:(CWVWebView*)webView |
| 178 didFinishLoadingWithURL:(NSURL*)url | 178 didFinishLoadingWithURL:(NSURL*)url |
| 179 loadSuccess:(BOOL)loadSuccess { | 179 loadSuccess:(BOOL)loadSuccess { |
| 180 // TODO(crbug.com/679895): Add some visual indication that the page load has | 180 // TODO(crbug.com/679895): Add some visual indication that the page load has |
| 181 // finished. | 181 // finished. |
| 182 [self updateToolbar]; | 182 [self updateToolbar]; |
| 183 } | 183 } |
| 184 | 184 |
| 185 - (void)webView:(CWVWebView*)webView | 185 - (void)webView:(CWVWebView*)webView |
| 186 didUpdateWithChanges:(CRIWVWebViewUpdateType)changes { | 186 didUpdateWithChanges:(CRIWVWebViewUpdateType)changes { |
| 187 if (changes & CRIWVWebViewUpdateTypeProgress) { | 187 if (changes & CRIWVWebViewUpdateTypeProgress) { |
| 188 // TODO(crbug.com/679895): Add a progress indicator. | 188 // TODO(crbug.com/679895): Add a progress indicator. |
| 189 } | 189 } |
| 190 | 190 |
| 191 if (changes & CRIWVWebViewUpdateTypeTitle) { | 191 if (changes & CRIWVWebViewUpdateTypeTitle) { |
| 192 // TODO(crbug.com/679895): Add a title display. | 192 // TODO(crbug.com/679895): Add a title display. |
| 193 } | 193 } |
| 194 | 194 |
| 195 if (changes & CRIWVWebViewUpdateTypeURL) { | 195 if (changes & CRIWVWebViewUpdateTypeURL) { |
| 196 [self updateToolbar]; | 196 [self updateToolbar]; |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 - (id<CRIWVTranslateDelegate>)translateDelegate { | 200 - (id<CWVTranslateDelegate>)translateDelegate { |
| 201 if (!_translateController) | 201 if (!_translateController) |
| 202 self.translateController = [[TranslateController alloc] init]; | 202 self.translateController = [[TranslateController alloc] init]; |
| 203 return _translateController; | 203 return _translateController; |
| 204 } | 204 } |
| 205 | 205 |
| 206 @end | 206 @end |
| OLD | NEW |