| 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_manager/event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/event_router.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/app_mode/app_mode_utils.h" | 15 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 18 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 18 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 19 #include "chrome/browser/chromeos/drive/file_system_util.h" | 19 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 20 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 20 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 21 #include "chrome/browser/chromeos/file_manager/app_id.h" | 21 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 23 #include "chrome/browser/chromeos/file_manager/open_util.h" | 23 #include "chrome/browser/chromeos/file_manager/open_util.h" |
| 24 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 24 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 25 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 25 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 26 #include "chrome/browser/chromeos/login/screen_locker.h" | 26 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 27 #include "chrome/browser/drive/drive_service_interface.h" | 27 #include "chrome/browser/drive/drive_service_interface.h" |
| 28 #include "chrome/browser/extensions/extension_service.h" | 28 #include "chrome/browser/extensions/extension_service.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
| 31 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 32 #include "chromeos/login/login_state.h" | 32 #include "chromeos/login/login_state.h" |
| 33 #include "chromeos/network/network_handler.h" | 33 #include "chromeos/network/network_handler.h" |
| 34 #include "chromeos/network/network_state_handler.h" | 34 #include "chromeos/network/network_state_handler.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/notification_source.h" | 36 #include "content/public/browser/notification_source.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 void DirectoryExistsOnBlockingPool(const base::FilePath& directory_path, | 58 void DirectoryExistsOnBlockingPool(const base::FilePath& directory_path, |
| 59 const base::Closure& success_callback, | 59 const base::Closure& success_callback, |
| 60 const base::Closure& failure_callback) { | 60 const base::Closure& failure_callback) { |
| 61 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 61 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 62 | 62 |
| 63 if (base::DirectoryExists(directory_path)) | 63 if (base::DirectoryExists(directory_path)) |
| 64 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, success_callback); | 64 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, success_callback); |
| 65 else | 65 else |
| 66 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, failure_callback); | 66 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, failure_callback); |
| 67 }; | 67 } |
| 68 | 68 |
| 69 void DirectoryExistsOnUIThread(const base::FilePath& directory_path, | 69 void DirectoryExistsOnUIThread(const base::FilePath& directory_path, |
| 70 const base::Closure& success_callback, | 70 const base::Closure& success_callback, |
| 71 const base::Closure& failure_callback) { | 71 const base::Closure& failure_callback) { |
| 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 73 | 73 |
| 74 content::BrowserThread::PostBlockingPoolTask( | 74 content::BrowserThread::PostBlockingPoolTask( |
| 75 FROM_HERE, | 75 FROM_HERE, |
| 76 base::Bind(&DirectoryExistsOnBlockingPool, | 76 base::Bind(&DirectoryExistsOnBlockingPool, |
| 77 directory_path, | 77 directory_path, |
| 78 success_callback, | 78 success_callback, |
| 79 failure_callback)); | 79 failure_callback)); |
| 80 }; | 80 } |
| 81 | 81 |
| 82 // Constants for the "transferState" field of onFileTransferUpdated event. | 82 // Constants for the "transferState" field of onFileTransferUpdated event. |
| 83 const char kFileTransferStateStarted[] = "started"; | 83 const char kFileTransferStateStarted[] = "started"; |
| 84 const char kFileTransferStateInProgress[] = "in_progress"; | 84 const char kFileTransferStateInProgress[] = "in_progress"; |
| 85 const char kFileTransferStateCompleted[] = "completed"; | 85 const char kFileTransferStateCompleted[] = "completed"; |
| 86 const char kFileTransferStateFailed[] = "failed"; | 86 const char kFileTransferStateFailed[] = "failed"; |
| 87 | 87 |
| 88 // Frequency of sending onFileTransferUpdated. | 88 // Frequency of sending onFileTransferUpdated. |
| 89 const int64 kProgressEventFrequencyInMilliseconds = 1000; | 89 const int64 kProgressEventFrequencyInMilliseconds = 1000; |
| 90 | 90 |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 } | 941 } |
| 942 } | 942 } |
| 943 | 943 |
| 944 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { | 944 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { |
| 945 BroadcastEvent(profile_, | 945 BroadcastEvent(profile_, |
| 946 file_browser_private::OnDesktopChanged::kEventName, | 946 file_browser_private::OnDesktopChanged::kEventName, |
| 947 file_browser_private::OnDesktopChanged::Create()); | 947 file_browser_private::OnDesktopChanged::Create()); |
| 948 } | 948 } |
| 949 | 949 |
| 950 } // namespace file_manager | 950 } // namespace file_manager |
| OLD | NEW |