| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/web_view/internal/criwv_website_data_store_internal.h" |
| 6 |
| 7 #include <memory.h> |
| 8 |
| 9 #include "ios/web_view/internal/criwv_browser_state.h" |
| 10 #import "ios/web_view/internal/criwv_web_client.h" |
| 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 16 @implementation CRIWVWebsiteDataStore |
| 17 // TODO(crbug.com/690182): CRIWVWebsiteDataStore should own _browserState. |
| 18 ios_web_view::CRIWVBrowserState* _browserState; |
| 19 |
| 20 - (BOOL)isPersistent { |
| 21 return !_browserState->IsOffTheRecord(); |
| 22 } |
| 23 |
| 24 - (ios_web_view::CRIWVBrowserState*)browserState { |
| 25 return _browserState; |
| 26 } |
| 27 |
| 28 - (void)setBrowserState: |
| 29 (ios_web_view::CRIWVBrowserState* _Nonnull)browserState { |
| 30 _browserState = browserState; |
| 31 } |
| 32 |
| 33 + (instancetype)defaultDataStore { |
| 34 CRIWVWebsiteDataStore* dataStore = [[CRIWVWebsiteDataStore alloc] init]; |
| 35 |
| 36 ios_web_view::CRIWVWebClient* client = |
| 37 static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient()); |
| 38 [dataStore setBrowserState:client->browser_state()]; |
| 39 |
| 40 return dataStore; |
| 41 } |
| 42 |
| 43 + (instancetype)nonPersistentDataStore { |
| 44 CRIWVWebsiteDataStore* dataStore = [[CRIWVWebsiteDataStore alloc] init]; |
| 45 |
| 46 ios_web_view::CRIWVWebClient* client = |
| 47 static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient()); |
| 48 [dataStore setBrowserState:client->off_the_record_browser_state()]; |
| 49 |
| 50 return dataStore; |
| 51 } |
| 52 |
| 53 @end |
| OLD | NEW |