Chromium Code Reviews| 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/public/cwv_web_view.h" | 5 #import "ios/web_view/public/cwv_web_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 | 366 |
| 367 _javaScriptDialogPresenter = | 367 _javaScriptDialogPresenter = |
| 368 base::MakeUnique<ios_web_view::WebViewJavaScriptDialogPresenter>(self, | 368 base::MakeUnique<ios_web_view::WebViewJavaScriptDialogPresenter>(self, |
| 369 nullptr); | 369 nullptr); |
| 370 | 370 |
| 371 _scrollView.proxy = _webState.get()->GetWebViewProxy().scrollViewProxy; | 371 _scrollView.proxy = _webState.get()->GetWebViewProxy().scrollViewProxy; |
| 372 | 372 |
| 373 _translationController.webState = _webState.get(); | 373 _translationController.webState = _webState.get(); |
| 374 | 374 |
| 375 [self addInternalWebViewAsSubview]; | 375 [self addInternalWebViewAsSubview]; |
| 376 | |
| 377 [self updateNavigationAvailability]; | |
| 378 [self updateCurrentURLs]; | |
| 379 self.loading = NO; | |
| 380 self.estimatedProgress = 0.0; | |
| 381 self.title = base::SysUTF16ToNSString(_webState->GetTitle()); | |
|
Hiroshi Ichikawa
2017/06/13 07:40:11
Optional: Maybe factor this out to -updateTitle me
Eugene But (OOO till 7-30)
2017/06/13 07:56:41
Done.
| |
| 376 } | 382 } |
| 377 | 383 |
| 378 // Adds the web view provided by |_webState| as a subview unless it has already. | 384 // Adds the web view provided by |_webState| as a subview unless it has already. |
| 379 - (void)addInternalWebViewAsSubview { | 385 - (void)addInternalWebViewAsSubview { |
| 380 UIView* subview = _webState->GetView(); | 386 UIView* subview = _webState->GetView(); |
| 381 if (subview.superview == self) { | 387 if (subview.superview == self) { |
| 382 return; | 388 return; |
| 383 } | 389 } |
| 384 subview.frame = self.bounds; | 390 subview.frame = self.bounds; |
| 385 subview.autoresizingMask = | 391 subview.autoresizingMask = |
| 386 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | 392 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
| 387 [self addSubview:subview]; | 393 [self addSubview:subview]; |
| 388 } | 394 } |
| 389 | 395 |
| 390 - (void)updateNavigationAvailability { | 396 - (void)updateNavigationAvailability { |
| 391 self.canGoBack = _webState && _webState->GetNavigationManager()->CanGoBack(); | 397 self.canGoBack = _webState && _webState->GetNavigationManager()->CanGoBack(); |
| 392 self.canGoForward = | 398 self.canGoForward = |
| 393 _webState && _webState->GetNavigationManager()->CanGoForward(); | 399 _webState && _webState->GetNavigationManager()->CanGoForward(); |
| 394 } | 400 } |
| 395 | 401 |
| 396 - (void)updateCurrentURLs { | 402 - (void)updateCurrentURLs { |
| 397 self.lastCommittedURL = net::NSURLWithGURL(_webState->GetLastCommittedURL()); | 403 self.lastCommittedURL = net::NSURLWithGURL(_webState->GetLastCommittedURL()); |
| 398 self.visibleURL = net::NSURLWithGURL(_webState->GetVisibleURL()); | 404 self.visibleURL = net::NSURLWithGURL(_webState->GetVisibleURL()); |
| 399 } | 405 } |
| 400 | 406 |
| 401 @end | 407 @end |
| OLD | NEW |