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

Side by Side Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.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, 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 // Implements the Chrome Extensions Media Galleries API. 5 // Implements the Chrome Extensions Media Galleries API.
6 6
7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h" 7 #include "chrome/browser/extensions/api/media_galleries/media_galleries_api.h"
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 415 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
416 416
417 // TODO(tommycli): Remove these CHECKs after fixing https://crbug.com/467627. 417 // TODO(tommycli): Remove these CHECKs after fixing https://crbug.com/467627.
418 CHECK(profile_); 418 CHECK(profile_);
419 EventRouter* router = EventRouter::Get(profile_); 419 EventRouter* router = EventRouter::Get(profile_);
420 CHECK(router); 420 CHECK(router);
421 421
422 if (!router->ExtensionHasEventListener(extension_id, event_name)) 422 if (!router->ExtensionHasEventListener(extension_id, event_name))
423 return; 423 return;
424 424
425 scoped_ptr<extensions::Event> event( 425 scoped_ptr<extensions::Event> event(new extensions::Event(
426 new extensions::Event(event_name, event_args.Pass())); 426 extensions::events::UNKNOWN, event_name, event_args.Pass()));
427 router->DispatchEventToExtension(extension_id, event.Pass()); 427 router->DispatchEventToExtension(extension_id, event.Pass());
428 } 428 }
429 429
430 void MediaGalleriesEventRouter::OnGalleryChanged( 430 void MediaGalleriesEventRouter::OnGalleryChanged(
431 const std::string& extension_id, MediaGalleryPrefId gallery_id) { 431 const std::string& extension_id, MediaGalleryPrefId gallery_id) {
432 MediaGalleries::GalleryChangeDetails details; 432 MediaGalleries::GalleryChangeDetails details;
433 details.type = MediaGalleries::GALLERY_CHANGE_TYPE_CONTENTS_CHANGED; 433 details.type = MediaGalleries::GALLERY_CHANGE_TYPE_CONTENTS_CHANGED;
434 details.gallery_id = base::Uint64ToString(gallery_id); 434 details.gallery_id = base::Uint64ToString(gallery_id);
435 DispatchEventToExtension( 435 DispatchEventToExtension(
436 extension_id, 436 extension_id,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); 1273 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this));
1274 return true; 1274 return true;
1275 } 1275 }
1276 1276
1277 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { 1277 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() {
1278 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); 1278 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id());
1279 SendResponse(true); 1279 SendResponse(true);
1280 } 1280 }
1281 1281
1282 } // namespace extensions 1282 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698