Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / extensions / extension_action_storage_manager.h
blob4409b12d4bf916be8069c1180f7070e71639422b
1 // Copyright 2014 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_EXTENSION_ACTION_STORAGE_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_STORAGE_MANAGER_H_
8 #include <string>
10 #include "base/memory/weak_ptr.h"
11 #include "base/scoped_observer.h"
12 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
13 #include "extensions/browser/extension_registry_observer.h"
15 class ExtensionAction;
17 namespace content {
18 class BrowserContext;
21 namespace extensions {
22 class ExtensionRegistry;
23 class StateStore;
25 // This class manages reading and writing browser action values from storage.
26 class ExtensionActionStorageManager : public ExtensionActionAPI::Observer,
27 public ExtensionRegistryObserver {
28 public:
29 explicit ExtensionActionStorageManager(content::BrowserContext* context);
30 ~ExtensionActionStorageManager() override;
32 private:
33 // ExtensionActionAPI::Observer:
34 void OnExtensionActionUpdated(
35 ExtensionAction* extension_action,
36 content::WebContents* web_contents,
37 content::BrowserContext* browser_context) override;
38 void OnExtensionActionAPIShuttingDown() override;
40 // ExtensionRegistryObserver:
41 void OnExtensionLoaded(content::BrowserContext* browser_context,
42 const Extension* extension) override;
44 // Reads/Writes the ExtensionAction's default values to/from storage.
45 void WriteToStorage(ExtensionAction* extension_action);
46 void ReadFromStorage(
47 const std::string& extension_id, scoped_ptr<base::Value> value);
49 // Returns the Extensions StateStore for the |browser_context_|.
50 // May return NULL.
51 StateStore* GetStateStore();
53 content::BrowserContext* browser_context_;
55 ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer>
56 extension_action_observer_;
58 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
59 extension_registry_observer_;
61 base::WeakPtrFactory<ExtensionActionStorageManager> weak_factory_;
63 DISALLOW_COPY_AND_ASSIGN(ExtensionActionStorageManager);
66 } // namespace extensions
68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_STORAGE_MANAGER_H_