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

Side by Side Diff: chrome/browser/performance_monitor/performance_monitor.cc

Issue 10694056: CPM Extension Uninstall Watching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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/performance_monitor/performance_monitor.h" 5 #include "chrome/browser/performance_monitor/performance_monitor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/worker_pool.h" 9 #include "base/threading/worker_pool.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void PerformanceMonitor::RegisterForNotifications() { 62 void PerformanceMonitor::RegisterForNotifications() {
63 // Extensions 63 // Extensions
64 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, 64 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
65 content::NotificationService::AllSources()); 65 content::NotificationService::AllSources());
66 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED, 66 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_ENABLED,
67 content::NotificationService::AllSources()); 67 content::NotificationService::AllSources());
68 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 68 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
69 content::NotificationService::AllSources()); 69 content::NotificationService::AllSources());
70 registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, 70 registrar_.Add(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE,
71 content::NotificationService::AllSources()); 71 content::NotificationService::AllSources());
72 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
73 content::NotificationService::AllSources());
72 } 74 }
73 75
74 // Static 76 // Static
75 PerformanceMonitor* PerformanceMonitor::GetInstance() { 77 PerformanceMonitor* PerformanceMonitor::GetInstance() {
76 return Singleton<PerformanceMonitor>::get(); 78 return Singleton<PerformanceMonitor>::get();
77 } 79 }
78 80
79 void PerformanceMonitor::AddEvent(scoped_ptr<Event> event) { 81 void PerformanceMonitor::AddEvent(scoped_ptr<Event> event) {
80 content::BrowserThread::PostBlockingPoolSequencedTask( 82 content::BrowserThread::PostBlockingPoolSequencedTask(
81 Database::kDatabaseSequenceToken, 83 Database::kDatabaseSequenceToken,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 extension->name(), 180 extension->name(),
179 extension->url().spec(), 181 extension->url().spec(),
180 extension->location(), 182 extension->location(),
181 extension->VersionString(), 183 extension->VersionString(),
182 extension->description(), 184 extension->description(),
183 info->reason)); 185 info->reason));
184 break; 186 break;
185 } 187 }
186 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { 188 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: {
187 const CrxInstaller* installer = 189 const CrxInstaller* installer =
188 content::Source<CrxInstaller>(source).ptr(); 190 content::Source<CrxInstaller>(source).ptr();
189 191
190 // Check if the reason for the install was due to an extension update. 192 // Check if the reason for the install was due to an extension update.
191 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE) 193 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE)
192 break; 194 break;
193 195
194 const Extension* extension = content::Details<Extension>(details).ptr(); 196 const Extension* extension = content::Details<Extension>(details).ptr();
195 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(), 197 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(),
196 extension->id(), 198 extension->id(),
197 extension->name(), 199 extension->name(),
198 extension->url().spec(), 200 extension->url().spec(),
199 extension->location(), 201 extension->location(),
200 extension->VersionString(), 202 extension->VersionString(),
201 extension->description())); 203 extension->description()));
202 break; 204 break;
203 } 205 }
206 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
207 const Extension* extension = content::Details<Extension>(details).ptr();
208 AddEvent(util::CreateExtensionUninstallEvent(base::Time::Now(),
209 extension->id(),
210 extension->name(),
211 extension->url().spec(),
212 extension->location(),
213 extension->VersionString(),
214 extension->description()));
215 break;
216 }
204 default: { 217 default: {
205 NOTREACHED(); 218 NOTREACHED();
206 break; 219 break;
207 } 220 }
208 } 221 }
209 } 222 }
210 223
211 } // namespace performance_monitor 224 } // namespace performance_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698