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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 void ExtensionDownloadsEventRouter::ManagerGoingDown( | 911 void ExtensionDownloadsEventRouter::ManagerGoingDown( |
912 DownloadManager* manager) { | 912 DownloadManager* manager) { |
913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 913 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
914 manager_->RemoveObserver(this); | 914 manager_->RemoveObserver(this); |
915 manager_ = NULL; | 915 manager_ = NULL; |
916 } | 916 } |
917 | 917 |
918 void ExtensionDownloadsEventRouter::DispatchEvent( | 918 void ExtensionDownloadsEventRouter::DispatchEvent( |
919 const char* event_name, base::Value* arg) { | 919 const char* event_name, base::Value* arg) { |
920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
921 base::ListValue args; | 921 scoped_ptr<ListValue> args(new ListValue()); |
922 args.Append(arg); | 922 args->Append(arg); |
923 std::string json_args; | 923 std::string json_args; |
924 base::JSONWriter::Write(&args, &json_args); | 924 base::JSONWriter::Write(args.get(), &json_args); |
| 925 |
925 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 926 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
926 event_name, | 927 event_name, |
927 json_args, | 928 args.Pass(), |
928 profile_, | 929 profile_, |
929 GURL(), | 930 GURL(), |
930 extensions::EventFilteringInfo()); | 931 extensions::EventFilteringInfo()); |
931 | 932 |
932 DownloadsNotificationSource notification_source; | 933 DownloadsNotificationSource notification_source; |
933 notification_source.event_name = event_name; | 934 notification_source.event_name = event_name; |
934 notification_source.profile = profile_; | 935 notification_source.profile = profile_; |
935 content::NotificationService::current()->Notify( | 936 content::NotificationService::current()->Notify( |
936 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, | 937 chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT, |
937 content::Source<DownloadsNotificationSource>(¬ification_source), | 938 content::Source<DownloadsNotificationSource>(¬ification_source), |
938 content::Details<std::string>(&json_args)); | 939 content::Details<std::string>(&json_args)); |
939 } | 940 } |
OLD | NEW |