Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 23658009: Replace mountType by volumeType on fileBrowserPrivate APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 16 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
17 #include "chrome/browser/chromeos/drive/file_system_interface.h" 17 #include "chrome/browser/chromeos/drive/file_system_interface.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 18 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/chromeos/extensions/file_manager/app_id.h" 19 #include "chrome/browser/chromeos/extensions/file_manager/app_id.h"
20 #include "chrome/browser/chromeos/extensions/file_manager/desktop_notifications. h" 20 #include "chrome/browser/chromeos/extensions/file_manager/desktop_notifications. h"
21 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h" 21 #include "chrome/browser/chromeos/extensions/file_manager/fileapi_util.h"
22 #include "chrome/browser/chromeos/extensions/file_manager/mounted_disk_monitor.h " 22 #include "chrome/browser/chromeos/extensions/file_manager/mounted_disk_monitor.h "
23 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h" 23 #include "chrome/browser/chromeos/extensions/file_manager/open_util.h"
24 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
24 #include "chrome/browser/chromeos/extensions/file_manager/volume_manager.h" 25 #include "chrome/browser/chromeos/extensions/file_manager/volume_manager.h"
25 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 26 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
26 #include "chrome/browser/chromeos/login/screen_locker.h" 27 #include "chrome/browser/chromeos/login/screen_locker.h"
27 #include "chrome/browser/drive/drive_service_interface.h" 28 #include "chrome/browser/drive/drive_service_interface.h"
28 #include "chrome/browser/extensions/event_names.h" 29 #include "chrome/browser/extensions/event_names.h"
29 #include "chrome/browser/extensions/event_router.h" 30 #include "chrome/browser/extensions/event_router.h"
30 #include "chrome/browser/extensions/extension_service.h" 31 #include "chrome/browser/extensions/extension_service.h"
31 #include "chrome/browser/extensions/extension_system.h" 32 #include "chrome/browser/extensions/extension_system.h"
32 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 203
203 for (size_t i = 0; i < arraysize(kGooglePlusPhotosIds); ++i) { 204 for (size_t i = 0; i < arraysize(kGooglePlusPhotosIds); ++i) {
204 if (service->GetExtensionById(kGooglePlusPhotosIds[i], 205 if (service->GetExtensionById(kGooglePlusPhotosIds[i],
205 false /* include_disable */) != NULL) 206 false /* include_disable */) != NULL)
206 return true; 207 return true;
207 } 208 }
208 209
209 return false; 210 return false;
210 } 211 }
211 212
213 // This method is temporarily introduced to make a change step by step.
214 // After mounting logic is moved to VolumeManager, this should be removed.
215 std::string MountTypeToString(chromeos::MountType type) {
216 switch (type) {
217 case chromeos::MOUNT_TYPE_INVALID:
218 return "";
219 case chromeos::MOUNT_TYPE_DEVICE:
220 return util::VolumeTypeToString(VOLUME_TYPE_REMOVABLE_DISK_PARTITION);
221 case chromeos::MOUNT_TYPE_ARCHIVE:
222 return util::VolumeTypeToString(VOLUME_TYPE_MOUNTED_ARCHIVE_FILE);
223 case chromeos::MOUNT_TYPE_GOOGLE_DRIVE:
224 return util::VolumeTypeToString(VOLUME_TYPE_GOOGLE_DRIVE);
225 }
226 NOTREACHED();
227 return "";
228 }
229
212 } // namespace 230 } // namespace
213 231
214 // Pass dummy value to JobInfo's constructor for make it default constructible. 232 // Pass dummy value to JobInfo's constructor for make it default constructible.
215 EventRouter::DriveJobInfoWithStatus::DriveJobInfoWithStatus() 233 EventRouter::DriveJobInfoWithStatus::DriveJobInfoWithStatus()
216 : job_info(drive::TYPE_DOWNLOAD_FILE) { 234 : job_info(drive::TYPE_DOWNLOAD_FILE) {
217 } 235 }
218 236
219 EventRouter::DriveJobInfoWithStatus::DriveJobInfoWithStatus( 237 EventRouter::DriveJobInfoWithStatus::DriveJobInfoWithStatus(
220 const drive::JobInfo& info, const std::string& status) 238 const drive::JobInfo& info, const std::string& status)
221 : job_info(info), status(status) { 239 : job_info(info), status(status) {
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 chromeos::MountError error_code, 714 chromeos::MountError error_code,
697 const DiskMountManager::MountPointInfo& mount_info) { 715 const DiskMountManager::MountPointInfo& mount_info) {
698 scoped_ptr<ListValue> args(new ListValue()); 716 scoped_ptr<ListValue> args(new ListValue());
699 DictionaryValue* mount_info_value = new DictionaryValue(); 717 DictionaryValue* mount_info_value = new DictionaryValue();
700 args->Append(mount_info_value); 718 args->Append(mount_info_value);
701 mount_info_value->SetString( 719 mount_info_value->SetString(
702 "eventType", 720 "eventType",
703 event == DiskMountManager::MOUNTING ? "mount" : "unmount"); 721 event == DiskMountManager::MOUNTING ? "mount" : "unmount");
704 mount_info_value->SetString("status", MountErrorToString(error_code)); 722 mount_info_value->SetString("status", MountErrorToString(error_code));
705 mount_info_value->SetString( 723 mount_info_value->SetString(
706 "mountType", 724 "volumeType", MountTypeToString(mount_info.mount_type));
707 DiskMountManager::MountTypeToString(mount_info.mount_type));
708 725
709 // Add sourcePath to the event. 726 // Add sourcePath to the event.
710 mount_info_value->SetString("sourcePath", mount_info.source_path); 727 mount_info_value->SetString("sourcePath", mount_info.source_path);
711 728
712 base::FilePath relative_mount_path; 729 base::FilePath relative_mount_path;
713 730
714 // If there were no error or some special conditions occurred, add mountPath 731 // If there were no error or some special conditions occurred, add mountPath
715 // to the event. 732 // to the event.
716 if (event == DiskMountManager::UNMOUNTING || 733 if (event == DiskMountManager::UNMOUNTING ||
717 error_code == chromeos::MOUNT_ERROR_NONE || 734 error_code == chromeos::MOUNT_ERROR_NONE ||
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 chromeos::MOUNT_TYPE_DEVICE); 881 chromeos::MOUNT_TYPE_DEVICE);
865 } else { 882 } else {
866 notifications_->HideNotification(DesktopNotifications::FORMAT_START, 883 notifications_->HideNotification(DesktopNotifications::FORMAT_START,
867 device_path); 884 device_path);
868 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL, 885 notifications_->ShowNotification(DesktopNotifications::FORMAT_FAIL,
869 device_path); 886 device_path);
870 } 887 }
871 } 888 }
872 889
873 } // namespace file_manager 890 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698