| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/task.h" | 15 #include "base/task.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 | 17 |
| 18 class Browser; | 18 class Browser; |
| 19 class Extension; | 19 class Extension; |
| 20 class ExtensionsServiceBackend; | 20 class ExtensionsServiceBackend; |
| 21 class GURL; | 21 class GURL; |
| 22 class PrefService; | 22 class PrefService; |
| 23 class Profile; | 23 class Profile; |
| 24 class ResourceDispatcherHost; | 24 class ResourceDispatcherHost; |
| 25 class SkBitmap; |
| 25 class SiteInstance; | 26 class SiteInstance; |
| 26 class UserScriptMaster; | 27 class UserScriptMaster; |
| 27 typedef std::vector<Extension*> ExtensionList; | 28 typedef std::vector<Extension*> ExtensionList; |
| 28 | 29 |
| 29 // Manages installed and running Chromium extensions. | 30 // Manages installed and running Chromium extensions. |
| 30 class ExtensionsService | 31 class ExtensionsService |
| 31 : public base::RefCountedThreadSafe<ExtensionsService> { | 32 : public base::RefCountedThreadSafe<ExtensionsService> { |
| 32 public: | 33 public: |
| 33 ExtensionsService(Profile* profile, | 34 ExtensionsService(Profile* profile, |
| 34 MessageLoop* frontend_loop, | 35 MessageLoop* frontend_loop, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // ie the Windows registry, and will be marked as such. If the extension is | 165 // ie the Windows registry, and will be marked as such. If the extension is |
| 165 // already installed, install the new version only if its version number is | 166 // already installed, install the new version only if its version number is |
| 166 // greater than the current installed version. | 167 // greater than the current installed version. |
| 167 void InstallOrUpdateExtension(const FilePath& extension_path, | 168 void InstallOrUpdateExtension(const FilePath& extension_path, |
| 168 const std::string& expected_id, | 169 const std::string& expected_id, |
| 169 bool from_external); | 170 bool from_external); |
| 170 | 171 |
| 171 // Finish installing an extension after it has been unpacked to | 172 // Finish installing an extension after it has been unpacked to |
| 172 // |temp_extension_dir| by our utility process. If |expected_id| is not | 173 // |temp_extension_dir| by our utility process. If |expected_id| is not |
| 173 // empty, it's verified against the extension's manifest before installation. | 174 // empty, it's verified against the extension's manifest before installation. |
| 174 void OnExtensionUnpacked(const FilePath& extension_path, | 175 // |manifest| and |images| are parsed information from the extension that |
| 175 const FilePath& temp_extension_dir, | 176 // we want to write to disk in the browser process. |
| 176 const std::string expected_id, | 177 void OnExtensionUnpacked( |
| 177 bool from_external); | 178 const FilePath& extension_path, |
| 179 const FilePath& temp_extension_dir, |
| 180 const std::string expected_id, |
| 181 bool from_external, |
| 182 const DictionaryValue& manifest, |
| 183 const std::vector< Tuple2<SkBitmap, FilePath> >& images); |
| 178 | 184 |
| 179 // Notify the frontend that there was an error loading an extension. | 185 // Notify the frontend that there was an error loading an extension. |
| 180 void ReportExtensionLoadError(const FilePath& extension_path, | 186 void ReportExtensionLoadError(const FilePath& extension_path, |
| 181 const std::string& error); | 187 const std::string& error); |
| 182 | 188 |
| 183 // Notify the frontend that extensions were loaded. | 189 // Notify the frontend that extensions were loaded. |
| 184 void ReportExtensionsLoaded(ExtensionList* extensions); | 190 void ReportExtensionsLoaded(ExtensionList* extensions); |
| 185 | 191 |
| 186 // Notify the frontend that there was an error installing an extension. | 192 // Notify the frontend that there was an error installing an extension. |
| 187 void ReportExtensionInstallError(const FilePath& extension_path, | 193 void ReportExtensionInstallError(const FilePath& extension_path, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 250 |
| 245 // The path to look for externally registered extensions in. This is a | 251 // The path to look for externally registered extensions in. This is a |
| 246 // registry key on windows, but it could be a similar string for the | 252 // registry key on windows, but it could be a similar string for the |
| 247 // appropriate system on other platforms in the future. | 253 // appropriate system on other platforms in the future. |
| 248 std::string registry_path_; | 254 std::string registry_path_; |
| 249 | 255 |
| 250 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 256 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 251 }; | 257 }; |
| 252 | 258 |
| 253 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 259 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |