OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_updater.h" | 5 #include "chrome/browser/extensions/extension_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/chrome_utility_messages.h" | 33 #include "chrome/common/chrome_utility_messages.h" |
34 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
36 #include "chrome/common/extensions/extension_constants.h" | 36 #include "chrome/common/extensions/extension_constants.h" |
37 #include "chrome/common/extensions/extension_file_util.h" | 37 #include "chrome/common/extensions/extension_file_util.h" |
38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
39 #include "content/browser/utility_process_host.h" | 39 #include "content/browser/utility_process_host.h" |
40 #include "content/common/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
41 #include "content/public/browser/notification_source.h" | 41 #include "content/public/browser/notification_source.h" |
42 #include "crypto/sha2.h" | 42 #include "crypto/sha2.h" |
43 #include "googleurl/src/gurl.h" | 43 #include "googleurl/src/gurl.h" |
44 #include "net/base/escape.h" | 44 #include "net/base/escape.h" |
45 #include "net/base/load_flags.h" | 45 #include "net/base/load_flags.h" |
46 #include "net/url_request/url_request_status.h" | 46 #include "net/url_request/url_request_status.h" |
47 | 47 |
48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
49 #include "base/sys_string_conversions.h" | 49 #include "base/sys_string_conversions.h" |
50 #endif | 50 #endif |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 extension_fetcher_->SaveResponseToTemporaryFile( | 1209 extension_fetcher_->SaveResponseToTemporaryFile( |
1210 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 1210 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
1211 } | 1211 } |
1212 | 1212 |
1213 extension_fetcher_->Start(); | 1213 extension_fetcher_->Start(); |
1214 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); | 1214 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); |
1215 } | 1215 } |
1216 } | 1216 } |
1217 | 1217 |
1218 void ExtensionUpdater::NotifyStarted() { | 1218 void ExtensionUpdater::NotifyStarted() { |
1219 NotificationService::current()->Notify( | 1219 content::NotificationService::current()->Notify( |
1220 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, | 1220 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED, |
1221 content::Source<Profile>(profile_), | 1221 content::Source<Profile>(profile_), |
1222 NotificationService::NoDetails()); | 1222 content::NotificationService::NoDetails()); |
1223 } | 1223 } |
1224 | 1224 |
1225 void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) { | 1225 void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) { |
1226 NotificationService::current()->Notify( | 1226 content::NotificationService::current()->Notify( |
1227 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, | 1227 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, |
1228 content::Source<Profile>(profile_), | 1228 content::Source<Profile>(profile_), |
1229 content::Details<const std::string>(&extension_id)); | 1229 content::Details<const std::string>(&extension_id)); |
1230 } | 1230 } |
1231 | 1231 |
1232 void ExtensionUpdater::NotifyIfFinished() { | 1232 void ExtensionUpdater::NotifyIfFinished() { |
1233 if (in_progress_ids_.empty()) { | 1233 if (in_progress_ids_.empty()) { |
1234 NotificationService::current()->Notify( | 1234 content::NotificationService::current()->Notify( |
1235 chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, | 1235 chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, |
1236 content::Source<Profile>(profile_), | 1236 content::Source<Profile>(profile_), |
1237 NotificationService::NoDetails()); | 1237 content::NotificationService::NoDetails()); |
1238 VLOG(1) << "Sending EXTENSION_UPDATING_FINISHED"; | 1238 VLOG(1) << "Sending EXTENSION_UPDATING_FINISHED"; |
1239 } | 1239 } |
1240 } | 1240 } |
1241 | 1241 |
1242 void ExtensionUpdater::AddToInProgress(const std::set<std::string>& ids) { | 1242 void ExtensionUpdater::AddToInProgress(const std::set<std::string>& ids) { |
1243 std::set<std::string>::const_iterator i; | 1243 std::set<std::string>::const_iterator i; |
1244 for (i = ids.begin(); i != ids.end(); ++i) | 1244 for (i = ids.begin(); i != ids.end(); ++i) |
1245 in_progress_ids_.insert(*i); | 1245 in_progress_ids_.insert(*i); |
1246 } | 1246 } |
1247 | 1247 |
1248 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { | 1248 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { |
1249 std::set<std::string>::const_iterator i; | 1249 std::set<std::string>::const_iterator i; |
1250 for (i = ids.begin(); i != ids.end(); ++i) | 1250 for (i = ids.begin(); i != ids.end(); ++i) |
1251 in_progress_ids_.erase(*i); | 1251 in_progress_ids_.erase(*i); |
1252 } | 1252 } |
OLD | NEW |