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

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: Requested changes made 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 extension->name(), 181 extension->name(),
180 extension->url().spec(), 182 extension->url().spec(),
181 extension->location(), 183 extension->location(),
182 extension->VersionString(), 184 extension->VersionString(),
183 extension->description(), 185 extension->description(),
184 info->reason)); 186 info->reason));
185 break; 187 break;
186 } 188 }
187 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: { 189 case chrome::NOTIFICATION_CRX_INSTALLER_DONE: {
188 const CrxInstaller* installer = 190 const CrxInstaller* installer =
189 content::Source<CrxInstaller>(source).ptr(); 191 content::Source<CrxInstaller>(source).ptr();
190 192
191 // Check if the reason for the install was due to an extension update. 193 // Check if the reason for the install was due to an extension update.
192 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE) 194 if (installer->install_cause() != extension_misc::INSTALL_CAUSE_UPDATE)
193 break; 195 break;
194 196
195 const Extension* extension = content::Details<Extension>(details).ptr(); 197 const Extension* extension = content::Details<Extension>(details).ptr();
196 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(), 198 AddEvent(util::CreateExtensionUpdateEvent(base::Time::Now(),
197 extension->id(), 199 extension->id(),
198 extension->name(), 200 extension->name(),
199 extension->url().spec(), 201 extension->url().spec(),
200 extension->location(), 202 extension->location(),
201 extension->VersionString(), 203 extension->VersionString(),
202 extension->description())); 204 extension->description()));
203 break; 205 break;
204 } 206 }
207 case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
208 const Extension* extension = content::Details<Extension>(details).ptr();
209 AddEvent(util::CreateExtensionUninstallEvent(base::Time::Now(),
210 extension->id(),
211 extension->name(),
212 extension->url().spec(),
213 extension->location(),
214 extension->VersionString(),
215 extension->description()));
216 break;
217 }
205 default: { 218 default: {
206 NOTREACHED(); 219 NOTREACHED();
207 break; 220 break;
208 } 221 }
209 } 222 }
210 } 223 }
211 224
212 } // namespace performance_monitor 225 } // namespace performance_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698