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

Side by Side Diff: chrome/browser/system_monitor/media_device_notifications_chromeos.cc

Issue 10917166: Extend the capability of SystemMonitor to support watching storage free space change (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: updated patch Created 8 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
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 // chromeos::MediaDeviceNotifications implementation. 5 // chromeos::MediaDeviceNotifications implementation.
6 6
7 #include "chrome/browser/system_monitor/media_device_notifications_chromeos.h" 7 #include "chrome/browser/system_monitor/media_device_notifications_chromeos.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 using content::BrowserThread; 43 using content::BrowserThread;
44 44
45 MediaDeviceNotifications::MediaDeviceNotifications() { 45 MediaDeviceNotifications::MediaDeviceNotifications() {
46 DCHECK(disks::DiskMountManager::GetInstance()); 46 DCHECK(disks::DiskMountManager::GetInstance());
47 disks::DiskMountManager::GetInstance()->AddObserver(this); 47 disks::DiskMountManager::GetInstance()->AddObserver(this);
48 CheckExistingMountPointsOnUIThread(); 48 CheckExistingMountPointsOnUIThread();
49 if (base::SystemMonitor::Get())
50 base::SystemMonitor::Get()->set_storage_free_space_delegate(this);
49 } 51 }
50 52
51 MediaDeviceNotifications::~MediaDeviceNotifications() { 53 MediaDeviceNotifications::~MediaDeviceNotifications() {
54 if (base::SystemMonitor::Get() &&
55 base::SystemMonitor::Get()->storage_free_space_delegate())
56 base::SystemMonitor::Get()->set_storage_free_space_delegate(NULL);
57
52 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance(); 58 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
53 if (manager) { 59 if (manager) {
54 manager->RemoveObserver(this); 60 manager->RemoveObserver(this);
55 } 61 }
56 } 62 }
57 63
58 void MediaDeviceNotifications::CheckExistingMountPointsOnUIThread() { 64 void MediaDeviceNotifications::CheckExistingMountPointsOnUIThread() {
59 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
60 const disks::DiskMountManager::MountPointMap& mount_point_map = 66 const disks::DiskMountManager::MountPointMap& mount_point_map =
61 disks::DiskMountManager::GetInstance()->mount_points(); 67 disks::DiskMountManager::GetInstance()->mount_points();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 159
154 std::string device_id = chrome::MediaStorageUtil::MakeDeviceId( 160 std::string device_id = chrome::MediaStorageUtil::MakeDeviceId(
155 chrome::MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id); 161 chrome::MediaStorageUtil::REMOVABLE_MASS_STORAGE_WITH_DCIM, unique_id);
156 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id)); 162 mount_map_.insert(std::make_pair(mount_info.mount_path, device_id));
157 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( 163 base::SystemMonitor::Get()->ProcessRemovableStorageAttached(
158 device_id, 164 device_id,
159 device_label, 165 device_label,
160 mount_info.mount_path); 166 mount_info.mount_path);
161 } 167 }
162 168
169 void MediaDeviceNotifications::StartWatchingStorage(const FilePath& path) {
170 NOTIMPLEMENTED();
171 }
172
173 void MediaDeviceNotifications::StopWatchingStorage(const FilePath& path) {
174 NOTIMPLEMENTED();
175 }
176
163 } // namespace chrome 177 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698