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

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

Issue 2791403005: Remove CWV class and move setting User Agent to CWVWebViewConfiguration. (Closed)
Patch Set: Respond to comments. Created 3 years, 8 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
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 08fb4d8dc30b2994005f51fbd5799b2b1efbc42c..fdb5f9520a2376ef05a7a67136543128e229f686 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -34,7 +34,6 @@
#include "url/gurl.h"
@interface CWVWebView ()<CRWWebStateDelegate, CRWWebStateObserver> {
- CWVWebViewConfiguration* _configuration;
std::unique_ptr<web::WebState> _webState;
std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate;
std::unique_ptr<web::WebStateObserverBridge> _webStateObserver;
@@ -46,12 +45,16 @@
_javaScriptDialogPresenter;
}
+// Redefine the property as readwrite.
+@property(nonatomic, copy) CWVWebViewConfiguration* configuration;
// Redefine the property as readwrite to define -setEstimatedProgress:, which
// can be used to send KVO notification.
@property(nonatomic, readwrite) double estimatedProgress;
@end
+static NSString* gUserAgentProduct = nil;
+
@implementation CWVWebView
@synthesize configuration = _configuration;
@@ -60,6 +63,14 @@
@synthesize estimatedProgress = _estimatedProgress;
@synthesize UIDelegate = _UIDelegate;
++ (NSString*)userAgentProduct {
+ return gUserAgentProduct;
+}
+
++ (void)setUserAgentProduct:(NSString*)product {
+ gUserAgentProduct = product;
Eugene But (OOO till 7-30) 2017/04/12 00:46:17 gUserAgentProduct = [product copy];
michaeldo 2017/04/12 17:16:48 Done.
+}
+
- (instancetype)initWithFrame:(CGRect)frame
configuration:(CWVWebViewConfiguration*)configuration {
self = [super initWithFrame:frame];
@@ -67,7 +78,7 @@
_configuration = [configuration copy];
web::WebState::CreateParams webStateCreateParams(
- configuration.browserState);
+ _configuration.browserState);
_webState = web::WebState::Create(webStateCreateParams);
_webState->SetWebUsageEnabled(true);

Powered by Google App Engine
This is Rietveld 408576698