| 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 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 query_out.Search(all_items.begin(), all_items.end(), results); | 479 query_out.Search(all_items.begin(), all_items.end(), results); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void DispatchEventInternal( | 482 void DispatchEventInternal( |
| 483 Profile* target_profile, | 483 Profile* target_profile, |
| 484 const char* event_name, | 484 const char* event_name, |
| 485 const std::string& json_args, | 485 const std::string& json_args, |
| 486 scoped_ptr<base::ListValue> event_args) { | 486 scoped_ptr<base::ListValue> event_args) { |
| 487 if (!extensions::ExtensionSystem::Get(target_profile)->event_router()) | 487 if (!extensions::ExtensionSystem::Get(target_profile)->event_router()) |
| 488 return; | 488 return; |
| 489 scoped_ptr<extensions::Event> event(new extensions::Event( |
| 490 event_name, event_args.Pass())); |
| 491 event->restrict_to_profile = target_profile; |
| 489 extensions::ExtensionSystem::Get(target_profile)->event_router()-> | 492 extensions::ExtensionSystem::Get(target_profile)->event_router()-> |
| 490 DispatchEventToRenderers(event_name, event_args.Pass(), target_profile, | 493 BroadcastEvent(event.Pass()); |
| 491 GURL(), extensions::EventFilteringInfo()); | |
| 492 ExtensionDownloadsEventRouter::DownloadsNotificationSource | 494 ExtensionDownloadsEventRouter::DownloadsNotificationSource |
| 493 notification_source; | 495 notification_source; |
| 494 notification_source.event_name = event_name; | 496 notification_source.event_name = event_name; |
| 495 notification_source.profile = target_profile; | 497 notification_source.profile = target_profile; |
| 496 content::Source<ExtensionDownloadsEventRouter::DownloadsNotificationSource> | 498 content::Source<ExtensionDownloadsEventRouter::DownloadsNotificationSource> |
| 497 content_source(¬ification_source); | 499 content_source(¬ification_source); |
| 498 std::string args_copy(json_args); | 500 std::string args_copy(json_args); |
| 499 content::NotificationService::current()->Notify( | 501 content::NotificationService::current()->Notify( |
| 500 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 502 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
| 501 content_source, | 503 content_source, |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 if (profile_->HasOffTheRecordProfile() && | 993 if (profile_->HasOffTheRecordProfile() && |
| 992 !profile_->IsOffTheRecord()) { | 994 !profile_->IsOffTheRecord()) { |
| 993 DispatchEventInternal( | 995 DispatchEventInternal( |
| 994 profile_->GetOffTheRecordProfile(), | 996 profile_->GetOffTheRecordProfile(), |
| 995 event_name, | 997 event_name, |
| 996 json_args, | 998 json_args, |
| 997 scoped_ptr<base::ListValue>(args->DeepCopy())); | 999 scoped_ptr<base::ListValue>(args->DeepCopy())); |
| 998 } | 1000 } |
| 999 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); | 1001 DispatchEventInternal(profile_, event_name, json_args, args.Pass()); |
| 1000 } | 1002 } |
| OLD | NEW |