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

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: Move Browser State and Web Client ownership to CWVWebViewConfiguration. Each CWVWebViewConfiguratio… 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..e77aedcbe076b145970c3055bfd4f4c510f79fae 100644
--- a/ios/web_view/internal/cwv_web_view.mm
+++ b/ios/web_view/internal/cwv_web_view.mm
@@ -25,6 +25,7 @@
#import "ios/web_view/internal/translate/web_view_translate_client.h"
#include "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/internal/web_view_java_script_dialog_presenter.h"
+#import "ios/web_view/internal/web_view_web_client.h"
#import "ios/web_view/internal/web_view_web_state_policy_decider.h"
#import "ios/web_view/public/cwv_navigation_delegate.h"
#import "ios/web_view/public/cwv_ui_delegate.h"
@@ -34,7 +35,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,6 +46,8 @@
_javaScriptDialogPresenter;
}
+// The configuration of the web view.
Eugene But (OOO till 7-30) 2017/04/11 17:52:41 s/The configuration of the web view/Redefine the p
michaeldo 2017/04/11 21:57:02 Done.
+@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;
@@ -60,6 +62,11 @@
@synthesize estimatedProgress = _estimatedProgress;
@synthesize UIDelegate = _UIDelegate;
++ (void)setUserAgentProduct:(NSString*)product {
+ ios_web_view::WebViewWebClient* client = [CWVWebViewConfiguration webClient];
+ client->SetProduct(base::SysNSStringToUTF8(product));
+}
+
- (instancetype)initWithFrame:(CGRect)frame
configuration:(CWVWebViewConfiguration*)configuration {
self = [super initWithFrame:frame];
@@ -67,7 +74,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