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

Side by Side Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 18006003: Consistently use notifications from component updater w/ on-demand PNaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sorins review Created 7 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) 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/component_updater/component_updater_service.h" 5 #include "chrome/browser/component_updater/component_updater_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 public: 304 public:
305 explicit CrxUpdateService(ComponentUpdateService::Configurator* config); 305 explicit CrxUpdateService(ComponentUpdateService::Configurator* config);
306 306
307 virtual ~CrxUpdateService(); 307 virtual ~CrxUpdateService();
308 308
309 // Overrides for ComponentUpdateService. 309 // Overrides for ComponentUpdateService.
310 virtual Status Start() OVERRIDE; 310 virtual Status Start() OVERRIDE;
311 virtual Status Stop() OVERRIDE; 311 virtual Status Stop() OVERRIDE;
312 virtual Status RegisterComponent(const CrxComponent& component) OVERRIDE; 312 virtual Status RegisterComponent(const CrxComponent& component) OVERRIDE;
313 virtual Status CheckForUpdateSoon(const CrxComponent& component) OVERRIDE; 313 virtual Status CheckForUpdateSoon(const CrxComponent& component) OVERRIDE;
314 virtual bool IsUpdateNotificationForComponent(
315 const content::NotificationSource& source,
316 const CrxComponent& component) OVERRIDE;
314 317
315 // The only purpose of this class is to forward the 318 // The only purpose of this class is to forward the
316 // UtilityProcessHostClient callbacks so CrxUpdateService does 319 // UtilityProcessHostClient callbacks so CrxUpdateService does
317 // not have to derive from it because that is refcounted. 320 // not have to derive from it because that is refcounted.
318 class ManifestParserBridge : public UtilityProcessHostClient { 321 class ManifestParserBridge : public UtilityProcessHostClient {
319 public: 322 public:
320 explicit ManifestParserBridge(CrxUpdateService* service) 323 explicit ManifestParserBridge(CrxUpdateService* service)
321 : service_(service) {} 324 : service_(service) {}
322 325
323 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 326 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 break; 980 break;
978 default: 981 default:
979 event = Configurator::kUnpackError; 982 event = Configurator::kUnpackError;
980 break; 983 break;
981 } 984 }
982 985
983 config_->OnEvent(event, CrxIdtoUMAId(component_id)); 986 config_->OnEvent(event, CrxIdtoUMAId(component_id));
984 ScheduleNextRun(false); 987 ScheduleNextRun(false);
985 } 988 }
986 989
990 bool CrxUpdateService::IsUpdateNotificationForComponent(
Sorin Jianu 2013/07/03 23:10:04 What is strange about this function is that is see
jvoung (off chromium) 2013/07/04 01:11:04 One argument for having it be a member function, i
991 const content::NotificationSource& src,
992 const CrxComponent& component) {
993 std::string id =
994 HexStringToID(StringToLowerASCII(base::HexEncode(&component.pk_hash[0],
995 component.pk_hash.size()/2)));
996 return content::Source<std::string>(src)->compare(id) == 0;
997 }
998
987 // The component update factory. Using the component updater as a singleton 999 // The component update factory. Using the component updater as a singleton
988 // is the job of the browser process. 1000 // is the job of the browser process.
989 ComponentUpdateService* ComponentUpdateServiceFactory( 1001 ComponentUpdateService* ComponentUpdateServiceFactory(
990 ComponentUpdateService::Configurator* config) { 1002 ComponentUpdateService::Configurator* config) {
991 DCHECK(config); 1003 DCHECK(config);
992 return new CrxUpdateService(config); 1004 return new CrxUpdateService(config);
993 } 1005 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698