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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_BROWSING_DATA_PARTITION_IMPL_H_
6 #define IOS_WEB_BROWSING_DATA_PARTITION_IMPL_H_
8 #import "base/mac/scoped_nsobject.h"
9 #include "base/macros.h"
10 #include "base/supports_user_data.h"
11 #include "ios/web/public/active_state_manager.h"
12 #include "ios/web/public/browsing_data_partition.h"
14 @
class CRWBrowsingDataStore
;
20 // Concrete subclass of web::BrowsingDataPartition. Observes
21 // ActiveStateManager::Observer methods to trigger stash/restore operations
22 // on the underlying CRWBrowsingDataStore.
23 class BrowsingDataPartitionImpl
: public BrowsingDataPartition
,
24 public base::SupportsUserData::Data
,
25 public web::ActiveStateManager::Observer
{
27 explicit BrowsingDataPartitionImpl(BrowserState
* browser_state
);
28 ~BrowsingDataPartitionImpl() override
;
30 // BrowsingDataPartition implementation.
31 CRWBrowsingDataStore
* GetBrowsingDataStore() override
;
33 // ActiveStateManager::Observer implementation.
34 void OnActive() override
;
35 void OnInactive() override
;
36 void WillBeDestroyed() override
;
39 BrowserState
* browser_state_
; // weak, owns this object.
40 // The browsing data store backing this object.
41 base::scoped_nsobject
<CRWBrowsingDataStore
> browsing_data_store_
;
42 // Weak pointer to the associated active state manager.
43 ActiveStateManager
* active_state_manager_
;
45 DISALLOW_COPY_AND_ASSIGN(BrowsingDataPartitionImpl
);
50 #endif // IOS_WEB_BROWSING_DATA_PARTITION_IMPL_H_