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