app_list: Re-enable people search.
[chromium-blink-merge.git] / chrome / browser / extensions / pending_enables.h
blobfb1a16be4e1258c3982a52f51486ec3ee00eb8e6
1 // Copyright 2013 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 CHROME_BROWSER_EXTENSIONS_PENDING_ENABLES_H_
6 #define CHROME_BROWSER_EXTENSIONS_PENDING_ENABLES_H_
8 #include <set>
10 // Included for syncer::ModelType, which is in
11 // sync/internal_api/public/base/model_type.h but that is disallowed by
12 // chrome/browser/DEPS.
13 #include "sync/api/syncable_service.h"
15 class ExtensionService;
16 class ProfileSyncService;
18 namespace sync_driver {
19 class SyncPrefs;
22 namespace extensions {
24 class SyncBundle;
26 // A pending enable is when an app or extension is enabled locally before sync
27 // has started. We track these to prevent sync data arriving and clobbering
28 // local state, and also to ensure that these early enables get synced to the
29 // server when sync does start.
30 class PendingEnables {
31 public:
32 PendingEnables(scoped_ptr<sync_driver::SyncPrefs> sync_prefs,
33 SyncBundle* sync_bundle,
34 syncer::ModelType enable_type);
35 ~PendingEnables();
37 // Called when an extension is enabled / disabled locally.
38 // These will check the sync state and figure out whether the change
39 // needs to be remembered for syncing when syncing starts.
40 void OnExtensionEnabled(const std::string& extension_id);
41 void OnExtensionDisabled(const std::string& extension_id);
43 // Called when |sync_bundle_| is ready to accept sync changes.
44 // Uses |service| to look up extensions from extension ids.
45 void OnSyncStarted(ExtensionService* service);
47 // Whether |extension_id| has a pending enable.
48 bool Contains(const std::string& extension_id) const;
50 private:
51 bool IsSyncEnabled();
52 bool IsWaitingForSync();
54 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_;
55 SyncBundle* sync_bundle_;
56 syncer::ModelType enable_type_;
57 std::set<std::string> ids_;
59 bool is_sync_enabled_for_test_;
61 DISALLOW_COPY_AND_ASSIGN(PendingEnables);
64 } // namespace extensions
66 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_ENABLES_H_