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

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

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 8 years, 1 month 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/system_monitor/removable_device_notifications_window_wi n.h" 5 #include "chrome/browser/system_monitor/removable_device_notifications_window_wi n.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <dbt.h> 8 #include <dbt.h>
9 #include <fileapi.h> 9 #include <fileapi.h>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 window_class_ = RegisterClassEx(&window_class); 81 window_class_ = RegisterClassEx(&window_class);
82 DCHECK(window_class_); 82 DCHECK(window_class_);
83 83
84 window_ = CreateWindow(MAKEINTATOM(window_class_), 0, 0, 0, 0, 0, 0, 0, 0, 84 window_ = CreateWindow(MAKEINTATOM(window_class_), 0, 0, 0, 0, 0, 0, 0, 0,
85 instance_, 0); 85 instance_, 0);
86 SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); 86 SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
87 volume_mount_watcher_->Init(); 87 volume_mount_watcher_->Init();
88 portable_device_watcher_->Init(window_); 88 portable_device_watcher_->Init(window_);
89 } 89 }
90 90
91 bool RemovableDeviceNotificationsWindowWin::GetMTPStorageInfoFromDeviceId(
92 const std::string& storage_device_id,
93 string16* device_location,
94 string16* storage_object_id) {
95 MediaStorageUtil::Type type;
96 MediaStorageUtil::CrackDeviceId(storage_device_id, &type, NULL);
97 if (type != MediaStorageUtil::MTP_OR_PTP)
98 return false;
99 return portable_device_watcher_->GetMTPStorageInfoFromDeviceId(
100 storage_device_id, device_location, storage_object_id);
Peter Kasting 2012/11/01 21:38:37 Nit: Or just: return (type == MediaStorageUtil:
kmadhusu 2012/11/02 03:27:16 Done.
101 }
102
91 bool RemovableDeviceNotificationsWindowWin::GetDeviceInfoForPath( 103 bool RemovableDeviceNotificationsWindowWin::GetDeviceInfoForPath(
92 const FilePath& path, 104 const FilePath& path,
93 base::SystemMonitor::RemovableStorageInfo* device_info) { 105 base::SystemMonitor::RemovableStorageInfo* device_info) {
94 string16 location; 106 string16 location;
95 std::string unique_id; 107 std::string unique_id;
96 string16 name; 108 string16 name;
97 bool removable; 109 bool removable;
98 if (!GetDeviceInfo(path, &location, &unique_id, &name, &removable)) 110 if (!GetDeviceInfo(path, &location, &unique_id, &name, &removable))
99 return false; 111 return false;
100 112
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 unique_id, name, removable); 179 unique_id, name, removable);
168 } 180 }
169 181
170 void RemovableDeviceNotificationsWindowWin::OnDeviceChange(UINT event_type, 182 void RemovableDeviceNotificationsWindowWin::OnDeviceChange(UINT event_type,
171 LPARAM data) { 183 LPARAM data) {
172 volume_mount_watcher_->OnWindowMessage(event_type, data); 184 volume_mount_watcher_->OnWindowMessage(event_type, data);
173 portable_device_watcher_->OnWindowMessage(event_type, data); 185 portable_device_watcher_->OnWindowMessage(event_type, data);
174 } 186 }
175 187
176 } // namespace chrome 188 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698