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

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

Issue 298883006: Rename NOTIFICATION_EXTENSION_INSTALLED to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 6 years, 7 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 #include <vector>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 crx_install_is_running_(false), 144 crx_install_is_running_(false),
145 extension_cache_(cache) { 145 extension_cache_(cache) {
146 DCHECK_GE(frequency_seconds_, 5); 146 DCHECK_GE(frequency_seconds_, 5);
147 DCHECK_LE(frequency_seconds_, kMaxUpdateFrequencySeconds); 147 DCHECK_LE(frequency_seconds_, kMaxUpdateFrequencySeconds);
148 #if defined(NDEBUG) 148 #if defined(NDEBUG)
149 // In Release mode we enforce that update checks don't happen too often. 149 // In Release mode we enforce that update checks don't happen too often.
150 frequency_seconds_ = std::max(frequency_seconds_, kMinUpdateFrequencySeconds); 150 frequency_seconds_ = std::max(frequency_seconds_, kMinUpdateFrequencySeconds);
151 #endif 151 #endif
152 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds); 152 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds);
153 153
154 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 154 registrar_.Add(this,
155 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
155 content::NotificationService::AllBrowserContextsAndSources()); 156 content::NotificationService::AllBrowserContextsAndSources());
156 } 157 }
157 158
158 ExtensionUpdater::~ExtensionUpdater() { 159 ExtensionUpdater::~ExtensionUpdater() {
159 Stop(); 160 Stop();
160 } 161 }
161 162
162 // The overall goal here is to balance keeping clients up to date while 163 // The overall goal here is to balance keeping clients up to date while
163 // avoiding a thundering herd against update servers. 164 // avoiding a thundering herd against update servers.
164 TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() { 165 TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 it != crx_file.request_ids.end(); ++it) { 610 it != crx_file.request_ids.end(); ++it) {
610 InProgressCheck& request = requests_in_progress_[*it]; 611 InProgressCheck& request = requests_in_progress_[*it];
611 request.in_progress_ids_.remove(crx_file.extension_id); 612 request.in_progress_ids_.remove(crx_file.extension_id);
612 NotifyIfFinished(*it); 613 NotifyIfFinished(*it);
613 } 614 }
614 615
615 // If any files are available to update, start one. 616 // If any files are available to update, start one.
616 MaybeInstallCRXFile(); 617 MaybeInstallCRXFile();
617 break; 618 break;
618 } 619 }
619 case chrome::NOTIFICATION_EXTENSION_INSTALLED: { 620 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: {
620 const Extension* extension = 621 const Extension* extension =
621 content::Details<const InstalledExtensionInfo>(details)->extension; 622 content::Details<const InstalledExtensionInfo>(details)->extension;
622 if (extension) 623 if (extension)
623 throttle_info_.erase(extension->id()); 624 throttle_info_.erase(extension->id());
624 break; 625 break;
625 } 626 }
626 default: 627 default:
627 NOTREACHED(); 628 NOTREACHED();
628 } 629 }
629 } 630 }
(...skipping 10 matching lines...) Expand all
640 const InProgressCheck& request = requests_in_progress_[request_id]; 641 const InProgressCheck& request = requests_in_progress_[request_id];
641 if (request.in_progress_ids_.empty()) { 642 if (request.in_progress_ids_.empty()) {
642 VLOG(2) << "Finished update check " << request_id; 643 VLOG(2) << "Finished update check " << request_id;
643 if (!request.callback.is_null()) 644 if (!request.callback.is_null())
644 request.callback.Run(); 645 request.callback.Run();
645 requests_in_progress_.erase(request_id); 646 requests_in_progress_.erase(request_id);
646 } 647 }
647 } 648 }
648 649
649 } // namespace extensions 650 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/state_store.cc ('k') | chrome/browser/extensions/webstore_startup_installer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698