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

Side by Side Diff: components/component_updater/component_updater_service.h

Issue 2154773002: Implement Just-In-Time Flash updates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git pull && gclient sync Created 4 years, 4 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 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 COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 5 #ifndef COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
6 #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 6 #define COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/version.h" 17 #include "base/version.h"
18 #include "components/update_client/update_client.h" 18 #include "components/update_client/update_client.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 class ComponentsUI; 21 class ComponentsUI;
22 class PluginObserver;
22 class SupervisedUserWhitelistService; 23 class SupervisedUserWhitelistService;
23 24
24 namespace base { 25 namespace base {
25 class DictionaryValue; 26 class DictionaryValue;
26 class FilePath; 27 class FilePath;
27 class SequencedTaskRunner; 28 class SequencedTaskRunner;
28 } 29 }
29 30
30 namespace content { 31 namespace content {
31 class ResourceThrottle; 32 class ResourceThrottle;
(...skipping 12 matching lines...) Expand all
44 } 45 }
45 46
46 namespace component_updater { 47 namespace component_updater {
47 48
48 class OnDemandUpdater; 49 class OnDemandUpdater;
49 50
50 using Configurator = update_client::Configurator; 51 using Configurator = update_client::Configurator;
51 using CrxComponent = update_client::CrxComponent; 52 using CrxComponent = update_client::CrxComponent;
52 using CrxUpdateItem = update_client::CrxUpdateItem; 53 using CrxUpdateItem = update_client::CrxUpdateItem;
53 54
55 struct ComponentInfo {
56 ComponentInfo(const std::string& id, const base::string16& name);
57 ~ComponentInfo();
58
59 const std::string id;
60 const base::string16 name;
61 };
62
54 // The component update service is in charge of installing or upgrading 63 // The component update service is in charge of installing or upgrading
55 // select parts of chrome. Each part is called a component and managed by 64 // select parts of chrome. Each part is called a component and managed by
56 // instances of CrxComponent registered using RegisterComponent(). On the 65 // instances of CrxComponent registered using RegisterComponent(). On the
57 // server, each component is packaged as a CRX which is the same format used 66 // server, each component is packaged as a CRX which is the same format used
58 // to package extensions. To the update service each component is identified 67 // to package extensions. To the update service each component is identified
59 // by its public key hash (CrxComponent::pk_hash). If there is an update 68 // by its public key hash (CrxComponent::pk_hash). If there is an update
60 // available and its version is bigger than (CrxComponent::version), it will 69 // available and its version is bigger than (CrxComponent::version), it will
61 // be downloaded, verified and unpacked. Then component-specific installer 70 // be downloaded, verified and unpacked. Then component-specific installer
62 // ComponentInstaller::Install (of CrxComponent::installer) will be called. 71 // ComponentInstaller::Install (of CrxComponent::installer) will be called.
63 // 72 //
(...skipping 25 matching lines...) Expand all
89 // existing versions of the component from disk. Returns true if the 98 // existing versions of the component from disk. Returns true if the
90 // uninstall has completed successfully and the component files have been 99 // uninstall has completed successfully and the component files have been
91 // removed, or if the uninstalled has been deferred because the component 100 // removed, or if the uninstalled has been deferred because the component
92 // is being updated. Returns false if the component id is not known or the 101 // is being updated. Returns false if the component id is not known or the
93 /// uninstall encountered an error. 102 /// uninstall encountered an error.
94 virtual bool UnregisterComponent(const std::string& id) = 0; 103 virtual bool UnregisterComponent(const std::string& id) = 0;
95 104
96 // Returns a list of registered components. 105 // Returns a list of registered components.
97 virtual std::vector<std::string> GetComponentIDs() const = 0; 106 virtual std::vector<std::string> GetComponentIDs() const = 0;
98 107
108 // Returns a ComponentInfo describing a registered component that implements a
109 // handler for the specified |mime_type|. If multiple such components exist,
110 // returns information for the one that was most recently registered. If no
111 // such components exist, returns nullptr.
112 virtual std::unique_ptr<ComponentInfo> GetComponentForMimeType(
113 const std::string& mime_type) const = 0;
114
99 // Returns an interface for on-demand updates. On-demand updates are 115 // Returns an interface for on-demand updates. On-demand updates are
100 // proactively triggered outside the normal component update service schedule. 116 // proactively triggered outside the normal component update service schedule.
101 virtual OnDemandUpdater& GetOnDemandUpdater() = 0; 117 virtual OnDemandUpdater& GetOnDemandUpdater() = 0;
102 118
103 // This method is used to trigger an on-demand update for component |id|. 119 // This method is used to trigger an on-demand update for component |id|.
104 // This can be used when loading a resource that depends on this component. 120 // This can be used when loading a resource that depends on this component.
105 // 121 //
106 // |callback| is called on the main thread once the on-demand update is 122 // |callback| is called on the main thread once the on-demand update is
107 // complete, regardless of success. |callback| may be called immediately 123 // complete, regardless of success. |callback| may be called immediately
108 // within the method body. 124 // within the method body.
(...skipping 24 matching lines...) Expand all
133 using ServiceObserver = ComponentUpdateService::Observer; 149 using ServiceObserver = ComponentUpdateService::Observer;
134 150
135 class OnDemandUpdater { 151 class OnDemandUpdater {
136 public: 152 public:
137 virtual ~OnDemandUpdater() {} 153 virtual ~OnDemandUpdater() {}
138 154
139 private: 155 private:
140 friend class OnDemandTester; 156 friend class OnDemandTester;
141 friend class SupervisedUserWhitelistInstaller; 157 friend class SupervisedUserWhitelistInstaller;
142 friend class ::ComponentsUI; 158 friend class ::ComponentsUI;
159 friend class ::PluginObserver;
143 160
144 // Triggers an update check for a component. |id| is a value 161 // Triggers an update check for a component. |id| is a value
145 // returned by GetCrxComponentID(). If an update for this component is already 162 // returned by GetCrxComponentID(). If an update for this component is already
146 // in progress, the function returns |kInProgress|. If an update is available, 163 // in progress, the function returns |kInProgress|. If an update is available,
147 // the update will be applied. The caller can subscribe to component update 164 // the update will be applied. The caller can subscribe to component update
148 // service notifications to get an indication about the outcome of the 165 // service notifications to get an indication about the outcome of the
149 // on-demand update. The function does not implement any cooldown interval. 166 // on-demand update. The function does not implement any cooldown interval.
150 // TODO(sorin): improve this API so that the result of this non-blocking 167 // TODO(sorin): improve this API so that the result of this non-blocking
151 // call is provided by a callback. 168 // call is provided by a callback.
152 virtual bool OnDemandUpdate(const std::string& id) = 0; 169 virtual bool OnDemandUpdate(const std::string& id) = 0;
153 }; 170 };
154 171
155 // Creates the component updater. 172 // Creates the component updater.
156 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( 173 std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
157 const scoped_refptr<Configurator>& config); 174 const scoped_refptr<Configurator>& config);
158 175
159 } // namespace component_updater 176 } // namespace component_updater
160 177
161 #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 178 #endif // COMPONENTS_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.cc ('k') | components/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698