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

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: appshell 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (router) 293 if (router)
294 router->DispatchEventToExtension(params.extension_id, event.Pass()); 294 router->DispatchEventToExtension(params.extension_id, event.Pass());
295 } 295 }
296 296
297 namespace api { 297 namespace api {
298 298
299 BluetoothSocketApiFunction::BluetoothSocketApiFunction() {} 299 BluetoothSocketApiFunction::BluetoothSocketApiFunction() {}
300 300
301 BluetoothSocketApiFunction::~BluetoothSocketApiFunction() {} 301 BluetoothSocketApiFunction::~BluetoothSocketApiFunction() {}
302 302
303 bool BluetoothSocketApiFunction::RunImpl() { 303 bool BluetoothSocketApiFunction::RunAsync() {
304 if (!PrePrepare() || !Prepare()) { 304 if (!PrePrepare() || !Prepare()) {
305 return false; 305 return false;
306 } 306 }
307 AsyncWorkStart(); 307 AsyncWorkStart();
308 return true; 308 return true;
309 } 309 }
310 310
311 bool BluetoothSocketApiFunction::PrePrepare() { 311 bool BluetoothSocketApiFunction::PrePrepare() {
312 socket_data_ = BluetoothAPI::Get(browser_context())->socket_data(); 312 socket_data_ = BluetoothAPI::Get(browser_context())->socket_data();
313 socket_event_dispatcher_ = 313 socket_event_dispatcher_ =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 SendResponse(false); 387 SendResponse(false);
388 } 388 }
389 389
390 return false; 390 return false;
391 } 391 }
392 392
393 BluetoothAddProfileFunction::BluetoothAddProfileFunction() {} 393 BluetoothAddProfileFunction::BluetoothAddProfileFunction() {}
394 394
395 BluetoothAddProfileFunction::~BluetoothAddProfileFunction() {} 395 BluetoothAddProfileFunction::~BluetoothAddProfileFunction() {}
396 396
397 bool BluetoothAddProfileFunction::RunImpl() { 397 bool BluetoothAddProfileFunction::RunAsync() {
398 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 398 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
399 scoped_ptr<AddProfile::Params> params(AddProfile::Params::Create(*args_)); 399 scoped_ptr<AddProfile::Params> params(AddProfile::Params::Create(*args_));
400 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); 400 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
401 401
402 device::BluetoothUUID uuid(params->profile.uuid); 402 device::BluetoothUUID uuid(params->profile.uuid);
403 403
404 if (!uuid.IsValid()) { 404 if (!uuid.IsValid()) {
405 SetError(kInvalidUuid); 405 SetError(kInvalidUuid);
406 return false; 406 return false;
407 } 407 }
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 adapter, 853 adapter,
854 extension_id(), 854 extension_id(),
855 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), 855 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
856 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); 856 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
857 857
858 return true; 858 return true;
859 } 859 }
860 860
861 } // namespace api 861 } // namespace api
862 } // namespace extensions 862 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698