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

Side by Side Diff: ios/web_view/internal/cwv_web_view.mm

Issue 2935923002: Correctly update CWVWebView properties on state restoration. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698