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

Side by Side Diff: chrome/browser/storage_monitor/portable_device_watcher_win.cc

Issue 113403006: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | 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 // Any tasks that communicates with the portable device may take >100ms to 5 // Any tasks that communicates with the portable device may take >100ms to
6 // complete. Those tasks should be run on an blocking thread instead of the 6 // complete. Those tasks should be run on an blocking thread instead of the
7 // UI thread. 7 // UI thread.
8 8
9 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h" 9 #include "chrome/browser/storage_monitor/portable_device_watcher_win.h"
10 10
(...skipping 10 matching lines...) Expand all
21 #include "base/win/scoped_comptr.h" 21 #include "base/win/scoped_comptr.h"
22 #include "base/win/scoped_propvariant.h" 22 #include "base/win/scoped_propvariant.h"
23 #include "chrome/browser/storage_monitor/media_storage_util.h" 23 #include "chrome/browser/storage_monitor/media_storage_util.h"
24 #include "chrome/browser/storage_monitor/removable_device_constants.h" 24 #include "chrome/browser/storage_monitor/removable_device_constants.h"
25 #include "chrome/browser/storage_monitor/storage_info.h" 25 #include "chrome/browser/storage_monitor/storage_info.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 27
28 namespace { 28 namespace {
29 29
30 // Name of the client application that communicates with the MTP device. 30 // Name of the client application that communicates with the MTP device.
31 const char16 kClientName[] = L"Chromium"; 31 const base::char16 kClientName[] = L"Chromium";
32 32
33 // Name of the sequenced task runner. 33 // Name of the sequenced task runner.
34 const char kMediaTaskRunnerName[] = "media-task-runner"; 34 const char kMediaTaskRunnerName[] = "media-task-runner";
35 35
36 // Returns true if |data| represents a class of portable devices. 36 // Returns true if |data| represents a class of portable devices.
37 bool IsPortableDeviceStructure(LPARAM data) { 37 bool IsPortableDeviceStructure(LPARAM data) {
38 DEV_BROADCAST_HDR* broadcast_hdr = 38 DEV_BROADCAST_HDR* broadcast_hdr =
39 reinterpret_cast<DEV_BROADCAST_HDR*>(data); 39 reinterpret_cast<DEV_BROADCAST_HDR*>(data);
40 if (!broadcast_hdr || 40 if (!broadcast_hdr ||
41 (broadcast_hdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE)) { 41 (broadcast_hdr->dbch_devicetype != DBT_DEVTYP_DEVICEINTERFACE)) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 hr = (*properties_to_read)->Add(key); 188 hr = (*properties_to_read)->Add(key);
189 return SUCCEEDED(hr); 189 return SUCCEEDED(hr);
190 } 190 }
191 191
192 // Wrapper function to get content property string value. 192 // Wrapper function to get content property string value.
193 bool GetStringPropertyValue(IPortableDeviceValues* properties_values, 193 bool GetStringPropertyValue(IPortableDeviceValues* properties_values,
194 REFPROPERTYKEY key, 194 REFPROPERTYKEY key,
195 base::string16* value) { 195 base::string16* value) {
196 DCHECK(properties_values); 196 DCHECK(properties_values);
197 DCHECK(value); 197 DCHECK(value);
198 base::win::ScopedCoMem<char16> buffer; 198 base::win::ScopedCoMem<base::char16> buffer;
199 HRESULT hr = properties_values->GetStringValue(key, &buffer); 199 HRESULT hr = properties_values->GetStringValue(key, &buffer);
200 if (FAILED(hr)) 200 if (FAILED(hr))
201 return false; 201 return false;
202 *value = static_cast<const char16*>(buffer); 202 *value = static_cast<const base::char16*>(buffer);
203 return true; 203 return true;
204 } 204 }
205 205
206 // Constructs a unique identifier for the object specified by the |object_id|. 206 // Constructs a unique identifier for the object specified by the |object_id|.
207 // On success, returns true and fills in |unique_id|. 207 // On success, returns true and fills in |unique_id|.
208 bool GetObjectUniqueId(IPortableDevice* device, 208 bool GetObjectUniqueId(IPortableDevice* device,
209 const base::string16& object_id, 209 const base::string16& object_id,
210 base::string16* unique_id) { 210 base::string16* unique_id) {
211 DCHECK(device); 211 DCHECK(device);
212 DCHECK(unique_id); 212 DCHECK(unique_id);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 base::win::ScopedComPtr<IPortableDeviceManager> portable_device_mgr; 406 base::win::ScopedComPtr<IPortableDeviceManager> portable_device_mgr;
407 if (!GetPortableDeviceManager(&portable_device_mgr)) 407 if (!GetPortableDeviceManager(&portable_device_mgr))
408 return false; 408 return false;
409 409
410 // Get the total number of devices found on the system. 410 // Get the total number of devices found on the system.
411 DWORD pnp_device_count = 0; 411 DWORD pnp_device_count = 0;
412 HRESULT hr = portable_device_mgr->GetDevices(NULL, &pnp_device_count); 412 HRESULT hr = portable_device_mgr->GetDevices(NULL, &pnp_device_count);
413 if (FAILED(hr)) 413 if (FAILED(hr))
414 return false; 414 return false;
415 415
416 scoped_ptr<char16*[]> pnp_device_ids(new char16*[pnp_device_count]); 416 scoped_ptr<base::char16*[]> pnp_device_ids(
417 new base::char16*[pnp_device_count]);
417 hr = portable_device_mgr->GetDevices(pnp_device_ids.get(), &pnp_device_count); 418 hr = portable_device_mgr->GetDevices(pnp_device_ids.get(), &pnp_device_count);
418 if (FAILED(hr)) 419 if (FAILED(hr))
419 return false; 420 return false;
420 421
421 for (DWORD index = 0; index < pnp_device_count; ++index) { 422 for (DWORD index = 0; index < pnp_device_count; ++index) {
422 PortableDeviceWatcherWin::DeviceDetails device_details; 423 PortableDeviceWatcherWin::DeviceDetails device_details;
423 if (GetDeviceInfoOnBlockingThread( 424 if (GetDeviceInfoOnBlockingThread(
424 portable_device_mgr, pnp_device_ids[index], &device_details)) 425 portable_device_mgr, pnp_device_ids[index], &device_details))
425 devices->push_back(device_details); 426 devices->push_back(device_details);
426 CoTaskMemFree(pnp_device_ids[index]); 427 CoTaskMemFree(pnp_device_ids[index]);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 MTPStorageMap::iterator storage_map_iter = storage_map_.find(storage_id); 659 MTPStorageMap::iterator storage_map_iter = storage_map_.find(storage_id);
659 DCHECK(storage_map_iter != storage_map_.end()); 660 DCHECK(storage_map_iter != storage_map_.end());
660 if (storage_notifications_) { 661 if (storage_notifications_) {
661 storage_notifications_->ProcessDetach( 662 storage_notifications_->ProcessDetach(
662 storage_map_iter->second.device_id()); 663 storage_map_iter->second.device_id());
663 } 664 }
664 storage_map_.erase(storage_map_iter); 665 storage_map_.erase(storage_map_iter);
665 } 666 }
666 device_map_.erase(device_iter); 667 device_map_.erase(device_iter);
667 } 668 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_host_metrics.cc ('k') | chrome/browser/storage_monitor/removable_device_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698