| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 chromeos::MountLibrary::MountEvent event_type, | 177 chromeos::MountLibrary::MountEvent event_type, |
| 178 chromeos::MountError error_code, | 178 chromeos::MountError error_code, |
| 179 const chromeos::MountLibrary::MountPointInfo& mount_info) { | 179 const chromeos::MountLibrary::MountPointInfo& mount_info) { |
| 180 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && | 180 if (mount_info.mount_type == chromeos::MOUNT_TYPE_DEVICE && |
| 181 event_type == chromeos::MountLibrary::MOUNTING) { | 181 event_type == chromeos::MountLibrary::MOUNTING) { |
| 182 chromeos::MountLibrary* mount_lib = | 182 chromeos::MountLibrary* mount_lib = |
| 183 chromeos::CrosLibrary::Get()->GetMountLibrary(); | 183 chromeos::CrosLibrary::Get()->GetMountLibrary(); |
| 184 chromeos::MountLibrary::Disk* disk = | 184 chromeos::MountLibrary::Disk* disk = |
| 185 mount_lib->disks().find(mount_info.source_path)->second; | 185 mount_lib->disks().find(mount_info.source_path)->second; |
| 186 | 186 |
| 187 std::string notification_sys_path = |
| 188 disk->system_path().substr(0, disk->system_path().rfind("/block")); |
| 189 |
| 187 if (!error_code) { | 190 if (!error_code) { |
| 188 HideDeviceNotification(disk->system_path()); | 191 HideDeviceNotification(disk->system_path()); |
| 189 } else { | 192 } else { |
| 190 HideDeviceNotification(disk->system_path()); | 193 HideDeviceNotification(disk->system_path()); |
| 191 if (!disk->drive_label().empty()) { | 194 if (!disk->drive_label().empty()) { |
| 192 ShowDeviceNotification(disk->system_path(), | 195 ShowDeviceNotification(notification_sys_path, |
| 193 IDR_PAGEINFO_INFO, | 196 IDR_PAGEINFO_INFO, |
| 194 // TODO(tbarzic): Find more suitable message. | 197 // TODO(tbarzic): Find more suitable message. |
| 195 l10n_util::GetStringFUTF16( | 198 l10n_util::GetStringFUTF16( |
| 196 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, | 199 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, |
| 197 ASCIIToUTF16(disk->drive_label()), | 200 ASCIIToUTF16(disk->drive_label()), |
| 198 ASCIIToUTF16(MountErrorToString(error_code)))); | 201 ASCIIToUTF16(MountErrorToString(error_code)))); |
| 199 } else { | 202 } else { |
| 200 ShowDeviceNotification(disk->system_path(), | 203 ShowDeviceNotification(notification_sys_path, |
| 201 IDR_PAGEINFO_INFO, | 204 IDR_PAGEINFO_INFO, |
| 202 // TODO(tbarzic): Find more suitable message. | 205 // TODO(tbarzic): Find more suitable message. |
| 203 l10n_util::GetStringFUTF16( | 206 l10n_util::GetStringFUTF16( |
| 204 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, | 207 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, |
| 205 l10n_util::GetStringUTF16( | 208 l10n_util::GetStringUTF16( |
| 206 IDS_FILE_BROWSER_DEVICE_TYPE_UNDEFINED), | 209 IDS_FILE_BROWSER_DEVICE_TYPE_UNDEFINED), |
| 207 ASCIIToUTF16(MountErrorToString(error_code)))); | 210 ASCIIToUTF16(MountErrorToString(error_code)))); |
| 208 } | 211 } |
| 209 } | 212 } |
| 210 } | 213 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 &FileWatcherDelegate::HandleFileWatchOnUIThread, | 465 &FileWatcherDelegate::HandleFileWatchOnUIThread, |
| 463 local_path, | 466 local_path, |
| 464 true)); // got_error | 467 true)); // got_error |
| 465 } | 468 } |
| 466 | 469 |
| 467 void | 470 void |
| 468 ExtensionFileBrowserEventRouter::FileWatcherDelegate::HandleFileWatchOnUIThread( | 471 ExtensionFileBrowserEventRouter::FileWatcherDelegate::HandleFileWatchOnUIThread( |
| 469 const FilePath& local_path, bool got_error) { | 472 const FilePath& local_path, bool got_error) { |
| 470 router_->HandleFileWatchNotification(local_path, got_error); | 473 router_->HandleFileWatchNotification(local_path, got_error); |
| 471 } | 474 } |
| OLD | NEW |