Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2009 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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | 
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/linked_ptr.h" | |
| 9 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" | 
| 10 | 13 | 
| 11 class FilePath; | 14 class FilePath; | 
| 12 class Version; | 15 class Version; | 
| 13 | 16 | 
| 14 // This class is an abstract class for implementing external extensions | 17 // This class is an abstract class for implementing external extensions | 
| 15 // providers. | 18 // providers. | 
| 16 class ExternalExtensionProvider { | 19 class ExternalExtensionProviderInterface { | 
| 
 
Aaron Boodman
2011/01/06 18:54:40
We don't typically use the 'Interface' suffix in C
 
gfeher
2011/01/07 00:10:01
According to the Chromium style guide, I should ei
 
 | |
| 17 public: | 20 public: | 
| 18 // ExternalExtensionProvider uses this interface to communicate back to the | 21 // ExternalExtensionProvider uses this interface to communicate back to the | 
| 19 // caller what extensions are registered, and which |id|, |version| and |path| | 22 // caller what extensions are registered, and which |id|, |version| and |path| | 
| 20 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 23 // they have. See also VisitRegisteredExtension below. Ownership of |version| | 
| 21 // is not transferred to the visitor. | 24 // is not transferred to the visitor. | 
| 22 class Visitor { | 25 class VisitorInterface { | 
| 23 public: | 26 public: | 
| 24 virtual void OnExternalExtensionFileFound( | 27 virtual void OnExternalExtensionFileFound( | 
| 25 const std::string& id, | 28 const std::string& id, | 
| 26 const Version* version, | 29 const Version* version, | 
| 27 const FilePath& path, | 30 const FilePath& path, | 
| 28 Extension::Location location) = 0; | 31 Extension::Location location) = 0; | 
| 29 | 32 | 
| 30 virtual void OnExternalExtensionUpdateUrlFound( | 33 virtual void OnExternalExtensionUpdateUrlFound( | 
| 31 const std::string& id, | 34 const std::string& id, | 
| 32 const GURL& update_url, | 35 const GURL& update_url, | 
| 33 Extension::Location location) = 0; | 36 Extension::Location location) = 0; | 
| 34 | 37 | 
| 38 // Called after all the external extensions have been reported through | |
| 39 // the above two methods. | |
| 40 virtual void OnExternalProviderReady() = 0; | |
| 41 | |
| 35 protected: | 42 protected: | 
| 36 virtual ~Visitor() {} | 43 virtual ~VisitorInterface() {} | 
| 37 }; | 44 }; | 
| 38 | 45 | 
| 39 virtual ~ExternalExtensionProvider() {} | 46 virtual ~ExternalExtensionProviderInterface() {} | 
| 40 | 47 | 
| 41 // Enumerate registered extension, calling OnExternalExtensionFound on | 48 // The visitor (ExtensionsService) calls this function before it goes away. | 
| 42 // the |visitor| object for each registered extension found. |ids_to_ignore| | 49 virtual void ServiceShutdown() = 0; | 
| 43 // contains a list of extension ids that should not result in a call back. | 50 | 
| 44 virtual void VisitRegisteredExtension(Visitor* visitor) const = 0; | 51 // Enumerate registered extensions, calling | 
| 52 // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each | |
| 53 // registered extension found. | |
| 54 virtual void VisitRegisteredExtension() const = 0; | |
| 45 | 55 | 
| 46 // Test if this provider has an extension with id |id| registered. | 56 // Test if this provider has an extension with id |id| registered. | 
| 47 virtual bool HasExtension(const std::string& id) const = 0; | 57 virtual bool HasExtension(const std::string& id) const = 0; | 
| 48 | 58 | 
| 49 // Gets details of an extension by its id. Output params will be set only | 59 // Gets details of an extension by its id. Output params will be set only | 
| 50 // if they are not NULL. If an output parameter is not specified by the | 60 // if they are not NULL. If an output parameter is not specified by the | 
| 51 // provider type, it will not be changed. | 61 // provider type, it will not be changed. | 
| 52 // This function is no longer used outside unit tests. | 62 // This function is no longer used outside unit tests. | 
| 53 virtual bool GetExtensionDetails(const std::string& id, | 63 virtual bool GetExtensionDetails(const std::string& id, | 
| 54 Extension::Location* location, | 64 Extension::Location* location, | 
| 55 scoped_ptr<Version>* version) const = 0; | 65 scoped_ptr<Version>* version) const = 0; | 
| 66 | |
| 67 // Determines if this provider had loaded the list of external extensions | |
| 68 // from its source. | |
| 69 virtual bool IsReady() = 0; | |
| 56 }; | 70 }; | 
| 57 | 71 | 
| 58 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_ | 72 typedef std::vector<linked_ptr<ExternalExtensionProviderInterface> > | 
| 73 ProviderCollection; | |
| 74 | |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ | |
| OLD | NEW |