Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: ios/web/public/crw_browsing_data_store.h

Issue 1146223012: Cleaning up CRWBrowsingDataMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/crw_browsing_data_store_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #import "ios/web/public/crw_browsing_data_store_delegate.h" 11 #import "ios/web/public/crw_browsing_data_store_delegate.h"
12 12
13 namespace web { 13 namespace web {
14 class BrowserState; 14 class BrowserState;
15 15
16 // Represents the various kinds of browsing data that a CRWBrowsingDataStore 16 // Represents the various kinds of browsing data that a CRWBrowsingDataStore
17 // can handle. 17 // can handle.
18 typedef NS_OPTIONS(NSUInteger, BrowsingDataTypes) { 18 typedef NS_OPTIONS(NSUInteger, BrowsingDataTypes) {
19 // Represents the cookie browsing data that a web view stores. 19 // Represents the cookie browsing data that a web view stores.
20 BROWSING_DATA_TYPE_COOKIES = 1 << 0, 20 BROWSING_DATA_TYPE_COOKIES = 1 << 0,
21 // Represents all the browsing data that a web view stores. 21 // Represents all the browsing data that a web view stores.
22 BROWSING_DATA_TYPE_ALL = BROWSING_DATA_TYPE_COOKIES, 22 BROWSING_DATA_TYPE_ALL = BROWSING_DATA_TYPE_COOKIES,
23 }; 23 };
24 24
25 // Represents the modes that a CRWBrowsingDataStore can be in.
26 typedef NS_ENUM(NSUInteger, BrowsingDataStoreMode) {
27 // Web views (associated transitively through the BrowseState) are
28 // flushing/reading their data from disk.
29 ACTIVE = 1,
30 // The CRWBrowsingDataStore's mode is in the process of becoming either ACTIVE
31 // or INACTIVE.
32 CHANGING,
33 // Browsing data is stored in a path unique to the BrowserState and is
34 // currently not being read or written to by web views.
35 INACTIVE,
36 };
37
25 } // namespace web 38 } // namespace web
26 39
27 // Represents the modes that a CRWBrowsingDataStore is currently at.
28 enum CRWBrowsingDataStoreMode {
29 // Web views (associated transitively through the BrowseState) are
30 // flushing/reading their data from disk.
31 ACTIVE,
32 // The CRWBrowsingDataStore's mode is in the process of becoming either ACTIVE
33 // or INACTIVE.
34 SYNCHRONIZING,
35 // Browsing data is stored in a path unique to the BrowserState and is
36 // currently not being read or written to by web views.
37 INACTIVE
38 };
39
40 // A CRWBrowsingDataStore represents various types of data that a web view 40 // A CRWBrowsingDataStore represents various types of data that a web view
41 // (UIWebView and WKWebView) uses. 41 // (UIWebView and WKWebView) uses.
42 // All methods must be called on the UI thread. 42 // All methods must be called on the UI thread.
43 @interface CRWBrowsingDataStore : NSObject 43 @interface CRWBrowsingDataStore : NSObject
44 44
45 // Designated initializer. |browserState| cannot be null. 45 // Designated initializer. |browserState| cannot be null.
46 // The initial mode of the CRWBrowsingDataStore is obtained from the active 46 // The initial mode of the CRWBrowsingDataStore is obtained from the active
47 // state of the |web::ActiveStateManager| associated with |browserState|. 47 // state of the |web::ActiveStateManager| associated with |browserState|.
48 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState 48 - (instancetype)initWithBrowserState:(web::BrowserState*)browserState
49 NS_DESIGNATED_INITIALIZER; 49 NS_DESIGNATED_INITIALIZER;
50 50
51 // The delegate that is consulted when the mode needs to change. 51 // The delegate that is consulted when the mode needs to change.
52 @property(nonatomic, weak) id<CRWBrowsingDataStoreDelegate> delegate; 52 @property(nonatomic, weak) id<CRWBrowsingDataStoreDelegate> delegate;
53 53
54 // The mode that the CRWBrowsingDataStore is in. KVO compliant. 54 // The mode that the CRWBrowsingDataStore is in. KVO compliant.
55 @property(nonatomic, assign, readonly) CRWBrowsingDataStoreMode mode; 55 @property(nonatomic, assign, readonly) web::BrowsingDataStoreMode mode;
56 56
57 // TODO(shreyasv): Verify the preconditions for the following 3 methods when 57 // TODO(shreyasv): Verify the preconditions for the following 3 methods when
58 // web::WebViewCounter class is implemented. crbug.com/480507 58 // web::WebViewCounter class is implemented. crbug.com/480507
59 59
60 // Changes the mode to |ACTIVE|. 60 // Changes the mode to |ACTIVE|.
61 // if there is no delegate present, the default behavior of this method is to 61 // if there is no delegate present, the default behavior of this method is to
62 // restore browsing data from |browserState|'s stash path to the canonical path 62 // restore browsing data from |browserState|'s stash path to the canonical path
63 // where web views read/write browsing data to. 63 // where web views read/write browsing data to.
64 // |completionHandler| is called on the main thread. This block has no return 64 // |completionHandler| is called on the main thread. This block has no return
65 // value and takes a single BOOL argument that indicates whether or not the 65 // value and takes a single BOOL argument that indicates whether or not the
(...skipping 27 matching lines...) Expand all
93 93
94 // Returns YES if there is still a pending operation that has not finished 94 // Returns YES if there is still a pending operation that has not finished
95 // running. Creating web views (UIWebViews and WKWebViews) with this 95 // running. Creating web views (UIWebViews and WKWebViews) with this
96 // CRWBrowsingDataStore when there are pending operations is undefined 96 // CRWBrowsingDataStore when there are pending operations is undefined
97 // behavior. 97 // behavior.
98 @property(nonatomic, assign, readonly) BOOL hasPendingOperations; 98 @property(nonatomic, assign, readonly) BOOL hasPendingOperations;
99 99
100 @end 100 @end
101 101
102 #endif // IOS_WEB_CRW_BROWSING_DATA_STORE_H_ 102 #endif // IOS_WEB_CRW_BROWSING_DATA_STORE_H_
OLDNEW
« no previous file with comments | « ios/web/crw_browsing_data_store_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698