| OLD | NEW |
| 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_PENDING_EXTENSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/extensions/pending_extension_info.h" | 11 #include "chrome/browser/extensions/pending_extension_info.h" |
| 12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
| 13 #include "chrome/common/extensions/manifest.h" | 13 #include "chrome/common/extensions/manifest.h" |
| 14 | 14 |
| 15 class ExtensionServiceInterface; | 15 class ExtensionServiceInterface; |
| 16 class GURL; | 16 class GURL; |
| 17 class PendingExtensionManager; | 17 class PendingExtensionManager; |
| 18 |
| 19 namespace base { |
| 18 class Version; | 20 class Version; |
| 21 } |
| 19 | 22 |
| 20 FORWARD_DECLARE_TEST(ExtensionServiceTest, | 23 FORWARD_DECLARE_TEST(ExtensionServiceTest, |
| 21 UpdatePendingExtensionAlreadyInstalled); | 24 UpdatePendingExtensionAlreadyInstalled); |
| 22 | 25 |
| 23 namespace extensions { | 26 namespace extensions { |
| 24 class ExtensionUpdaterTest; | 27 class ExtensionUpdaterTest; |
| 25 void SetupPendingExtensionManagerForTest( | 28 void SetupPendingExtensionManagerForTest( |
| 26 int count, const GURL& update_url, | 29 int count, const GURL& update_url, |
| 27 PendingExtensionManager* pending_extension_manager); | 30 PendingExtensionManager* pending_extension_manager); |
| 28 | 31 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 bool AddFromExternalUpdateUrl(const std::string& id, | 85 bool AddFromExternalUpdateUrl(const std::string& id, |
| 83 const GURL& update_url, | 86 const GURL& update_url, |
| 84 Manifest::Location location); | 87 Manifest::Location location); |
| 85 | 88 |
| 86 // Add a pending extension record for an external CRX file. | 89 // Add a pending extension record for an external CRX file. |
| 87 // Return true if the CRX should be installed, false if an existing | 90 // Return true if the CRX should be installed, false if an existing |
| 88 // pending record overrides it. | 91 // pending record overrides it. |
| 89 bool AddFromExternalFile( | 92 bool AddFromExternalFile( |
| 90 const std::string& id, | 93 const std::string& id, |
| 91 Manifest::Location location, | 94 Manifest::Location location, |
| 92 const Version& version); | 95 const base::Version& version); |
| 93 | 96 |
| 94 // Get the list of pending IDs that should be installed from an update URL. | 97 // Get the list of pending IDs that should be installed from an update URL. |
| 95 // Pending extensions that will be installed from local files will not be | 98 // Pending extensions that will be installed from local files will not be |
| 96 // included in the set. | 99 // included in the set. |
| 97 void GetPendingIdsForUpdateCheck( | 100 void GetPendingIdsForUpdateCheck( |
| 98 std::list<std::string>* out_ids_for_update_check) const; | 101 std::list<std::string>* out_ids_for_update_check) const; |
| 99 | 102 |
| 100 private: | 103 private: |
| 101 typedef std::list<PendingExtensionInfo> PendingExtensionList; | 104 typedef std::list<PendingExtensionInfo> PendingExtensionList; |
| 102 | 105 |
| 103 // Assumes an extension with id |id| is not already installed. | 106 // Assumes an extension with id |id| is not already installed. |
| 104 // Return true if the extension was added. | 107 // Return true if the extension was added. |
| 105 bool AddExtensionImpl( | 108 bool AddExtensionImpl( |
| 106 const std::string& id, | 109 const std::string& id, |
| 107 const GURL& update_url, | 110 const GURL& update_url, |
| 108 const Version& version, | 111 const base::Version& version, |
| 109 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, | 112 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, |
| 110 bool is_from_sync, | 113 bool is_from_sync, |
| 111 bool install_silently, | 114 bool install_silently, |
| 112 Manifest::Location install_source); | 115 Manifest::Location install_source); |
| 113 | 116 |
| 114 // Add a pending extension record directly. Used for unit tests that need | 117 // Add a pending extension record directly. Used for unit tests that need |
| 115 // to set an inital state. Use friendship to allow the tests to call this | 118 // to set an inital state. Use friendship to allow the tests to call this |
| 116 // method. | 119 // method. |
| 117 void AddForTesting(const PendingExtensionInfo& pending_extension_info); | 120 void AddForTesting(const PendingExtensionInfo& pending_extension_info); |
| 118 | 121 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 130 friend void SetupPendingExtensionManagerForTest( | 133 friend void SetupPendingExtensionManagerForTest( |
| 131 int count, const GURL& update_url, | 134 int count, const GURL& update_url, |
| 132 PendingExtensionManager* pending_extension_manager); | 135 PendingExtensionManager* pending_extension_manager); |
| 133 | 136 |
| 134 DISALLOW_COPY_AND_ASSIGN(PendingExtensionManager); | 137 DISALLOW_COPY_AND_ASSIGN(PendingExtensionManager); |
| 135 }; | 138 }; |
| 136 | 139 |
| 137 } // namespace extensions | 140 } // namespace extensions |
| 138 | 141 |
| 139 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ | 142 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_MANAGER_H_ |
| OLD | NEW |