OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_INSTALL_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Extension; | 22 class Extension; |
23 class ExtensionRegistry; | 23 class ExtensionRegistry; |
24 class ExtensionPrefs; | 24 class ExtensionPrefs; |
25 class ExternalInstallError; | 25 class ExternalInstallError; |
26 | 26 |
27 class ExternalInstallManager : public ExtensionRegistryObserver, | 27 class ExternalInstallManager : public ExtensionRegistryObserver, |
28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
29 public: | 29 public: |
30 ExternalInstallManager(content::BrowserContext* browser_context, | 30 ExternalInstallManager(content::BrowserContext* browser_context, |
31 bool is_first_run); | 31 bool is_first_run); |
32 virtual ~ExternalInstallManager(); | 32 ~ExternalInstallManager() override; |
33 | 33 |
34 // Removes the global error, if one existed. | 34 // Removes the global error, if one existed. |
35 void RemoveExternalInstallError(); | 35 void RemoveExternalInstallError(); |
36 | 36 |
37 // Returns true if there is a global error for an external install. | 37 // Returns true if there is a global error for an external install. |
38 bool HasExternalInstallError() const; | 38 bool HasExternalInstallError() const; |
39 | 39 |
40 // Checks if there are any new external extensions to notify the user about. | 40 // Checks if there are any new external extensions to notify the user about. |
41 void UpdateExternalExtensionAlert(); | 41 void UpdateExternalExtensionAlert(); |
42 | 42 |
43 // Given a (presumably just-installed) extension id, mark that extension as | 43 // Given a (presumably just-installed) extension id, mark that extension as |
44 // acknowledged. | 44 // acknowledged. |
45 void AcknowledgeExternalExtension(const std::string& extension_id); | 45 void AcknowledgeExternalExtension(const std::string& extension_id); |
46 | 46 |
47 // Returns true if there is a global error with a bubble view for an external | 47 // Returns true if there is a global error with a bubble view for an external |
48 // install. Used for testing. | 48 // install. Used for testing. |
49 bool HasExternalInstallBubbleForTesting() const; | 49 bool HasExternalInstallBubbleForTesting() const; |
50 | 50 |
51 // Returns the current install error, if one exists. | 51 // Returns the current install error, if one exists. |
52 const ExternalInstallError* error() { return error_.get(); } | 52 const ExternalInstallError* error() { return error_.get(); } |
53 | 53 |
54 // Returns a mutable copy of the error for testing purposes. | 54 // Returns a mutable copy of the error for testing purposes. |
55 ExternalInstallError* error_for_testing() { return error_.get(); } | 55 ExternalInstallError* error_for_testing() { return error_.get(); } |
56 | 56 |
57 private: | 57 private: |
58 // ExtensionRegistryObserver implementation. | 58 // ExtensionRegistryObserver implementation. |
59 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, | 59 void OnExtensionLoaded(content::BrowserContext* browser_context, |
60 const Extension* extension) override; | 60 const Extension* extension) override; |
61 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, | 61 void OnExtensionInstalled(content::BrowserContext* browser_context, |
62 const Extension* extension, | 62 const Extension* extension, |
63 bool is_update) override; | 63 bool is_update) override; |
64 virtual void OnExtensionUninstalled( | 64 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
65 content::BrowserContext* browser_context, | 65 const Extension* extension, |
66 const Extension* extension, | 66 extensions::UninstallReason reason) override; |
67 extensions::UninstallReason reason) override; | |
68 | 67 |
69 // content::NotificationObserver implementation. | 68 // content::NotificationObserver implementation. |
70 virtual void Observe(int type, | 69 void Observe(int type, |
71 const content::NotificationSource& source, | 70 const content::NotificationSource& source, |
72 const content::NotificationDetails& details) override; | 71 const content::NotificationDetails& details) override; |
73 | 72 |
74 // Adds a global error informing the user that an external extension was | 73 // Adds a global error informing the user that an external extension was |
75 // installed. If |is_new_profile| is true, then this error is from the first | 74 // installed. If |is_new_profile| is true, then this error is from the first |
76 // time our profile checked for new extensions. | 75 // time our profile checked for new extensions. |
77 void AddExternalInstallError(const Extension* extension, bool is_new_profile); | 76 void AddExternalInstallError(const Extension* extension, bool is_new_profile); |
78 | 77 |
79 // Returns true if this extension is an external one that has yet to be | 78 // Returns true if this extension is an external one that has yet to be |
80 // marked as acknowledged. | 79 // marked as acknowledged. |
81 bool IsUnacknowledgedExternalExtension(const Extension* extension) const; | 80 bool IsUnacknowledgedExternalExtension(const Extension* extension) const; |
82 | 81 |
(...skipping 13 matching lines...) Expand all Loading... |
96 | 95 |
97 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 96 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
98 extension_registry_observer_; | 97 extension_registry_observer_; |
99 | 98 |
100 DISALLOW_COPY_AND_ASSIGN(ExternalInstallManager); | 99 DISALLOW_COPY_AND_ASSIGN(ExternalInstallManager); |
101 }; | 100 }; |
102 | 101 |
103 } // namespace extensions | 102 } // namespace extensions |
104 | 103 |
105 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_ |
OLD | NEW |