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 #include "extensions/browser/updater/update_service.h" | 5 #include "extensions/browser/updater/update_service.h" |
6 | 6 |
| 7 #include <set> |
| 8 |
7 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
8 #include "components/omaha_client/omaha_query_params.h" | 10 #include "components/update_client/update_query_params.h" |
9 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
10 #include "extensions/browser/updater/extension_downloader.h" | 12 #include "extensions/browser/updater/extension_downloader.h" |
11 #include "extensions/browser/updater/update_service_factory.h" | 13 #include "extensions/browser/updater/update_service_factory.h" |
12 #include "extensions/common/extension_urls.h" | 14 #include "extensions/common/extension_urls.h" |
13 | 15 |
14 using omaha_client::OmahaQueryParams; | 16 using update_client::UpdateQueryParams; |
15 | 17 |
16 namespace extensions { | 18 namespace extensions { |
17 | 19 |
18 // static | 20 // static |
19 UpdateService* UpdateService::Get(content::BrowserContext* context) { | 21 UpdateService* UpdateService::Get(content::BrowserContext* context) { |
20 return UpdateServiceFactory::GetForBrowserContext(context); | 22 return UpdateServiceFactory::GetForBrowserContext(context); |
21 } | 23 } |
22 | 24 |
23 void UpdateService::DownloadAndInstall( | 25 void UpdateService::DownloadAndInstall( |
24 const std::string& id, | 26 const std::string& id, |
25 const base::Callback<void(bool)>& callback) { | 27 const base::Callback<void(bool)>& callback) { |
26 DCHECK(download_callback_.is_null()); | 28 DCHECK(download_callback_.is_null()); |
27 download_callback_ = callback; | 29 download_callback_ = callback; |
28 downloader_->AddPendingExtension(id, extension_urls::GetWebstoreUpdateUrl(), | 30 downloader_->AddPendingExtension(id, extension_urls::GetWebstoreUpdateUrl(), |
29 0); | 31 0); |
30 downloader_->StartAllPending(nullptr); | 32 downloader_->StartAllPending(nullptr); |
31 } | 33 } |
32 | 34 |
33 UpdateService::UpdateService(content::BrowserContext* context) | 35 UpdateService::UpdateService(content::BrowserContext* context) |
34 : browser_context_(context), | 36 : browser_context_(context), |
35 downloader_(new ExtensionDownloader(this, context->GetRequestContext())) { | 37 downloader_(new ExtensionDownloader(this, context->GetRequestContext())) { |
36 downloader_->set_manifest_query_params( | 38 downloader_->set_manifest_query_params( |
37 OmahaQueryParams::Get(OmahaQueryParams::CRX)); | 39 UpdateQueryParams::Get(UpdateQueryParams::CRX)); |
38 } | 40 } |
39 | 41 |
40 UpdateService::~UpdateService() { | 42 UpdateService::~UpdateService() { |
41 } | 43 } |
42 | 44 |
43 void UpdateService::OnExtensionDownloadFailed( | 45 void UpdateService::OnExtensionDownloadFailed( |
44 const std::string& id, | 46 const std::string& id, |
45 Error error, | 47 Error error, |
46 const PingResult& ping, | 48 const PingResult& ping, |
47 const std::set<int>& request_ids) { | 49 const std::set<int>& request_ids) { |
(...skipping 21 matching lines...) Expand all Loading... |
69 return true; | 71 return true; |
70 } | 72 } |
71 | 73 |
72 bool UpdateService::GetExtensionExistingVersion(const std::string& id, | 74 bool UpdateService::GetExtensionExistingVersion(const std::string& id, |
73 std::string* version) { | 75 std::string* version) { |
74 // TODO(rockot): Implement this. | 76 // TODO(rockot): Implement this. |
75 return false; | 77 return false; |
76 } | 78 } |
77 | 79 |
78 } // namespace extensions | 80 } // namespace extensions |
OLD | NEW |