Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1049)

Side by Side Diff: chrome/browser/extensions/external_provider_interface.h

Issue 10692168: Moved ExternalExtensionLoaders/Providers into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/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 namespace extensions {
18
17 // This class is an abstract class for implementing external extensions 19 // This class is an abstract class for implementing external extensions
18 // providers. 20 // providers.
19 class ExternalExtensionProviderInterface { 21 class ExternalProviderInterface {
20 public: 22 public:
21 // ExternalExtensionProvider uses this interface to communicate back to the 23 // ExternalProvider uses this interface to communicate back to the
22 // caller what extensions are registered, and which |id|, |version| and |path| 24 // caller what extensions are registered, and which |id|, |version| and |path|
23 // they have. See also VisitRegisteredExtension below. Ownership of |version| 25 // they have. See also VisitRegisteredExtension below. Ownership of |version|
24 // is not transferred to the visitor. Callers of the methods below must 26 // 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)). 27 // ensure that |id| is a valid extension id (use Extension::IdIsValid(id)).
26 class VisitorInterface { 28 class VisitorInterface {
27 public: 29 public:
28 // Return true if the extension install will proceed. Install will not 30 // Return true if the extension install will proceed. Install will not
29 // proceed if the extension is already installed from a higher priority 31 // proceed if the extension is already installed from a higher priority
30 // location. 32 // location.
31 virtual bool OnExternalExtensionFileFound( 33 virtual bool OnExternalExtensionFileFound(
32 const std::string& id, 34 const std::string& id,
33 const Version* version, 35 const Version* version,
34 const FilePath& path, 36 const FilePath& path,
35 extensions::Extension::Location location, 37 Extension::Location location,
36 int creation_flags, 38 int creation_flags,
37 bool mark_acknowledged) = 0; 39 bool mark_acknowledged) = 0;
38 40
39 // Return true if the extension install will proceed. Install might not 41 // Return true if the extension install will proceed. Install might not
40 // proceed if the extension is already installed from a higher priority 42 // proceed if the extension is already installed from a higher priority
41 // location. 43 // location.
42 virtual bool OnExternalExtensionUpdateUrlFound( 44 virtual bool OnExternalExtensionUpdateUrlFound(
43 const std::string& id, 45 const std::string& id,
44 const GURL& update_url, 46 const GURL& update_url,
45 extensions::Extension::Location location) = 0; 47 Extension::Location location) = 0;
46 48
47 // Called after all the external extensions have been reported 49 // Called after all the external extensions have been reported
48 // through the above two methods. |provider| is a pointer to the 50 // through the above two methods. |provider| is a pointer to the
49 // provider that is now ready (typically this), and the 51 // provider that is now ready (typically this), and the
50 // implementation of OnExternalProviderReady() should be able to 52 // implementation of OnExternalProviderReady() should be able to
51 // safely assert that provider->IsReady(). 53 // safely assert that provider->IsReady().
52 virtual void OnExternalProviderReady( 54 virtual void OnExternalProviderReady(
53 const ExternalExtensionProviderInterface* provider) = 0; 55 const ExternalProviderInterface* provider) = 0;
Joao da Silva 2012/07/13 13:33:42 Nit: indent
Devlin 2012/07/13 16:31:17 Done.
54 56
55 protected: 57 protected:
56 virtual ~VisitorInterface() {} 58 virtual ~VisitorInterface() {}
57 }; 59 };
58 60
59 virtual ~ExternalExtensionProviderInterface() {} 61 virtual ~ExternalProviderInterface() {}
60 62
61 // The visitor (ExtensionsService) calls this function before it goes away. 63 // The visitor (ExtensionsService) calls this function before it goes away.
62 virtual void ServiceShutdown() = 0; 64 virtual void ServiceShutdown() = 0;
63 65
64 // Enumerate registered extensions, calling 66 // Enumerate registered extensions, calling
65 // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each 67 // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each
66 // registered extension found. 68 // registered extension found.
67 virtual void VisitRegisteredExtension() = 0; 69 virtual void VisitRegisteredExtension() = 0;
68 70
69 // Test if this provider has an extension with id |id| registered. 71 // Test if this provider has an extension with id |id| registered.
70 virtual bool HasExtension(const std::string& id) const = 0; 72 virtual bool HasExtension(const std::string& id) const = 0;
71 73
72 // Gets details of an extension by its id. Output params will be set only 74 // Gets details of an extension by its id. Output params will be set only
73 // if they are not NULL. If an output parameter is not specified by the 75 // if they are not NULL. If an output parameter is not specified by the
74 // provider type, it will not be changed. 76 // provider type, it will not be changed.
75 // This function is no longer used outside unit tests. 77 // This function is no longer used outside unit tests.
76 virtual bool GetExtensionDetails(const std::string& id, 78 virtual bool GetExtensionDetails(const std::string& id,
77 extensions::Extension::Location* location, 79 Extension::Location* location,
78 scoped_ptr<Version>* version) const = 0; 80 scoped_ptr<Version>* version) const = 0;
79 81
80 // Determines if this provider had loaded the list of external extensions 82 // Determines if this provider had loaded the list of external extensions
81 // from its source. 83 // from its source.
82 virtual bool IsReady() const = 0; 84 virtual bool IsReady() const = 0;
83 }; 85 };
84 86
85 typedef std::vector<linked_ptr<ExternalExtensionProviderInterface> > 87 typedef std::vector<linked_ptr<ExternalProviderInterface> >
86 ProviderCollection; 88 ProviderCollection;
87 89
88 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_ 90 } // namespace extensions
91
92 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_PROVIDER_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698