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

Side by Side Diff: extensions/browser/updater/update_service.h

Issue 1362043005: Add extensions code to use common updater in components/update_client/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged latest origin/master Created 5 years, 2 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 EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_ 5 #ifndef EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_
6 #define EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_ 6 #define EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
14 #include "extensions/browser/updater/extension_downloader_delegate.h"
15 15
16 namespace content { 16 namespace content {
17 class BrowserContext; 17 class BrowserContext;
18 } 18 }
19 19
20 namespace update_client {
21 class UpdateClient;
22 }
23
20 namespace extensions { 24 namespace extensions {
21 25
22 class ExtensionDownloader; 26 class UpdateDataProvider;
27 class UpdateService;
23 class UpdateServiceFactory; 28 class UpdateServiceFactory;
24 class UpdateServiceTest;
25 29
26 // This service manages the download, update, and installation of extensions. 30 // This service manages the autoupdate of extensions. It should eventually
27 // It is currently only used by app_shell, but should eventually replace 31 // replace ExtensionUpdater in Chrome.
28 // ExtensionUpdater in Chrome.
29 // TODO(rockot): Replace ExtensionUpdater with this service. 32 // TODO(rockot): Replace ExtensionUpdater with this service.
30 class UpdateService : public KeyedService, public ExtensionDownloaderDelegate { 33 class UpdateService : public KeyedService {
31 public: 34 public:
32 static UpdateService* Get(content::BrowserContext* context); 35 static UpdateService* Get(content::BrowserContext* context);
33 36
34 // TODO(rockot): Remove this. It's a placeholder for a real service interface. 37 void Shutdown() override;
35 // Downloads and (TODO) installs a CRX within the current browser context. 38
36 void DownloadAndInstall(const std::string& id, 39 // Starts an update check for each of |extension_ids|. If there are any
37 const base::Callback<void(bool)>& callback); 40 // updates available, they will be downloaded, checked for integrity,
41 // unpacked, and then passed off to the ExtensionSystem::InstallUpdate method
42 // for install completion.
43 void StartUpdateCheck(std::vector<std::string> extension_ids);
38 44
39 private: 45 private:
40 friend class UpdateServiceFactory; 46 friend class UpdateServiceFactory;
41 friend class UpdateServiceTest;
42 47
43 explicit UpdateService(content::BrowserContext* context); 48 UpdateService(content::BrowserContext* context,
49 scoped_refptr<update_client::UpdateClient> update_client);
44 ~UpdateService() override; 50 ~UpdateService() override;
45 51
46 // ExtensionDownloaderDelegate: 52 content::BrowserContext* context_;
47 void OnExtensionDownloadFailed(const std::string& id,
48 Error error,
49 const PingResult& ping,
50 const std::set<int>& request_ids) override;
51 void OnExtensionDownloadFinished(const CRXFileInfo& file,
52 bool file_ownership_passed,
53 const GURL& download_url,
54 const std::string& version,
55 const PingResult& ping,
56 const std::set<int>& request_id,
57 const InstallCallback& callback) override;
58 bool IsExtensionPending(const std::string& id) override;
59 bool GetExtensionExistingVersion(const std::string& id,
60 std::string* version) override;
61 53
62 content::BrowserContext* browser_context_; 54 scoped_refptr<update_client::UpdateClient> update_client_;
63 scoped_ptr<ExtensionDownloader> downloader_; 55 scoped_refptr<UpdateDataProvider> update_data_provider_;
64 base::Callback<void(bool)> download_callback_;
65 56
66 DISALLOW_COPY_AND_ASSIGN(UpdateService); 57 DISALLOW_COPY_AND_ASSIGN(UpdateService);
67 }; 58 };
68 59
69 } // namespace extensions 60 } // namespace extensions
70 61
71 #endif // EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_ 62 #endif // EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_
OLDNEW
« no previous file with comments | « extensions/browser/updater/update_install_shim.cc ('k') | extensions/browser/updater/update_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698