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

Side by Side Diff: chrome/browser/media_galleries/media_galleries_dialog_controller.cc

Issue 15988011: Refine StorageMonitor storage device getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix SystemInfoStorageApiTest failures in browser_tests Created 7 years, 6 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
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/media_galleries/media_galleries_dialog_controller.h" 5 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 14 matching lines...) Expand all
25 using extensions::Extension; 25 using extensions::Extension;
26 26
27 namespace chrome { 27 namespace chrome {
28 28
29 namespace { 29 namespace {
30 30
31 bool IsAttachedDevice(const std::string& device_id) { 31 bool IsAttachedDevice(const std::string& device_id) {
32 if (!StorageInfo::IsRemovableDevice(device_id)) 32 if (!StorageInfo::IsRemovableDevice(device_id))
33 return false; 33 return false;
34 34
35 std::vector<StorageInfo> removable_storages = 35 std::vector<StorageInfo> storages =
36 StorageMonitor::GetInstance()->GetAttachedStorage(); 36 StorageMonitor::GetInstance()->GetAllAvailableStorages();
37 for (size_t i = 0; i < removable_storages.size(); ++i) { 37 for (size_t i = 0; i < storages.size(); ++i) {
38 if (removable_storages[i].device_id() == device_id) 38 if (storages[i].device_id() == device_id)
39 return true; 39 return true;
40 } 40 }
41 return false; 41 return false;
42 } 42 }
43 43
44 // Comparator for sorting GalleryPermissionsVector -- sorts 44 // Comparator for sorting GalleryPermissionsVector -- sorts
45 // allowed galleries low, and then sorts by absolute path. 45 // allowed galleries low, and then sorts by absolute path.
46 bool GalleriesVectorComparator( 46 bool GalleriesVectorComparator(
47 const MediaGalleriesDialogController::GalleryPermission& a, 47 const MediaGalleriesDialogController::GalleryPermission& a,
48 const MediaGalleriesDialogController::GalleryPermission& b) { 48 const MediaGalleriesDialogController::GalleryPermission& b) {
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 if (iter->pref_info.device_id == device_id) 511 if (iter->pref_info.device_id == device_id)
512 dialog_->UpdateGallery(iter->pref_info, iter->allowed); 512 dialog_->UpdateGallery(iter->pref_info, iter->allowed);
513 } 513 }
514 } 514 }
515 515
516 // MediaGalleries dialog ------------------------------------------------------- 516 // MediaGalleries dialog -------------------------------------------------------
517 517
518 MediaGalleriesDialog::~MediaGalleriesDialog() {} 518 MediaGalleriesDialog::~MediaGalleriesDialog() {}
519 519
520 } // namespace chrome 520 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698