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/chromeos/extensions/file_browser_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 | 234 |
235 void FileBrowserEventRouter::HandleProgressUpdateForExtensionAPI( | 235 void FileBrowserEventRouter::HandleProgressUpdateForExtensionAPI( |
236 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { | 236 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { |
237 scoped_ptr<ListValue> event_list( | 237 scoped_ptr<ListValue> event_list( |
238 file_manager_util::ProgressStatusVectorToListValue( | 238 file_manager_util::ProgressStatusVectorToListValue( |
239 profile_, | 239 profile_, |
240 file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(), | 240 file_manager_util::GetFileBrowserExtensionUrl().GetOrigin(), |
241 list)); | 241 list)); |
242 | 242 |
| 243 ListValue args; |
| 244 args.Append(event_list.release()); |
| 245 |
243 std::string args_json; | 246 std::string args_json; |
244 base::JSONWriter::Write(event_list.get(), | 247 base::JSONWriter::Write(&args, |
245 &args_json); | 248 &args_json); |
246 | 249 |
247 profile_->GetExtensionEventRouter()->DispatchEventToExtension( | 250 profile_->GetExtensionEventRouter()->DispatchEventToExtension( |
248 std::string(kFileBrowserDomain), | 251 std::string(kFileBrowserDomain), |
249 extension_event_names::kOnFileTransfersUpdated, args_json, | 252 extension_event_names::kOnFileTransfersUpdated, args_json, |
250 NULL, GURL()); | 253 NULL, GURL()); |
251 } | 254 } |
252 | 255 |
253 void FileBrowserEventRouter::HandleProgressUpdateForSystemNotification( | 256 void FileBrowserEventRouter::HandleProgressUpdateForSystemNotification( |
254 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { | 257 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 return scoped_refptr<RefcountedProfileKeyedService>( | 621 return scoped_refptr<RefcountedProfileKeyedService>( |
619 new FileBrowserEventRouter(profile)); | 622 new FileBrowserEventRouter(profile)); |
620 } | 623 } |
621 | 624 |
622 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { | 625 bool FileBrowserEventRouterFactory::ServiceHasOwnInstanceInIncognito() { |
623 // Explicitly and always allow this router in guest login mode. see | 626 // Explicitly and always allow this router in guest login mode. see |
624 // chrome/browser/profiles/profile_keyed_base_factory.h comment | 627 // chrome/browser/profiles/profile_keyed_base_factory.h comment |
625 // for the details. | 628 // for the details. |
626 return true; | 629 return true; |
627 } | 630 } |
OLD | NEW |