| OLD | NEW |
| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 0, 0, 0, NULL, NULL, NULL, NULL, NULL, | 272 0, 0, 0, NULL, NULL, NULL, NULL, NULL, |
| 273 &window_class); | 273 &window_class); |
| 274 instance_ = window_class.hInstance; | 274 instance_ = window_class.hInstance; |
| 275 window_class_ = RegisterClassEx(&window_class); | 275 window_class_ = RegisterClassEx(&window_class); |
| 276 DCHECK(window_class_); | 276 DCHECK(window_class_); |
| 277 | 277 |
| 278 window_ = CreateWindow(MAKEINTATOM(window_class_), 0, 0, 0, 0, 0, 0, 0, 0, | 278 window_ = CreateWindow(MAKEINTATOM(window_class_), 0, 0, 0, 0, 0, 0, 0, 0, |
| 279 instance_, 0); | 279 instance_, 0); |
| 280 SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); | 280 SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this)); |
| 281 | 281 |
| 282 std::vector<FilePath> removable_devices = get_attached_devices_func(); | 282 // Disable detection of attached devices during start up (except for tests) |
| 283 for (size_t i = 0; i < removable_devices.size(); i++) | 283 // to track down http://crbug.com/150608 Revert if it turns out not to be |
| 284 AddNewDevice(removable_devices[i]); | 284 // the problem. |
| 285 if (get_attached_devices_func != GetAttachedDevices) { |
| 286 std::vector<FilePath> removable_devices = get_attached_devices_func(); |
| 287 for (size_t i = 0; i < removable_devices.size(); i++) |
| 288 AddNewDevice(removable_devices[i]); |
| 289 } |
| 285 } | 290 } |
| 286 | 291 |
| 287 void RemovableDeviceNotificationsWindowWin::AddNewDevice( | 292 void RemovableDeviceNotificationsWindowWin::AddNewDevice( |
| 288 const FilePath& device_path) { | 293 const FilePath& device_path) { |
| 289 std::string unique_id; | 294 std::string unique_id; |
| 290 string16 device_name; | 295 string16 device_name; |
| 291 bool removable; | 296 bool removable; |
| 292 if (!get_device_info_func_(device_path, NULL, &unique_id, &device_name, | 297 if (!get_device_info_func_(device_path, NULL, &unique_id, &device_name, |
| 293 &removable)) { | 298 &removable)) { |
| 294 return; | 299 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 330 | 335 |
| 331 // TODO(kmadhusu) Record device info histogram. | 336 // TODO(kmadhusu) Record device info histogram. |
| 332 device_ids_[device] = device_id; | 337 device_ids_[device] = device_id; |
| 333 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, | 338 SystemMonitor::Get()->ProcessRemovableStorageAttached(device_id, |
| 334 device_name, | 339 device_name, |
| 335 device.value()); | 340 device.value()); |
| 336 } | 341 } |
| 337 | 342 |
| 338 } // namespace chrome | 343 } // namespace chrome |
| OLD | NEW |