summaryrefslogtreecommitdiffstats
path: root/components/component_updater/component_updater_service.h
diff options
context:
space:
mode:
authorsorin <sorin@chromium.org>2015-01-23 17:15:00 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-24 01:16:25 +0000
commit52ac088530b109fa506c4491aea8cf12bcadc63d (patch)
tree64a47ef9e8d4e4662e7366aaea856b9da32ff168 /components/component_updater/component_updater_service.h
parent9d3bb0c75ddbeafd53f5ad32813b0fe70b7e0779 (diff)
downloadchromium_src-52ac088530b109fa506c4491aea8cf12bcadc63d.zip
chromium_src-52ac088530b109fa506c4491aea8cf12bcadc63d.tar.gz
chromium_src-52ac088530b109fa506c4491aea8cf12bcadc63d.tar.bz2
This is a mechanical change. It is large but straightforward in its intention.
jam: please review the changes under //src/chrome/browser blundell: please review the changes under //src/components waffles: please review the component updater and the update client changes. The intention here is to move most of the component updater dependencies to update_client, with the goal of creating an update_client Chrome component that encapsulates the details of talking with the update servers, downloading, and invoking installers of CRXs for both extensions and components. The dependencies should be: component_updater->update_client. This change just lays down some of the code that will be further used by update_client. No functionality is provided in this change. Also consider the overall goal as WIP; therefore, some of the naming and dependencies are not final. We want to have most of the code in place for future work, but want to minimize the changes to the existing production code and keep the refactoring mechanical for this change. BUG=450337 Review URL: https://codereview.chromium.org/808773005 Cr-Commit-Position: refs/heads/master@{#312986}
Diffstat (limited to 'components/component_updater/component_updater_service.h')
-rw-r--r--components/component_updater/component_updater_service.h73
1 files changed, 16 insertions, 57 deletions
diff --git a/components/component_updater/component_updater_service.h b/components/component_updater/component_updater_service.h
index b418e2d..5670619 100644
--- a/components/component_updater/component_updater_service.h
+++ b/components/component_updater/component_updater_service.h
@@ -24,70 +24,26 @@ class FilePath;
class SequencedTaskRunner;
}
+namespace content {
+class ResourceThrottle;
+}
+
namespace net {
class URLRequestContextGetter;
class URLRequest;
}
-namespace content {
-class ResourceThrottle;
+namespace update_client {
+class ComponentInstaller;
+class Configurator;
+struct CrxComponent;
+struct CrxUpdateItem;
}
namespace component_updater {
-class Configurator;
class OnDemandUpdater;
-// Component specific installers must derive from this class and implement
-// OnUpdateError() and Install(). A valid instance of this class must be
-// given to ComponentUpdateService::RegisterComponent().
-class ComponentInstaller {
- public:
- // Called by the component updater on the main thread when there was a
- // problem unpacking or verifying the component. |error| is a non-zero
- // value which is only meaningful to the component updater.
- virtual void OnUpdateError(int error) = 0;
-
- // Called by the component updater when a component has been unpacked
- // and is ready to be installed. |manifest| contains the CRX manifest
- // json dictionary and |unpack_path| contains the temporary directory
- // with all the unpacked CRX files. This method may be called from
- // a thread other than the main thread.
- virtual bool Install(const base::DictionaryValue& manifest,
- const base::FilePath& unpack_path) = 0;
-
- // Set |installed_file| to the full path to the installed |file|. |file| is
- // the filename of the file in this component's CRX. Returns false if this is
- // not possible (the file has been removed or modified, or its current
- // location is unknown). Otherwise, returns true.
- virtual bool GetInstalledFile(const std::string& file,
- base::FilePath* installed_file) = 0;
-
- virtual ~ComponentInstaller() {}
-};
-
-// Describes a particular component that can be installed or updated. This
-// structure is required to register a component with the component updater.
-// |pk_hash| is the SHA256 hash of the component's public key. If the component
-// is to be installed then version should be "0" or "0.0", else it should be
-// the current version. |fingerprint|, and |name| are optional.
-// |allow_background_download| specifies that the component can be background
-// downloaded in some cases. The default for this value is |true| and the value
-// can be overriden at the registration time. This is a temporary change until
-// the issue 340448 is resolved.
-struct CrxComponent {
- std::vector<uint8_t> pk_hash;
- ComponentInstaller* installer;
- Version version;
- std::string fingerprint;
- std::string name;
- bool allow_background_download;
- CrxComponent();
- ~CrxComponent();
-};
-
-struct CrxUpdateItem;
-
// The component update service is in charge of installing or upgrading
// select parts of chrome. Each part is called a component and managed by
// instances of CrxComponent registered using RegisterComponent(). On the
@@ -165,7 +121,8 @@ class ComponentUpdateService {
// Add component to be checked for updates. You can call this method
// before calling Start().
- virtual Status RegisterComponent(const CrxComponent& component) = 0;
+ virtual Status RegisterComponent(
+ const update_client::CrxComponent& component) = 0;
// Returns a list of registered components.
virtual std::vector<std::string> GetComponentIDs() const = 0;
@@ -197,8 +154,9 @@ class ComponentUpdateService {
private:
// Returns details about registered component in the |item| parameter. The
// function returns true in case of success and false in case of errors.
- virtual bool GetComponentDetails(const std::string& component_id,
- CrxUpdateItem* item) const = 0;
+ virtual bool GetComponentDetails(
+ const std::string& component_id,
+ update_client::CrxUpdateItem* item) const = 0;
friend class ::ComponentsUI;
};
@@ -226,7 +184,8 @@ class OnDemandUpdater {
// Creates the component updater. You must pass a valid |config| allocated on
// the heap which the component updater will own.
-ComponentUpdateService* ComponentUpdateServiceFactory(Configurator* config);
+ComponentUpdateService* ComponentUpdateServiceFactory(
+ update_client::Configurator* config);
} // namespace component_updater