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 #import "ios/web_view/internal/criwv_web_client.h" | |
10 #include "ios/web_view/internal/cwv_browser_state.h" | 9 #include "ios/web_view/internal/cwv_browser_state.h" |
| 10 #import "ios/web_view/internal/cwv_web_client.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::CWVBrowserState* _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::CWVBrowserState*)browserState { | 24 - (ios_web_view::CWVBrowserState*)browserState { |
25 return _browserState; | 25 return _browserState; |
26 } | 26 } |
27 | 27 |
28 - (void)setBrowserState:(ios_web_view::CWVBrowserState* _Nonnull)browserState { | 28 - (void)setBrowserState:(ios_web_view::CWVBrowserState* _Nonnull)browserState { |
29 _browserState = browserState; | 29 _browserState = browserState; |
30 } | 30 } |
31 | 31 |
32 + (instancetype)defaultDataStore { | 32 + (instancetype)defaultDataStore { |
33 CWVWebsiteDataStore* dataStore = [[CWVWebsiteDataStore alloc] init]; | 33 CWVWebsiteDataStore* dataStore = [[CWVWebsiteDataStore alloc] init]; |
34 | 34 |
35 ios_web_view::CRIWVWebClient* client = | 35 ios_web_view::CWVWebClient* client = |
36 static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient()); | 36 static_cast<ios_web_view::CWVWebClient*>(web::GetWebClient()); |
37 [dataStore setBrowserState:client->browser_state()]; | 37 [dataStore setBrowserState:client->browser_state()]; |
38 | 38 |
39 return dataStore; | 39 return dataStore; |
40 } | 40 } |
41 | 41 |
42 + (instancetype)nonPersistentDataStore { | 42 + (instancetype)nonPersistentDataStore { |
43 CWVWebsiteDataStore* dataStore = [[CWVWebsiteDataStore alloc] init]; | 43 CWVWebsiteDataStore* dataStore = [[CWVWebsiteDataStore alloc] init]; |
44 | 44 |
45 ios_web_view::CRIWVWebClient* client = | 45 ios_web_view::CWVWebClient* client = |
46 static_cast<ios_web_view::CRIWVWebClient*>(web::GetWebClient()); | 46 static_cast<ios_web_view::CWVWebClient*>(web::GetWebClient()); |
47 [dataStore setBrowserState:client->off_the_record_browser_state()]; | 47 [dataStore setBrowserState:client->off_the_record_browser_state()]; |
48 | 48 |
49 return dataStore; | 49 return dataStore; |
50 } | 50 } |
51 | 51 |
52 @end | 52 @end |
OLD | NEW |