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

Side by Side Diff: chrome/browser/extensions/updater/extension_updater.cc

Issue 803313003: Rename omaha_client and similar tokens to update_client in all contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: rebase to master Created 5 years, 11 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 (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 #include "chrome/browser/extensions/updater/extension_updater.h" 5 #include "chrome/browser/extensions/updater/extension_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
15 #include "base/rand_util.h" 16 #include "base/rand_util.h"
16 #include "base/stl_util.h" 17 #include "base/stl_util.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
19 #include "chrome/browser/chrome_notification_types.h" 20 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/extensions/api/module/module.h" 21 #include "chrome/browser/extensions/api/module/module.h"
21 #include "chrome/browser/extensions/crx_installer.h" 22 #include "chrome/browser/extensions/crx_installer.h"
22 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/pending_extension_manager.h" 24 #include "chrome/browser/extensions/pending_extension_manager.h"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "components/omaha_client/omaha_query_params.h" 26 #include "components/update_client/update_query_params.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/notification_details.h" 28 #include "content/public/browser/notification_details.h"
28 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
29 #include "content/public/browser/notification_source.h" 30 #include "content/public/browser/notification_source.h"
30 #include "crypto/sha2.h" 31 #include "crypto/sha2.h"
31 #include "extensions/browser/extension_prefs.h" 32 #include "extensions/browser/extension_prefs.h"
32 #include "extensions/browser/extension_registry.h" 33 #include "extensions/browser/extension_registry.h"
33 #include "extensions/browser/pref_names.h" 34 #include "extensions/browser/pref_names.h"
34 #include "extensions/common/constants.h" 35 #include "extensions/common/constants.h"
35 #include "extensions/common/extension.h" 36 #include "extensions/common/extension.h"
36 #include "extensions/common/extension_set.h" 37 #include "extensions/common/extension_set.h"
37 #include "extensions/common/manifest.h" 38 #include "extensions/common/manifest.h"
38 #include "extensions/common/manifest_constants.h" 39 #include "extensions/common/manifest_constants.h"
39 40
40 using base::RandDouble; 41 using base::RandDouble;
41 using base::RandInt; 42 using base::RandInt;
42 using base::Time; 43 using base::Time;
43 using base::TimeDelta; 44 using base::TimeDelta;
44 using content::BrowserThread; 45 using content::BrowserThread;
45 using extensions::Extension; 46 using extensions::Extension;
46 using extensions::ExtensionSet; 47 using extensions::ExtensionSet;
47 using omaha_client::OmahaQueryParams; 48 using update_client::UpdateQueryParams;
48 49
49 typedef extensions::ExtensionDownloaderDelegate::Error Error; 50 typedef extensions::ExtensionDownloaderDelegate::Error Error;
50 typedef extensions::ExtensionDownloaderDelegate::PingResult PingResult; 51 typedef extensions::ExtensionDownloaderDelegate::PingResult PingResult;
51 52
52 namespace { 53 namespace {
53 54
54 // Wait at least 5 minutes after browser startup before we do any checks. If you 55 // Wait at least 5 minutes after browser startup before we do any checks. If you
55 // change this value, make sure to update comments where it is used. 56 // change this value, make sure to update comments where it is used.
56 const int kStartupWaitSeconds = 60 * 5; 57 const int kStartupWaitSeconds = 60 * 5;
57 58
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 bool force = true; 121 bool force = true;
121 const base::ListValue* platforms; 122 const base::ListValue* platforms;
122 if (extension->manifest()->GetList(extensions::manifest_keys::kPlatforms, 123 if (extension->manifest()->GetList(extensions::manifest_keys::kPlatforms,
123 &platforms)) { 124 &platforms)) {
124 for (size_t i = 0; i < platforms->GetSize(); ++i) { 125 for (size_t i = 0; i < platforms->GetSize(); ++i) {
125 const base::DictionaryValue* p; 126 const base::DictionaryValue* p;
126 if (platforms->GetDictionary(i, &p)) { 127 if (platforms->GetDictionary(i, &p)) {
127 std::string nacl_arch; 128 std::string nacl_arch;
128 if (p->GetString(extensions::manifest_keys::kNaClArch, 129 if (p->GetString(extensions::manifest_keys::kNaClArch,
129 &nacl_arch) && 130 &nacl_arch) &&
130 nacl_arch == OmahaQueryParams::GetNaclArch()) { 131 nacl_arch == UpdateQueryParams::GetNaclArch()) {
131 std::string subpath; 132 std::string subpath;
132 if (p->GetString(extensions::manifest_keys::kSubPackagePath, 133 if (p->GetString(extensions::manifest_keys::kSubPackagePath,
133 &subpath)) { 134 &subpath)) {
134 // _platform_specific is part of the sub_package_path entry. 135 // _platform_specific is part of the sub_package_path entry.
135 base::FilePath platform_specific_subpath = 136 base::FilePath platform_specific_subpath =
136 extension->path().AppendASCII(subpath); 137 extension->path().AppendASCII(subpath);
137 if (base::PathExists(platform_specific_subpath)) { 138 if (base::PathExists(platform_specific_subpath)) {
138 force = false; 139 force = false;
139 } 140 }
140 } 141 }
141 } 142 }
142 } 143 }
143 } 144 }
144 } 145 }
145 146
146 if (force) 147 if (force)
147 forced_updates->insert(extension->id()); 148 forced_updates->insert(extension->id());
148 } 149 }
149 } 150 }
150 BrowserThread::PostTask( 151 BrowserThread::PostTask(
151 BrowserThread::UI, 152 BrowserThread::UI,
152 FROM_HERE, 153 FROM_HERE,
153 base::Bind(&RespondWithForcedUpdates, 154 base::Bind(&RespondWithForcedUpdates,
154 callback, 155 callback,
155 base::Passed(&forced_updates))); 156 base::Passed(&forced_updates)));
156 } 157 }
157 158
158 void CollectExtensionsFromSet( 159 void CollectExtensionsFromSet(
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const InProgressCheck& request = requests_in_progress_[request_id]; 768 const InProgressCheck& request = requests_in_progress_[request_id];
768 if (request.in_progress_ids_.empty()) { 769 if (request.in_progress_ids_.empty()) {
769 VLOG(2) << "Finished update check " << request_id; 770 VLOG(2) << "Finished update check " << request_id;
770 if (!request.callback.is_null()) 771 if (!request.callback.is_null())
771 request.callback.Run(); 772 request.callback.Run();
772 requests_in_progress_.erase(request_id); 773 requests_in_progress_.erase(request_id);
773 } 774 }
774 } 775 }
775 776
776 } // namespace extensions 777 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698