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

Side by Side Diff: device/media_transfer_protocol/media_transfer_protocol_manager.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
« no previous file with comments | « device/bluetooth/bluetooth_utils.cc ('k') | extensions/common/extension_resource_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "device/media_transfer_protocol/media_transfer_protocol_manager.h" 5 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return NULL; 104 return NULL;
105 return &it->second; 105 return &it->second;
106 } 106 }
107 107
108 // MediaTransferProtocolManager override. 108 // MediaTransferProtocolManager override.
109 virtual void OpenStorage(const std::string& storage_name, 109 virtual void OpenStorage(const std::string& storage_name,
110 const std::string& mode, 110 const std::string& mode,
111 const OpenStorageCallback& callback) OVERRIDE { 111 const OpenStorageCallback& callback) OVERRIDE {
112 DCHECK(thread_checker_.CalledOnValidThread()); 112 DCHECK(thread_checker_.CalledOnValidThread());
113 if (!ContainsKey(storage_info_map_, storage_name)) { 113 if (!ContainsKey(storage_info_map_, storage_name)) {
114 callback.Run("", true); 114 callback.Run(std::string(), true);
115 return; 115 return;
116 } 116 }
117 open_storage_callbacks_.push(callback); 117 open_storage_callbacks_.push(callback);
118 mtp_client_->OpenStorage( 118 mtp_client_->OpenStorage(
119 storage_name, 119 storage_name,
120 mode, 120 mode,
121 base::Bind(&MediaTransferProtocolManagerImpl::OnOpenStorage, 121 base::Bind(&MediaTransferProtocolManagerImpl::OnOpenStorage,
122 weak_ptr_factory_.GetWeakPtr()), 122 weak_ptr_factory_.GetWeakPtr()),
123 base::Bind(&MediaTransferProtocolManagerImpl::OnOpenStorageError, 123 base::Bind(&MediaTransferProtocolManagerImpl::OnOpenStorageError,
124 weak_ptr_factory_.GetWeakPtr())); 124 weak_ptr_factory_.GetWeakPtr()));
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 StorageChanged(true /* is attach */, storage_name)); 326 StorageChanged(true /* is attach */, storage_name));
327 } 327 }
328 328
329 void OnOpenStorage(const std::string& handle) { 329 void OnOpenStorage(const std::string& handle) {
330 DCHECK(thread_checker_.CalledOnValidThread()); 330 DCHECK(thread_checker_.CalledOnValidThread());
331 if (!ContainsKey(handles_, handle)) { 331 if (!ContainsKey(handles_, handle)) {
332 handles_.insert(handle); 332 handles_.insert(handle);
333 open_storage_callbacks_.front().Run(handle, false); 333 open_storage_callbacks_.front().Run(handle, false);
334 } else { 334 } else {
335 NOTREACHED(); 335 NOTREACHED();
336 open_storage_callbacks_.front().Run("", true); 336 open_storage_callbacks_.front().Run(std::string(), true);
337 } 337 }
338 open_storage_callbacks_.pop(); 338 open_storage_callbacks_.pop();
339 } 339 }
340 340
341 void OnOpenStorageError() { 341 void OnOpenStorageError() {
342 open_storage_callbacks_.front().Run("", true); 342 open_storage_callbacks_.front().Run(std::string(), true);
343 open_storage_callbacks_.pop(); 343 open_storage_callbacks_.pop();
344 } 344 }
345 345
346 void OnCloseStorage() { 346 void OnCloseStorage() {
347 DCHECK(thread_checker_.CalledOnValidThread()); 347 DCHECK(thread_checker_.CalledOnValidThread());
348 const std::string& handle = close_storage_callbacks_.front().second; 348 const std::string& handle = close_storage_callbacks_.front().second;
349 if (ContainsKey(handles_, handle)) { 349 if (ContainsKey(handles_, handle)) {
350 handles_.erase(handle); 350 handles_.erase(handle);
351 close_storage_callbacks_.front().first.Run(false); 351 close_storage_callbacks_.front().first.Run(false);
352 } else { 352 } else {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 g_media_transfer_protocol_manager = NULL; 456 g_media_transfer_protocol_manager = NULL;
457 VLOG(1) << "MediaTransferProtocolManager Shutdown completed"; 457 VLOG(1) << "MediaTransferProtocolManager Shutdown completed";
458 } 458 }
459 459
460 // static 460 // static
461 MediaTransferProtocolManager* MediaTransferProtocolManager::GetInstance() { 461 MediaTransferProtocolManager* MediaTransferProtocolManager::GetInstance() {
462 return g_media_transfer_protocol_manager; 462 return g_media_transfer_protocol_manager;
463 } 463 }
464 464
465 } // namespace device 465 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_utils.cc ('k') | extensions/common/extension_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698