OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
13 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 13 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
14 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 14 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
15 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 15 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
16 #include "chrome/browser/extensions/chrome_extension_function.h" | 16 #include "chrome/browser/extensions/chrome_extension_function.h" |
17 #include "chrome/browser/extensions/error_console/error_console.h" | 17 #include "chrome/browser/extensions/error_console/error_console.h" |
| 18 #include "chrome/browser/extensions/extension_management.h" |
18 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 19 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
19 #include "chrome/browser/extensions/pack_extension_job.h" | 20 #include "chrome/browser/extensions/pack_extension_job.h" |
20 #include "chrome/common/extensions/api/developer_private.h" | 21 #include "chrome/common/extensions/api/developer_private.h" |
21 #include "chrome/common/extensions/webstore_install_result.h" | 22 #include "chrome/common/extensions/webstore_install_result.h" |
22 #include "extensions/browser/app_window/app_window_registry.h" | 23 #include "extensions/browser/app_window/app_window_registry.h" |
23 #include "extensions/browser/browser_context_keyed_api_factory.h" | 24 #include "extensions/browser/browser_context_keyed_api_factory.h" |
24 #include "extensions/browser/event_router.h" | 25 #include "extensions/browser/event_router.h" |
| 26 #include "extensions/browser/extension_prefs_observer.h" |
25 #include "extensions/browser/extension_registry_observer.h" | 27 #include "extensions/browser/extension_registry_observer.h" |
26 #include "extensions/browser/process_manager_observer.h" | 28 #include "extensions/browser/process_manager_observer.h" |
| 29 #include "extensions/browser/warning_service.h" |
27 #include "storage/browser/fileapi/file_system_context.h" | 30 #include "storage/browser/fileapi/file_system_context.h" |
28 #include "storage/browser/fileapi/file_system_operation.h" | 31 #include "storage/browser/fileapi/file_system_operation.h" |
29 #include "ui/shell_dialogs/select_file_dialog.h" | 32 #include "ui/shell_dialogs/select_file_dialog.h" |
30 | 33 |
31 class Profile; | 34 class Profile; |
32 | 35 |
33 namespace extensions { | 36 namespace extensions { |
34 | 37 |
35 class EventRouter; | 38 class EventRouter; |
36 class ExtensionError; | 39 class ExtensionError; |
37 class ExtensionInfoGenerator; | 40 class ExtensionInfoGenerator; |
38 class ExtensionRegistry; | 41 class ExtensionRegistry; |
39 class ExtensionSystem; | 42 class ExtensionSystem; |
40 class ManagementPolicy; | 43 class ManagementPolicy; |
41 class ProcessManager; | 44 class ProcessManager; |
42 class RequirementsChecker; | 45 class RequirementsChecker; |
43 | 46 |
44 namespace api { | 47 namespace api { |
45 | 48 |
46 class EntryPicker; | 49 class EntryPicker; |
47 class EntryPickerClient; | 50 class EntryPickerClient; |
48 | 51 |
49 } // namespace api | 52 } // namespace api |
50 | 53 |
51 class DeveloperPrivateEventRouter : public ExtensionRegistryObserver, | 54 class DeveloperPrivateEventRouter : public ExtensionRegistryObserver, |
52 public ErrorConsole::Observer, | 55 public ErrorConsole::Observer, |
53 public ProcessManagerObserver, | 56 public ProcessManagerObserver, |
54 public AppWindowRegistry::Observer, | 57 public AppWindowRegistry::Observer, |
55 public ExtensionActionAPI::Observer { | 58 public ExtensionActionAPI::Observer, |
| 59 public ExtensionPrefsObserver, |
| 60 public ExtensionManagement::Observer, |
| 61 public WarningService::Observer { |
56 public: | 62 public: |
57 explicit DeveloperPrivateEventRouter(Profile* profile); | 63 explicit DeveloperPrivateEventRouter(Profile* profile); |
58 ~DeveloperPrivateEventRouter() override; | 64 ~DeveloperPrivateEventRouter() override; |
59 | 65 |
60 // Add or remove an ID to the list of extensions subscribed to events. | 66 // Add or remove an ID to the list of extensions subscribed to events. |
61 void AddExtensionId(const std::string& extension_id); | 67 void AddExtensionId(const std::string& extension_id); |
62 void RemoveExtensionId(const std::string& extension_id); | 68 void RemoveExtensionId(const std::string& extension_id); |
63 | 69 |
64 private: | 70 private: |
65 // ExtensionRegistryObserver: | 71 // ExtensionRegistryObserver: |
(...skipping 22 matching lines...) Expand all Loading... |
88 content::RenderFrameHost* render_frame_host) override; | 94 content::RenderFrameHost* render_frame_host) override; |
89 | 95 |
90 // AppWindowRegistry::Observer: | 96 // AppWindowRegistry::Observer: |
91 void OnAppWindowAdded(AppWindow* window) override; | 97 void OnAppWindowAdded(AppWindow* window) override; |
92 void OnAppWindowRemoved(AppWindow* window) override; | 98 void OnAppWindowRemoved(AppWindow* window) override; |
93 | 99 |
94 // ExtensionActionAPI::Observer: | 100 // ExtensionActionAPI::Observer: |
95 void OnExtensionActionVisibilityChanged(const std::string& extension_id, | 101 void OnExtensionActionVisibilityChanged(const std::string& extension_id, |
96 bool is_now_visible) override; | 102 bool is_now_visible) override; |
97 | 103 |
| 104 // ExtensionPrefsObserver: |
| 105 void OnExtensionDisableReasonsChanged(const std::string& extension_id, |
| 106 int disable_reasons) override; |
| 107 |
| 108 // ExtensionManagement::Observer: |
| 109 void OnExtensionManagementSettingsChanged() override; |
| 110 |
| 111 // WarningService::Observer: |
| 112 void ExtensionWarningsChanged( |
| 113 const std::set<std::string>& affected_extensions) override; |
| 114 |
98 // Broadcasts an event to all listeners. | 115 // Broadcasts an event to all listeners. |
99 void BroadcastItemStateChanged(api::developer_private::EventType event_type, | 116 void BroadcastItemStateChanged(api::developer_private::EventType event_type, |
100 const std::string& id); | 117 const std::string& id); |
101 void BroadcastItemStateChangedHelper( | 118 void BroadcastItemStateChangedHelper( |
102 api::developer_private::EventType event_type, | 119 api::developer_private::EventType event_type, |
103 const std::string& extension_id, | 120 const std::string& extension_id, |
104 scoped_ptr<ExtensionInfoGenerator> info_generator, | 121 scoped_ptr<ExtensionInfoGenerator> info_generator, |
105 const std::vector<linked_ptr<api::developer_private::ExtensionInfo>>& | 122 const std::vector<linked_ptr<api::developer_private::ExtensionInfo>>& |
106 infos); | 123 infos); |
107 | 124 |
108 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 125 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
109 extension_registry_observer_; | 126 extension_registry_observer_; |
110 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; | 127 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; |
111 ScopedObserver<ProcessManager, ProcessManagerObserver> | 128 ScopedObserver<ProcessManager, ProcessManagerObserver> |
112 process_manager_observer_; | 129 process_manager_observer_; |
113 ScopedObserver<AppWindowRegistry, AppWindowRegistry::Observer> | 130 ScopedObserver<AppWindowRegistry, AppWindowRegistry::Observer> |
114 app_window_registry_observer_; | 131 app_window_registry_observer_; |
115 ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer> | 132 ScopedObserver<ExtensionActionAPI, ExtensionActionAPI::Observer> |
116 extension_action_api_observer_; | 133 extension_action_api_observer_; |
| 134 ScopedObserver<WarningService, WarningService::Observer> |
| 135 warning_service_observer_; |
| 136 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> |
| 137 extension_prefs_observer_; |
| 138 ScopedObserver<ExtensionManagement, ExtensionManagement::Observer> |
| 139 extension_management_observer_; |
117 | 140 |
118 Profile* profile_; | 141 Profile* profile_; |
119 | 142 |
120 EventRouter* event_router_; | 143 EventRouter* event_router_; |
121 | 144 |
122 // The set of IDs of the Extensions that have subscribed to DeveloperPrivate | 145 // The set of IDs of the Extensions that have subscribed to DeveloperPrivate |
123 // events. Since the only consumer of the DeveloperPrivate API is currently | 146 // events. Since the only consumer of the DeveloperPrivate API is currently |
124 // the Apps Developer Tool (which replaces the chrome://extensions page), we | 147 // the Apps Developer Tool (which replaces the chrome://extensions page), we |
125 // don't want to send information about the subscribing extension in an | 148 // don't want to send information about the subscribing extension in an |
126 // update. In particular, we want to avoid entering a loop, which could happen | 149 // update. In particular, we want to avoid entering a loop, which could happen |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 protected: | 569 protected: |
547 ~DeveloperPrivateShowPathFunction() override; | 570 ~DeveloperPrivateShowPathFunction() override; |
548 ResponseAction Run() override; | 571 ResponseAction Run() override; |
549 }; | 572 }; |
550 | 573 |
551 } // namespace api | 574 } // namespace api |
552 | 575 |
553 } // namespace extensions | 576 } // namespace extensions |
554 | 577 |
555 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ | 578 #endif // CHROME_BROWSER_EXTENSIONS_API_DEVELOPER_PRIVATE_DEVELOPER_PRIVATE_API
_H_ |
OLD | NEW |