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

Side by Side Diff: chrome/browser/extensions/api/bluetooth/bluetooth_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 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 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 SendResponse(false); 308 SendResponse(false);
309 } 309 }
310 310
311 return false; 311 return false;
312 } 312 }
313 313
314 BluetoothAddProfileFunction::BluetoothAddProfileFunction() {} 314 BluetoothAddProfileFunction::BluetoothAddProfileFunction() {}
315 315
316 BluetoothAddProfileFunction::~BluetoothAddProfileFunction() {} 316 BluetoothAddProfileFunction::~BluetoothAddProfileFunction() {}
317 317
318 bool BluetoothAddProfileFunction::RunImpl() { 318 bool BluetoothAddProfileFunction::RunAsync() {
319 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 319 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
320 scoped_ptr<AddProfile::Params> params(AddProfile::Params::Create(*args_)); 320 scoped_ptr<AddProfile::Params> params(AddProfile::Params::Create(*args_));
321 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); 321 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
322 322
323 device::BluetoothUUID uuid(params->profile.uuid); 323 device::BluetoothUUID uuid(params->profile.uuid);
324 324
325 if (!uuid.IsValid()) { 325 if (!uuid.IsValid()) {
326 SetError(kInvalidUuid); 326 SetError(kInvalidUuid);
327 return false; 327 return false;
328 } 328 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 467 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
468 SendResponse(true); 468 SendResponse(true);
469 } 469 }
470 470
471 void BluetoothConnectFunction::OnErrorCallback(const std::string& error) { 471 void BluetoothConnectFunction::OnErrorCallback(const std::string& error) {
472 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 472 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
473 SetError(error); 473 SetError(error);
474 SendResponse(false); 474 SendResponse(false);
475 } 475 }
476 476
477 bool BluetoothDisconnectFunction::RunImpl() { 477 bool BluetoothDisconnectFunction::RunAsync() {
478 // TODO(keybuk): Remove. 478 // TODO(keybuk): Remove.
479 SetError("Removed. Use chrome.bluetoothSocket.disconnect() instead."); 479 SetError("Removed. Use chrome.bluetoothSocket.disconnect() instead.");
480 return false; 480 return false;
481 } 481 }
482 482
483 bool BluetoothSendFunction::RunImpl() { 483 bool BluetoothSendFunction::RunAsync() {
484 // TODO(keybuk): Remove. 484 // TODO(keybuk): Remove.
485 SetError("Removed. Use chrome.bluetoothSocket.send() instead."); 485 SetError("Removed. Use chrome.bluetoothSocket.send() instead.");
486 return false; 486 return false;
487 } 487 }
488 488
489 bool BluetoothUpdateSocketFunction::RunImpl() { 489 bool BluetoothUpdateSocketFunction::RunAsync() {
490 // TODO(keybuk): Remove. 490 // TODO(keybuk): Remove.
491 SetError("Removed. Use chrome.bluetoothSocket.update() instead."); 491 SetError("Removed. Use chrome.bluetoothSocket.update() instead.");
492 return false; 492 return false;
493 } 493 }
494 494
495 bool BluetoothSetSocketPausedFunction::RunImpl() { 495 bool BluetoothSetSocketPausedFunction::RunAsync() {
496 // TODO(keybuk): Remove. 496 // TODO(keybuk): Remove.
497 SetError("Removed. Use chrome.bluetoothSocket.setPaused() instead."); 497 SetError("Removed. Use chrome.bluetoothSocket.setPaused() instead.");
498 return false; 498 return false;
499 } 499 }
500 500
501 bool BluetoothGetSocketFunction::RunImpl() { 501 bool BluetoothGetSocketFunction::RunAsync() {
502 // TODO(keybuk): Remove. 502 // TODO(keybuk): Remove.
503 SetError("Removed. Use chrome.bluetoothSocket.getInfo() instead."); 503 SetError("Removed. Use chrome.bluetoothSocket.getInfo() instead.");
504 return false; 504 return false;
505 } 505 }
506 506
507 bool BluetoothGetSocketsFunction::RunImpl() { 507 bool BluetoothGetSocketsFunction::RunAsync() {
508 // TODO(keybuk): Remove. 508 // TODO(keybuk): Remove.
509 SetError("Removed. Use chrome.bluetoothSocket.getSockets() instead."); 509 SetError("Removed. Use chrome.bluetoothSocket.getSockets() instead.");
510 return false; 510 return false;
511 } 511 }
512 512
513 void BluetoothSetOutOfBandPairingDataFunction::OnSuccessCallback() { 513 void BluetoothSetOutOfBandPairingDataFunction::OnSuccessCallback() {
514 SendResponse(true); 514 SendResponse(true);
515 } 515 }
516 516
517 void BluetoothSetOutOfBandPairingDataFunction::OnErrorCallback() { 517 void BluetoothSetOutOfBandPairingDataFunction::OnErrorCallback() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 adapter, 644 adapter,
645 extension_id(), 645 extension_id(),
646 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), 646 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
647 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); 647 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
648 648
649 return true; 649 return true;
650 } 650 }
651 651
652 } // namespace api 652 } // namespace api
653 } // namespace extensions 653 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698