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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 event_type == chromeos::MountLibrary::MOUNTING) { | 203 event_type == chromeos::MountLibrary::MOUNTING) { |
204 chromeos::MountLibrary* mount_lib = | 204 chromeos::MountLibrary* mount_lib = |
205 chromeos::CrosLibrary::Get()->GetMountLibrary(); | 205 chromeos::CrosLibrary::Get()->GetMountLibrary(); |
206 if (mount_lib->disks().find(mount_info.source_path) == | 206 if (mount_lib->disks().find(mount_info.source_path) == |
207 mount_lib->disks().end()) { | 207 mount_lib->disks().end()) { |
208 return; | 208 return; |
209 } | 209 } |
210 chromeos::MountLibrary::Disk* disk = | 210 chromeos::MountLibrary::Disk* disk = |
211 mount_lib->disks().find(mount_info.source_path)->second; | 211 mount_lib->disks().find(mount_info.source_path)->second; |
212 | 212 |
213 std::string notification_sys_path = | |
214 disk->system_path().substr(0, disk->system_path().rfind("/block")); | |
zel
2011/08/25 13:50:47
/block feels bit too platform specific. i.e. new k
| |
215 | |
213 if (!error_code) { | 216 if (!error_code) { |
214 HideFileBrowserNotification("MOUNT", disk->system_path()); | 217 HideFileBrowserNotification("MOUNT", disk->system_path()); |
215 } else { | 218 } else { |
216 HideFileBrowserNotification("MOUNT", disk->system_path()); | 219 HideFileBrowserNotification("MOUNT", disk->system_path()); |
217 if (!disk->drive_label().empty()) { | 220 if (!disk->drive_label().empty()) { |
218 ShowFileBrowserNotification("MOUNT", disk->system_path(), | 221 ShowFileBrowserNotification("MOUNT", notification_sys_path, |
zel
2011/08/25 13:50:47
make "MOUNT' constant
| |
219 IDR_PAGEINFO_INFO, | 222 IDR_PAGEINFO_INFO, |
220 l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE), | 223 l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE), |
221 // TODO(tbarzic): Find more suitable message. | 224 // TODO(tbarzic): Find more suitable message. |
222 l10n_util::GetStringFUTF16( | 225 l10n_util::GetStringFUTF16( |
223 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, | 226 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, |
224 ASCIIToUTF16(disk->drive_label()), | 227 ASCIIToUTF16(disk->drive_label()), |
225 ASCIIToUTF16(MountErrorToString(error_code)))); | 228 ASCIIToUTF16(MountErrorToString(error_code)))); |
226 } else { | 229 } else { |
227 ShowFileBrowserNotification("MOUNT", disk->system_path(), | 230 ShowFileBrowserNotification("MOUNT", notification_sys_path, |
228 IDR_PAGEINFO_INFO, | 231 IDR_PAGEINFO_INFO, |
229 l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE), | 232 l10n_util::GetStringUTF16(IDS_REMOVABLE_DEVICE_DETECTION_TITLE), |
230 // TODO(tbarzic): Find more suitable message. | 233 // TODO(tbarzic): Find more suitable message. |
231 l10n_util::GetStringFUTF16( | 234 l10n_util::GetStringFUTF16( |
232 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, | 235 IDS_FILE_BROWSER_ARCHIVE_MOUNT_FAILED, |
233 l10n_util::GetStringUTF16( | 236 l10n_util::GetStringUTF16( |
234 IDS_FILE_BROWSER_DEVICE_TYPE_UNDEFINED), | 237 IDS_FILE_BROWSER_DEVICE_TYPE_UNDEFINED), |
235 ASCIIToUTF16(MountErrorToString(error_code)))); | 238 ASCIIToUTF16(MountErrorToString(error_code)))); |
236 } | 239 } |
237 } | 240 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 &FileWatcherDelegate::HandleFileWatchOnUIThread, | 545 &FileWatcherDelegate::HandleFileWatchOnUIThread, |
543 local_path, | 546 local_path, |
544 true)); // got_error | 547 true)); // got_error |
545 } | 548 } |
546 | 549 |
547 void | 550 void |
548 ExtensionFileBrowserEventRouter::FileWatcherDelegate::HandleFileWatchOnUIThread( | 551 ExtensionFileBrowserEventRouter::FileWatcherDelegate::HandleFileWatchOnUIThread( |
549 const FilePath& local_path, bool got_error) { | 552 const FilePath& local_path, bool got_error) { |
550 router_->HandleFileWatchNotification(local_path, got_error); | 553 router_->HandleFileWatchNotification(local_path, got_error); |
551 } | 554 } |
OLD | NEW |