| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef IOS_WEB_CRW_BROWSING_DATA_STORE_H_ | 5 #ifndef IOS_WEB_CRW_BROWSING_DATA_STORE_H_ |
| 6 #define IOS_WEB_CRW_BROWSING_DATA_STORE_H_ | 6 #define IOS_WEB_CRW_BROWSING_DATA_STORE_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "base/ios/block_types.h" | 10 #import "base/ios/block_types.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // (UIWebView and WKWebView) uses. | 40 // (UIWebView and WKWebView) uses. |
| 41 // All methods must be called on the UI thread. | 41 // All methods must be called on the UI thread. |
| 42 @interface CRWBrowsingDataStore : NSObject | 42 @interface CRWBrowsingDataStore : NSObject |
| 43 | 43 |
| 44 // Designated initializer. |browserState| cannot be a nullptr. | 44 // Designated initializer. |browserState| cannot be a nullptr. |
| 45 // The |web::ActiveStateManager| associated with |browserState| needs to be in | 45 // The |web::ActiveStateManager| associated with |browserState| needs to be in |
| 46 // active state. | 46 // active state. |
| 47 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState | 47 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState |
| 48 NS_DESIGNATED_INITIALIZER; | 48 NS_DESIGNATED_INITIALIZER; |
| 49 | 49 |
| 50 // The mode that the CRWBrowsingDataStore is in. | 50 // The mode that the CRWBrowsingDataStore is in. KVO compliant. |
| 51 @property(nonatomic, assign, readonly) CRWBrowsingDataStoreMode mode; | 51 @property(nonatomic, assign, readonly) CRWBrowsingDataStoreMode mode; |
| 52 | 52 |
| 53 // TODO(shreyasv): Verify the preconditions for the following 3 methods when | 53 // TODO(shreyasv): Verify the preconditions for the following 3 methods when |
| 54 // web::WebViewCounter class is implemented. crbug.com/480507 | 54 // web::WebViewCounter class is implemented. crbug.com/480507 |
| 55 | 55 |
| 56 // Changes the mode to |ACTIVE|. | 56 // Changes the mode to |ACTIVE|. |
| 57 // |completionHandler| is called on the main thread. | 57 // |completionHandler| is called on the main thread. This block has no return |
| 58 // value and takes a single BOOL argument that indicates whether or not the |
| 59 // the mode was successfully changed to |ACTIVE|. |
| 60 // The mode change to |ACTIVE| can fail if another |makeActive| or |
| 61 // |makeInactive| was enqueued after this call. |
| 58 // Precondition: There must be no web views associated with the BrowserState. | 62 // Precondition: There must be no web views associated with the BrowserState. |
| 59 // Note: If there is another operation driven to change the mode, the mode will | 63 - (void)makeActiveWithCompletionHandler: |
| 60 // still be |SYNCHRONIZING| rather than |ACTIVE| when the callback is received. | 64 (void (^)(BOOL success))completionHandler; |
| 61 - (void)makeActiveWithCompletionHandler:(ProceduralBlock)completionHandler; | |
| 62 | 65 |
| 63 // Changes the mode to |INACTIVE|. | 66 // Changes the mode to |INACTIVE|. |
| 64 // |completionHandler| is called on the main thread. | 67 // |completionHandler| is called on the main thread. This block has no return |
| 68 // value and takes a single BOOL argument that indicates whether or not the |
| 69 // the mode was successfully changed to |INACTIVE|. |
| 70 // The mode change to |ACTIVE| can fail if another |makeActive| or |
| 71 // |makeInactive| was enqueued after this call. |
| 65 // Precondition: There must be no web views associated with the BrowserState. | 72 // Precondition: There must be no web views associated with the BrowserState. |
| 66 // Note: If there is another operation driven to change the mode, the mode will | 73 - (void)makeInactiveWithCompletionHandler: |
| 67 // still be |SYNCHRONIZING| rather than |INACTIVE| when the callback is | 74 (void (^)(BOOL success))completionHandler; |
| 68 // received. | |
| 69 - (void)makeInactiveWithCompletionHandler:(ProceduralBlock)completionHandler; | |
| 70 | 75 |
| 71 // Removes all browsing data of the provided |browsingDataTypes|. | 76 // Removes all browsing data of the provided |browsingDataTypes|. |
| 72 // |completionHandler| is called on the main thread after the browsing data has | 77 // |completionHandler| is called on the main thread after the browsing data has |
| 73 // been removed. | 78 // been removed. |
| 74 // Precondition: There must be no web views associated with the BrowserState. | 79 // Precondition: There must be no web views associated with the BrowserState. |
| 75 - (void)removeDataOfTypes:(web::BrowsingDataTypes)browsingDataTypes | 80 - (void)removeDataOfTypes:(web::BrowsingDataTypes)browsingDataTypes |
| 76 completionHandler:(ProceduralBlock)completionHandler; | 81 completionHandler:(ProceduralBlock)completionHandler; |
| 77 | 82 |
| 78 // Returns YES if there is still a pending operation that has not finished | 83 // Returns YES if there is still a pending operation that has not finished |
| 79 // running. Creating web views (UIWebViews and WKWebViews) with this | 84 // running. Creating web views (UIWebViews and WKWebViews) with this |
| 80 // CRWBrowsingDataStore when there are pending operations is undefined | 85 // CRWBrowsingDataStore when there are pending operations is undefined |
| 81 // behavior. | 86 // behavior. |
| 82 @property(nonatomic, assign, readonly) BOOL hasPendingOperations; | 87 @property(nonatomic, assign, readonly) BOOL hasPendingOperations; |
| 83 | 88 |
| 84 @end | 89 @end |
| 85 | 90 |
| 86 #endif // IOS_WEB_CRW_BROWSING_DATA_STORE_H_ | 91 #endif // IOS_WEB_CRW_BROWSING_DATA_STORE_H_ |
| OLD | NEW |