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

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

Issue 11369055: Delayed adding BluetoothEventRouter as BluetoothAdapter observer until when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed BluetoothApiTest. Created 8 years, 1 month 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 | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.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 "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 #include <errno.h> 8 #include <errno.h>
9 #endif 9 #endif
10 10
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 bool BluetoothStartDiscoveryFunction::RunImpl() { 568 bool BluetoothStartDiscoveryFunction::RunImpl() {
569 if (!IsBluetoothSupported(profile())) { 569 if (!IsBluetoothSupported(profile())) {
570 SetError(kPlatformNotSupported); 570 SetError(kPlatformNotSupported);
571 return false; 571 return false;
572 } 572 }
573 573
574 GetEventRouter(profile())->SetSendDiscoveryEvents(true); 574 GetEventRouter(profile())->SetSendDiscoveryEvents(true);
575 575
576 // If the adapter is already discovering, there is nothing else to do. 576 // If the adapter is already discovering, there is nothing else to do.
577 if (GetMutableAdapter(profile())->IsDiscovering()) { 577 if (GetAdapter(profile())->IsDiscovering()) {
578 SendResponse(true); 578 SendResponse(true);
579 return true; 579 return true;
580 } 580 }
581 581
582 GetMutableAdapter(profile())->SetDiscovering(true, 582 GetMutableAdapter(profile())->SetDiscovering(true,
583 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), 583 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this),
584 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); 584 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this));
585 return true; 585 return true;
586 } 586 }
587 587
(...skipping 16 matching lines...) Expand all
604 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) { 604 if (GetEventRouter(profile())->IsResponsibleForDiscovery()) {
605 GetMutableAdapter(profile())->SetDiscovering(false, 605 GetMutableAdapter(profile())->SetDiscovering(false,
606 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), 606 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
607 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); 607 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
608 } 608 }
609 return true; 609 return true;
610 } 610 }
611 611
612 } // namespace api 612 } // namespace api
613 } // namespace extensions 613 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698