| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/linked_ptr.h" | 15 #include "base/linked_ptr.h" |
| 16 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
| 17 #include "base/tuple.h" | 17 #include "base/tuple.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "chrome/browser/extensions/extension_prefs.h" | 19 #include "chrome/browser/extensions/extension_prefs.h" |
| 20 #include "chrome/browser/extensions/extension_process_manager.h" |
| 20 #include "chrome/browser/extensions/external_extension_provider.h" | 21 #include "chrome/browser/extensions/external_extension_provider.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 | 23 |
| 23 class Browser; | 24 class Browser; |
| 24 class DictionaryValue; | 25 class DictionaryValue; |
| 25 class Extension; | 26 class Extension; |
| 26 class ExtensionsServiceBackend; | 27 class ExtensionsServiceBackend; |
| 27 class GURL; | 28 class GURL; |
| 28 class MessageLoop; | 29 class MessageLoop; |
| 29 class PrefService; | 30 class PrefService; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void set_show_extensions_prompts(bool enabled) { | 141 void set_show_extensions_prompts(bool enabled) { |
| 141 show_extensions_prompts_ = enabled; | 142 show_extensions_prompts_ = enabled; |
| 142 } | 143 } |
| 143 | 144 |
| 144 bool show_extensions_prompts() { | 145 bool show_extensions_prompts() { |
| 145 return show_extensions_prompts_; | 146 return show_extensions_prompts_; |
| 146 } | 147 } |
| 147 | 148 |
| 148 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 149 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } |
| 149 | 150 |
| 151 ExtensionProcessManager* extension_process_manager() { |
| 152 return extension_process_manager_.get(); |
| 153 } |
| 154 |
| 150 // Whether the extension service is ready. | 155 // Whether the extension service is ready. |
| 151 bool is_ready() { return ready_; } | 156 bool is_ready() { return ready_; } |
| 152 | 157 |
| 153 private: | 158 private: |
| 154 // For OnExtensionLoaded, OnExtensionInstalled, and | 159 // For OnExtensionLoaded, OnExtensionInstalled, and |
| 155 // OnExtensionVersionReinstalled. | 160 // OnExtensionVersionReinstalled. |
| 156 friend class ExtensionsServiceBackend; | 161 friend class ExtensionsServiceBackend; |
| 157 | 162 |
| 158 // Called by the backend when the initial extension load has completed. | 163 // Called by the backend when the initial extension load has completed. |
| 159 void OnLoadedInstalledExtensions(); | 164 void OnLoadedInstalledExtensions(); |
| 160 | 165 |
| 161 // Called by the backend when extensions have been loaded. | 166 // Called by the backend when extensions have been loaded. |
| 162 void OnExtensionsLoaded(ExtensionList* extensions); | 167 void OnExtensionsLoaded(ExtensionList* extensions); |
| 163 | 168 |
| 164 // Called by the backend when an extensoin hsa been installed. | 169 // Called by the backend when an extensoin hsa been installed. |
| 165 void OnExtensionInstalled(Extension* extension, | 170 void OnExtensionInstalled(Extension* extension, |
| 166 Extension::InstallType install_type); | 171 Extension::InstallType install_type); |
| 167 | 172 |
| 168 // Called by the backend when an attempt was made to reinstall the same | 173 // Called by the backend when an attempt was made to reinstall the same |
| 169 // version of an existing extension. | 174 // version of an existing extension. |
| 170 void OnExtensionOverinstallAttempted(const std::string& id); | 175 void OnExtensionOverinstallAttempted(const std::string& id); |
| 171 | 176 |
| 172 // The name of the directory inside the profile where extensions are | 177 // The name of the directory inside the profile where extensions are |
| 173 // installed to. | 178 // installed to. |
| 174 static const char* kInstallDirectoryName; | 179 static const char* kInstallDirectoryName; |
| 175 | 180 |
| 176 // Preferences for the owning profile. | 181 // Preferences for the owning profile. |
| 177 scoped_ptr<ExtensionPrefs> extension_prefs_; | 182 scoped_ptr<ExtensionPrefs> extension_prefs_; |
| 178 | 183 |
| 184 // Controls how the various extension processes get created and destroyed. |
| 185 scoped_ptr<ExtensionProcessManager> extension_process_manager_; |
| 186 |
| 179 // The message loop to use with the backend. | 187 // The message loop to use with the backend. |
| 180 MessageLoop* backend_loop_; | 188 MessageLoop* backend_loop_; |
| 181 | 189 |
| 182 // The current list of installed extensions. | 190 // The current list of installed extensions. |
| 183 ExtensionList extensions_; | 191 ExtensionList extensions_; |
| 184 | 192 |
| 185 // The full path to the directory where extensions are installed. | 193 // The full path to the directory where extensions are installed. |
| 186 FilePath install_directory_; | 194 FilePath install_directory_; |
| 187 | 195 |
| 188 // Whether or not extensions are enabled. | 196 // Whether or not extensions are enabled. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 419 |
| 412 // A map of all external extension providers. | 420 // A map of all external extension providers. |
| 413 typedef std::map<Extension::Location, | 421 typedef std::map<Extension::Location, |
| 414 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 422 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 415 ProviderMap external_extension_providers_; | 423 ProviderMap external_extension_providers_; |
| 416 | 424 |
| 417 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 425 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 418 }; | 426 }; |
| 419 | 427 |
| 420 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 428 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |