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