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

Unified Diff: ios/web_view/internal/cwv_web_view.mm

Issue 2902403002: Add KVO compliant title property to CWVWebView. (Closed)
Patch Set: Remove observers directory. Created 3 years, 7 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 | ios/web_view/public/cwv_web_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/internal/cwv_web_view.mm
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm
index b443c20da523e5297ccc5d965674593f1a3c297e..d228055fae7b63d17c02840bee5d2f45571f6028 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -79,6 +79,7 @@ NSString* const kSessionStorageKey = @"sessionStorage";
@property(nonatomic, readwrite) double estimatedProgress;
@property(nonatomic, readwrite) BOOL canGoBack;
@property(nonatomic, readwrite) BOOL canGoForward;
+@property(nonatomic, readwrite, copy) NSString* title;
// Updates the availability of the back/forward navigation properties exposed
// through |canGoBack| and |canGoForward|.
@@ -95,6 +96,7 @@ static NSString* gUserAgentProduct = nil;
@synthesize configuration = _configuration;
@synthesize estimatedProgress = _estimatedProgress;
@synthesize navigationDelegate = _navigationDelegate;
+@synthesize title = _title;
@synthesize translationController = _translationController;
@synthesize UIDelegate = _UIDelegate;
@synthesize scrollView = _scrollView;
@@ -145,10 +147,6 @@ static NSString* gUserAgentProduct = nil;
return net::NSURLWithGURL(_webState->GetLastCommittedURL());
}
-- (NSString*)title {
- return base::SysUTF16ToNSString(_webState->GetTitle());
-}
-
- (void)goBack {
if (_webState->GetNavigationManager())
_webState->GetNavigationManager()->GoBack();
@@ -231,6 +229,10 @@ static NSString* gUserAgentProduct = nil;
self.estimatedProgress = progress;
}
+- (void)webStateDidChangeTitle:(web::WebState*)webState {
+ self.title = base::SysUTF16ToNSString(_webState->GetTitle());
+}
+
- (void)renderProcessGoneForWebState:(web::WebState*)webState {
SEL selector = @selector(webViewWebContentProcessDidTerminate:);
if ([_navigationDelegate respondsToSelector:selector]) {
« no previous file with comments | « no previous file | ios/web_view/public/cwv_web_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698