| OLD | NEW |
| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 MediaGalleries::OnScanProgress::Create(details)); | 391 MediaGalleries::OnScanProgress::Create(details)); |
| 392 } | 392 } |
| 393 | 393 |
| 394 void MediaGalleriesEventRouter::DispatchEventToExtension( | 394 void MediaGalleriesEventRouter::DispatchEventToExtension( |
| 395 const std::string& extension_id, | 395 const std::string& extension_id, |
| 396 events::HistogramValue histogram_value, | 396 events::HistogramValue histogram_value, |
| 397 const std::string& event_name, | 397 const std::string& event_name, |
| 398 scoped_ptr<base::ListValue> event_args) { | 398 scoped_ptr<base::ListValue> event_args) { |
| 399 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 399 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 400 | 400 |
| 401 // TODO(tommycli): Remove these CHECKs after fixing https://crbug.com/467627. | |
| 402 CHECK(profile_); | |
| 403 EventRouter* router = EventRouter::Get(profile_); | 401 EventRouter* router = EventRouter::Get(profile_); |
| 404 CHECK(router); | |
| 405 | |
| 406 if (!router->ExtensionHasEventListener(extension_id, event_name)) | 402 if (!router->ExtensionHasEventListener(extension_id, event_name)) |
| 407 return; | 403 return; |
| 408 | 404 |
| 409 scoped_ptr<extensions::Event> event(new extensions::Event( | 405 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 410 histogram_value, event_name, std::move(event_args))); | 406 histogram_value, event_name, std::move(event_args))); |
| 411 router->DispatchEventToExtension(extension_id, std::move(event)); | 407 router->DispatchEventToExtension(extension_id, std::move(event)); |
| 412 } | 408 } |
| 413 | 409 |
| 414 void MediaGalleriesEventRouter::OnGalleryChanged( | 410 void MediaGalleriesEventRouter::OnGalleryChanged( |
| 415 const std::string& extension_id, MediaGalleryPrefId gallery_id) { | 411 const std::string& extension_id, MediaGalleryPrefId gallery_id) { |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); | 1251 &MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit, this)); |
| 1256 return true; | 1252 return true; |
| 1257 } | 1253 } |
| 1258 | 1254 |
| 1259 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { | 1255 void MediaGalleriesRemoveAllGalleryWatchFunction::OnPreferencesInit() { |
| 1260 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); | 1256 gallery_watch_manager()->RemoveAllWatches(GetProfile(), extension_id()); |
| 1261 SendResponse(true); | 1257 SendResponse(true); |
| 1262 } | 1258 } |
| 1263 | 1259 |
| 1264 } // namespace extensions | 1260 } // namespace extensions |
| OLD | NEW |