| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/linked_ptr.h" | 11 #include "base/linked_ptr.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 | 13 |
| 14 class FilePath; | 14 class FilePath; |
| 15 class Version; | 15 class Version; |
| 16 | 16 |
| 17 // This class is an abstract class for implementing external extensions | 17 // This class is an abstract class for implementing external extensions |
| 18 // providers. | 18 // providers. |
| 19 class ExternalExtensionProviderInterface { | 19 class ExternalExtensionProviderInterface { |
| 20 public: | 20 public: |
| 21 // ExternalExtensionProvider uses this interface to communicate back to the | 21 // ExternalExtensionProvider uses this interface to communicate back to the |
| 22 // caller what extensions are registered, and which |id|, |version| and |path| | 22 // caller what extensions are registered, and which |id|, |version| and |path| |
| 23 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 23 // they have. See also VisitRegisteredExtension below. Ownership of |version| |
| 24 // is not transferred to the visitor. | 24 // is not transferred to the visitor. Callers of the methods below must |
| 25 // ensure that |id| is a valid extension id (use Extension::IdIsValid(id)). |
| 25 class VisitorInterface { | 26 class VisitorInterface { |
| 26 public: | 27 public: |
| 27 virtual void OnExternalExtensionFileFound( | 28 virtual void OnExternalExtensionFileFound( |
| 28 const std::string& id, | 29 const std::string& id, |
| 29 const Version* version, | 30 const Version* version, |
| 30 const FilePath& path, | 31 const FilePath& path, |
| 31 Extension::Location location) = 0; | 32 Extension::Location location) = 0; |
| 32 | 33 |
| 33 virtual void OnExternalExtensionUpdateUrlFound( | 34 virtual void OnExternalExtensionUpdateUrlFound( |
| 34 const std::string& id, | 35 const std::string& id, |
| 35 const GURL& update_url, | 36 const GURL& update_url, |
| 36 Extension::Location location) = 0; | 37 Extension::Location location) = 0; |
| 37 | 38 |
| 38 // Called after all the external extensions have been reported through | 39 // Called after all the external extensions have been reported through |
| 39 // the above two methods. | 40 // the above two methods. |
| 40 virtual void OnExternalProviderReady() = 0; | 41 virtual void OnExternalProviderReady() = 0; |
| 41 | 42 |
| 42 protected: | 43 protected: |
| 43 virtual ~VisitorInterface() {} | 44 virtual ~VisitorInterface() {} |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 virtual ~ExternalExtensionProviderInterface() {} | 47 virtual ~ExternalExtensionProviderInterface() {} |
| 47 | 48 |
| 48 // The visitor (ExtensionsService) calls this function before it goes away. | 49 // The visitor (ExtensionsService) calls this function before it goes away. |
| 49 virtual void ServiceShutdown() = 0; | 50 virtual void ServiceShutdown() = 0; |
| 50 | 51 |
| 51 // Enumerate registered extensions, calling | 52 // Enumerate registered extensions, calling |
| 52 // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each | 53 // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each |
| 53 // registered extension found. | 54 // registered extension found. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 // Determines if this provider had loaded the list of external extensions | 68 // Determines if this provider had loaded the list of external extensions |
| 68 // from its source. | 69 // from its source. |
| 69 virtual bool IsReady() = 0; | 70 virtual bool IsReady() = 0; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 typedef std::vector<linked_ptr<ExternalExtensionProviderInterface> > | 73 typedef std::vector<linked_ptr<ExternalExtensionProviderInterface> > |
| 73 ProviderCollection; | 74 ProviderCollection; |
| 74 | 75 |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | 76 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ |
| OLD | NEW |