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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
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/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 11 matching lines...) Expand all
22 #include "base/version.h" 22 #include "base/version.h"
23 #include "crypto/sha2.h" 23 #include "crypto/sha2.h"
24 #include "content/common/notification_service.h" 24 #include "content/common/notification_service.h"
25 #include "content/common/notification_source.h" 25 #include "content/common/notification_source.h"
26 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/extensions/crx_installer.h" 27 #include "chrome/browser/extensions/crx_installer.h"
28 #include "chrome/browser/extensions/extension_error_reporter.h" 28 #include "chrome/browser/extensions/extension_error_reporter.h"
29 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
30 #include "chrome/browser/prefs/pref_service.h" 30 #include "chrome/browser/prefs/pref_service.h"
31 #include "chrome/browser/profiles/profile.h" 31 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/chrome_utility_messages.h" 34 #include "chrome/common/chrome_utility_messages.h"
34 #include "chrome/common/chrome_version_info.h" 35 #include "chrome/common/chrome_version_info.h"
35 #include "chrome/common/extensions/extension.h" 36 #include "chrome/common/extensions/extension.h"
36 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
37 #include "chrome/common/extensions/extension_file_util.h" 38 #include "chrome/common/extensions/extension_file_util.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "content/browser/utility_process_host.h" 40 #include "content/browser/utility_process_host.h"
40 #include "googleurl/src/gurl.h" 41 #include "googleurl/src/gurl.h"
41 #include "net/base/escape.h" 42 #include "net/base/escape.h"
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 CrxInstaller* installer = NULL; 888 CrxInstaller* installer = NULL;
888 if (service_->UpdateExtension(crx_file.id, 889 if (service_->UpdateExtension(crx_file.id,
889 crx_file.path, 890 crx_file.path,
890 crx_file.download_url, 891 crx_file.download_url,
891 &installer)) { 892 &installer)) {
892 crx_install_is_running_ = true; 893 crx_install_is_running_ = true;
893 894
894 // Source parameter ensures that we only see the completion event for the 895 // Source parameter ensures that we only see the completion event for the
895 // the installer we started. 896 // the installer we started.
896 registrar_.Add(this, 897 registrar_.Add(this,
897 NotificationType::CRX_INSTALLER_DONE, 898 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
898 Source<CrxInstaller>(installer)); 899 Source<CrxInstaller>(installer));
899 } 900 }
900 in_progress_ids_.erase(crx_file.id); 901 in_progress_ids_.erase(crx_file.id);
901 fetched_crx_files_.pop(); 902 fetched_crx_files_.pop();
902 } 903 }
903 904
904 // If an updater is running, it was started above. 905 // If an updater is running, it was started above.
905 return crx_install_is_running_; 906 return crx_install_is_running_;
906 } 907 }
907 908
908 void ExtensionUpdater::Observe(NotificationType type, 909 void ExtensionUpdater::Observe(int type,
909 const NotificationSource& source, 910 const NotificationSource& source,
910 const NotificationDetails& details) { 911 const NotificationDetails& details) {
911 DCHECK(type == NotificationType::CRX_INSTALLER_DONE); 912 DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE);
912 913
913 // No need to listen for CRX_INSTALLER_DONE anymore. 914 // No need to listen for CRX_INSTALLER_DONE anymore.
914 registrar_.Remove(this, 915 registrar_.Remove(this,
915 NotificationType::CRX_INSTALLER_DONE, 916 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
916 source); 917 source);
917 crx_install_is_running_ = false; 918 crx_install_is_running_ = false;
918 // If any files are available to update, start one. 919 // If any files are available to update, start one.
919 MaybeInstallCRXFile(); 920 MaybeInstallCRXFile();
920 } 921 }
921 922
922 void ExtensionUpdater::OnCRXFileWriteError(const std::string& id) { 923 void ExtensionUpdater::OnCRXFileWriteError(const std::string& id) {
923 DCHECK(alive_); 924 DCHECK(alive_);
924 in_progress_ids_.erase(id); 925 in_progress_ids_.erase(id);
925 } 926 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 1201 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
1201 } 1202 }
1202 1203
1203 extension_fetcher_->Start(); 1204 extension_fetcher_->Start();
1204 current_extension_fetch_ = ExtensionFetch(id, url, hash, version); 1205 current_extension_fetch_ = ExtensionFetch(id, url, hash, version);
1205 } 1206 }
1206 } 1207 }
1207 1208
1208 void ExtensionUpdater::NotifyStarted() { 1209 void ExtensionUpdater::NotifyStarted() {
1209 NotificationService::current()->Notify( 1210 NotificationService::current()->Notify(
1210 NotificationType::EXTENSION_UPDATING_STARTED, 1211 chrome::NOTIFICATION_EXTENSION_UPDATING_STARTED,
1211 Source<Profile>(profile_), 1212 Source<Profile>(profile_),
1212 NotificationService::NoDetails()); 1213 NotificationService::NoDetails());
1213 } 1214 }
1214 1215
1215 void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) { 1216 void ExtensionUpdater::NotifyUpdateFound(const std::string& extension_id) {
1216 NotificationService::current()->Notify( 1217 NotificationService::current()->Notify(
1217 NotificationType::EXTENSION_UPDATE_FOUND, 1218 chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
1218 Source<Profile>(profile_), 1219 Source<Profile>(profile_),
1219 Details<const std::string>(&extension_id)); 1220 Details<const std::string>(&extension_id));
1220 } 1221 }
1221 1222
1222 void ExtensionUpdater::NotifyIfFinished() { 1223 void ExtensionUpdater::NotifyIfFinished() {
1223 if (in_progress_ids_.empty()) { 1224 if (in_progress_ids_.empty()) {
1224 NotificationService::current()->Notify( 1225 NotificationService::current()->Notify(
1225 NotificationType::EXTENSION_UPDATING_FINISHED, 1226 chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED,
1226 Source<Profile>(profile_), 1227 Source<Profile>(profile_),
1227 NotificationService::NoDetails()); 1228 NotificationService::NoDetails());
1228 VLOG(1) << "Sending EXTENSION_UPDATING_FINISHED"; 1229 VLOG(1) << "Sending EXTENSION_UPDATING_FINISHED";
1229 } 1230 }
1230 } 1231 }
1231 1232
1232 void ExtensionUpdater::AddToInProgress(const std::set<std::string>& ids) { 1233 void ExtensionUpdater::AddToInProgress(const std::set<std::string>& ids) {
1233 std::set<std::string>::const_iterator i; 1234 std::set<std::string>::const_iterator i;
1234 for (i = ids.begin(); i != ids.end(); ++i) 1235 for (i = ids.begin(); i != ids.end(); ++i)
1235 in_progress_ids_.insert(*i); 1236 in_progress_ids_.insert(*i);
1236 } 1237 }
1237 1238
1238 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { 1239 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) {
1239 std::set<std::string>::const_iterator i; 1240 std::set<std::string>::const_iterator i;
1240 for (i = ids.begin(); i != ids.end(); ++i) 1241 for (i = ids.begin(); i != ids.end(); ++i)
1241 in_progress_ids_.erase(*i); 1242 in_progress_ids_.erase(*i);
1242 } 1243 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater.h ('k') | chrome/browser/extensions/extension_web_socket_proxy_private_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698