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

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

Issue 2679003002: Initialize CRIWVWebView with Configuration object instead of browserState. (Closed)
Patch Set: Rebase. Respond to comments. Fix duplicate unique_ptr. Created 3 years, 10 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/criwv_website_data_store.mm
diff --git a/ios/web_view/internal/criwv_website_data_store.mm b/ios/web_view/internal/criwv_website_data_store.mm
new file mode 100644
index 0000000000000000000000000000000000000000..af9f59f186dc4f22b5024fd1a1d07a88737949d7
--- /dev/null
+++ b/ios/web_view/internal/criwv_website_data_store.mm
@@ -0,0 +1,53 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/web_view/internal/criwv_website_data_store_internal.h"
+
+#include <memory.h>
+
+#include "ios/web_view/internal/criwv_browser_state.h"
+#import "ios/web_view/internal/criwv_web_client.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@implementation CRIWVWebsiteDataStore
+// TODO(crbug.com/690182): CRIWVWebsiteDataStore should own _browserState.
+ios_web_view::CRIWVBrowserState* _browserState;
+
+- (BOOL)isPersistent {
+ return !_browserState->IsOffTheRecord();
+}
+
+- (ios_web_view::CRIWVBrowserState*)browserState {
+ return _browserState;
+}
+
+- (void)setBrowserState:
+ (ios_web_view::CRIWVBrowserState* _Nonnull)browserState {
+ _browserState = browserState;
+}
+
++ (instancetype)defaultDataStore {
+ CRIWVWebsiteDataStore* dataStore = [[CRIWVWebsiteDataStore alloc] init];
+
+ ios_web_view::CRIWVWebClient* client =
+ static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient());
+ [dataStore setBrowserState:client->browser_state()];
+
+ return dataStore;
+}
+
++ (instancetype)nonPersistentDataStore {
+ CRIWVWebsiteDataStore* dataStore = [[CRIWVWebsiteDataStore alloc] init];
+
+ ios_web_view::CRIWVWebClient* client =
+ static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient());
+ [dataStore setBrowserState:client->off_the_record_browser_state()];
+
+ return dataStore;
+}
+
+@end
« no previous file with comments | « ios/web_view/internal/criwv_web_view_internal.h ('k') | ios/web_view/internal/criwv_website_data_store_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698