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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 const NotifierId& notifier_id, bool enabled) { 261 const NotifierId& notifier_id, bool enabled) {
262 #if defined(ENABLE_EXTENSIONS) 262 #if defined(ENABLE_EXTENSIONS)
263 DCHECK_EQ(NotifierId::APPLICATION, notifier_id.type); 263 DCHECK_EQ(NotifierId::APPLICATION, notifier_id.type);
264 extensions::api::notifications::PermissionLevel permission = 264 extensions::api::notifications::PermissionLevel permission =
265 enabled ? extensions::api::notifications::PERMISSION_LEVEL_GRANTED 265 enabled ? extensions::api::notifications::PERMISSION_LEVEL_GRANTED
266 : extensions::api::notifications::PERMISSION_LEVEL_DENIED; 266 : extensions::api::notifications::PERMISSION_LEVEL_DENIED;
267 scoped_ptr<base::ListValue> args(new base::ListValue()); 267 scoped_ptr<base::ListValue> args(new base::ListValue());
268 args->Append(new base::StringValue( 268 args->Append(new base::StringValue(
269 extensions::api::notifications::ToString(permission))); 269 extensions::api::notifications::ToString(permission)));
270 scoped_ptr<extensions::Event> event(new extensions::Event( 270 scoped_ptr<extensions::Event> event(new extensions::Event(
271 extensions::events::UNKNOWN,
271 extensions::api::notifications::OnPermissionLevelChanged::kEventName, 272 extensions::api::notifications::OnPermissionLevelChanged::kEventName,
272 args.Pass())); 273 args.Pass()));
273 extensions::EventRouter::Get(profile_) 274 extensions::EventRouter::Get(profile_)
274 ->DispatchEventToExtension(notifier_id.id, event.Pass()); 275 ->DispatchEventToExtension(notifier_id.id, event.Pass());
275 276
276 // Tell the IO thread that this extension's permission for notifications 277 // Tell the IO thread that this extension's permission for notifications
277 // has changed. 278 // has changed.
278 extensions::InfoMap* extension_info_map = 279 extensions::InfoMap* extension_info_map =
279 extensions::ExtensionSystem::Get(profile_)->info_map(); 280 extensions::ExtensionSystem::Get(profile_)->info_map();
280 BrowserThread::PostTask( 281 BrowserThread::PostTask(
281 BrowserThread::IO, FROM_HERE, 282 BrowserThread::IO, FROM_HERE,
282 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 283 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
283 extension_info_map, notifier_id.id, !enabled)); 284 extension_info_map, notifier_id.id, !enabled));
284 #endif 285 #endif
285 } 286 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | chrome/browser/notifications/message_center_settings_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698