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

Unified Diff: ios/web/shell/view_controller.mm

Issue 1838653002: [ios] Use WebStateObserver to update url bar in ios_web_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed CANARY_VERSION Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/shell/view_controller.mm
diff --git a/ios/web/shell/view_controller.mm b/ios/web/shell/view_controller.mm
index 5be7cebe5858a00ad10a5d0cc01852bb45ae192c..58a61cbcd283d4d34b0ebfb410dfed0844d7bccd 100644
--- a/ios/web/shell/view_controller.mm
+++ b/ios/web/shell/view_controller.mm
@@ -22,6 +22,7 @@
#include "ios/web/public/referrer.h"
#import "ios/web/public/web_controller_factory.h"
#include "ios/web/public/web_state/web_state.h"
+#import "ios/web/public/web_state/web_state_observer_bridge.h"
#include "ios/web/shell/shell_browser_state.h"
#include "ios/web/web_state/ui/crw_web_controller.h"
#include "ios/web/web_state/web_state_impl.h"
@@ -33,11 +34,12 @@ NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
using web::NavigationManager;
-@interface ViewController ()<CRWWebUserInterfaceDelegate> {
+@interface ViewController ()<CRWWebStateObserver, CRWWebUserInterfaceDelegate> {
web::BrowserState* _browserState;
base::scoped_nsobject<CRWWebController> _webController;
scoped_ptr<web::RequestTrackerFactoryImpl> _requestTrackerFactory;
scoped_ptr<web::WebHTTPProtocolHandlerDelegate> _httpProtocolDelegate;
+ scoped_ptr<web::WebStateObserverBridge> _webStateObserver;
base::mac::ObjCPropertyReleaser _propertyReleaser_ViewController;
}
@@ -120,6 +122,8 @@ using web::NavigationManager;
[_webController setUIDelegate:self];
[_webController setWebUsageEnabled:YES];
+ _webStateObserver.reset(new web::WebStateObserverBridge(self.webState, self));
+
UIView* view = self.webState->GetView();
[view setFrame:[_containerView bounds]];
[_containerView addSubview:view];
@@ -259,22 +263,36 @@ using web::NavigationManager;
}
// -----------------------------------------------------------------------
+// WebStateObserver implementation.
+
+- (void)didStartProvisionalNavigationForURL:(const GURL&)URL {
+ [self updateToolbar];
+}
+
+- (void)didCommitNavigationWithDetails:
+ (const web::LoadCommittedDetails&)details {
+ [self updateToolbar];
+}
+
+- (void)webStateDidLoadPage:(web::WebState*)webState {
+ DCHECK_EQ(self.webState, webState);
+ [self updateToolbar];
+}
+
+// -----------------------------------------------------------------------
// WebDelegate implementation.
- (void)webWillAddPendingURL:(const GURL&)url
transition:(ui::PageTransition)transition {
}
- (void)webDidAddPendingURL {
- [self updateToolbar];
}
- (void)webCancelStartLoadingRequest {
}
- (void)webDidStartLoadingURL:(const GURL&)currentUrl
shouldUpdateHistory:(BOOL)updateHistory {
- [self updateToolbar];
}
- (void)webDidFinishWithURL:(const GURL&)url loadSuccess:(BOOL)loadSuccess {
- [self updateToolbar];
}
- (CRWWebController*)webPageOrderedOpen:(const GURL&)url
« 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