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

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

Issue 2747683002: Merge CWVWebsiteDataStore into CWVWebViewConfiguration. (Closed)
Patch Set: Apply review comments, rebase and merge. Created 3 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 | « ios/web_view/internal/cwv_web_view.mm ('k') | ios/web_view/internal/cwv_web_view_configuration_internal.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_configuration.mm
diff --git a/ios/web_view/internal/cwv_web_view_configuration.mm b/ios/web_view/internal/cwv_web_view_configuration.mm
index 01568c5ce1ef7b841e4a762581d6c70d9a4b59dd..f29c00200f7f99c04fed224227d111cba1ff0edb 100644
--- a/ios/web_view/internal/cwv_web_view_configuration.mm
+++ b/ios/web_view/internal/cwv_web_view_configuration.mm
@@ -3,39 +3,70 @@
// found in the LICENSE file.
#import "ios/web_view/public/cwv_web_view_configuration.h"
+#import "ios/web_view/internal/cwv_web_view_configuration_internal.h"
-#import "ios/web_view/public/cwv_website_data_store.h"
+#import "ios/web_view/internal/web_view_browser_state.h"
+#import "ios/web_view/internal/web_view_web_client.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface CWVWebViewConfiguration ()
-// Initialize configuration with specified data store.
-- (instancetype)initWithDataStore:(CWVWebsiteDataStore*)dataStore;
+// Initialize configuration with the specified browser state.
+- (instancetype)initWithBrowserState:
+ (ios_web_view::WebViewBrowserState*)browserState;
@end
-@implementation CWVWebViewConfiguration
+@implementation CWVWebViewConfiguration {
+ // TODO(crbug.com/690182): CWVWebViewConfiguration should own _browserState.
+ ios_web_view::WebViewBrowserState* _browserState;
+}
-@synthesize websiteDataStore = _websiteDataStore;
++ (instancetype)defaultConfiguration {
+ static dispatch_once_t once;
+ static CWVWebViewConfiguration* configuration;
+ dispatch_once(&once, ^{
+ ios_web_view::WebViewWebClient* client =
+ static_cast<ios_web_view::WebViewWebClient*>(web::GetWebClient());
+ configuration = [[self alloc] initWithBrowserState:client->browser_state()];
+ });
+ return configuration;
+}
-- (instancetype)init {
- return [self initWithDataStore:[CWVWebsiteDataStore defaultDataStore]];
++ (instancetype)incognitoConfiguration {
+ static dispatch_once_t once;
+ static CWVWebViewConfiguration* configuration;
+ dispatch_once(&once, ^{
+ ios_web_view::WebViewWebClient* client =
+ static_cast<ios_web_view::WebViewWebClient*>(web::GetWebClient());
+ configuration = [[self alloc]
+ initWithBrowserState:client->off_the_record_browser_state()];
+ });
+ return configuration;
}
-- (instancetype)initWithDataStore:(CWVWebsiteDataStore*)dataStore {
+- (instancetype)initWithBrowserState:
+ (ios_web_view::WebViewBrowserState*)browserState {
self = [super init];
if (self) {
- _websiteDataStore = dataStore;
+ _browserState = browserState;
}
return self;
}
+- (BOOL)isPersistent {
+ return !_browserState->IsOffTheRecord();
+}
+
+- (ios_web_view::WebViewBrowserState*)browserState {
+ return _browserState;
+}
+
// NSCopying
- (id)copyWithZone:(NSZone*)zone {
- return
- [[[self class] allocWithZone:zone] initWithDataStore:_websiteDataStore];
+ return [[[self class] allocWithZone:zone] initWithBrowserState:_browserState];
}
@end
« no previous file with comments | « ios/web_view/internal/cwv_web_view.mm ('k') | ios/web_view/internal/cwv_web_view_configuration_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698