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

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc

Issue 2152373003: [Extensions] Code Cleanup - Remove redundant smart-ptr get()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_low_energy/bluetooth_low_energ y_api.h" 5 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_api.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <iterator> 9 #include <iterator>
10 #include <utility> 10 #include <utility>
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 SetError(kErrorAdapterNotInitialized); 461 SetError(kErrorAdapterNotInitialized);
462 SendResponse(false); 462 SendResponse(false);
463 return false; 463 return false;
464 } 464 }
465 465
466 std::unique_ptr<apibtle::Connect::Params> params( 466 std::unique_ptr<apibtle::Connect::Params> params(
467 apibtle::Connect::Params::Create(*args_)); 467 apibtle::Connect::Params::Create(*args_));
468 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); 468 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
469 469
470 bool persistent = false; // Not persistent by default. 470 bool persistent = false; // Not persistent by default.
471 apibtle::ConnectProperties* properties = params.get()->properties.get(); 471 apibtle::ConnectProperties* properties = params->properties.get();
472 if (properties) 472 if (properties)
473 persistent = properties->persistent; 473 persistent = properties->persistent;
474 474
475 event_router->Connect( 475 event_router->Connect(
476 persistent, 476 persistent,
477 extension(), 477 extension(),
478 params->device_address, 478 params->device_address,
479 base::Bind(&BluetoothLowEnergyConnectFunction::SuccessCallback, this), 479 base::Bind(&BluetoothLowEnergyConnectFunction::SuccessCallback, this),
480 base::Bind(&BluetoothLowEnergyConnectFunction::ErrorCallback, this)); 480 base::Bind(&BluetoothLowEnergyConnectFunction::ErrorCallback, this));
481 481
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 SetError(kErrorAdapterNotInitialized); 894 SetError(kErrorAdapterNotInitialized);
895 SendResponse(false); 895 SendResponse(false);
896 return false; 896 return false;
897 } 897 }
898 898
899 std::unique_ptr<apibtle::StartCharacteristicNotifications::Params> params( 899 std::unique_ptr<apibtle::StartCharacteristicNotifications::Params> params(
900 apibtle::StartCharacteristicNotifications::Params::Create(*args_)); 900 apibtle::StartCharacteristicNotifications::Params::Create(*args_));
901 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); 901 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
902 902
903 bool persistent = false; // Not persistent by default. 903 bool persistent = false; // Not persistent by default.
904 apibtle::NotificationProperties* properties = params.get()->properties.get(); 904 apibtle::NotificationProperties* properties = params->properties.get();
905 if (properties) 905 if (properties)
906 persistent = properties->persistent; 906 persistent = properties->persistent;
907 907
908 event_router->StartCharacteristicNotifications( 908 event_router->StartCharacteristicNotifications(
909 persistent, 909 persistent,
910 extension(), 910 extension(),
911 params->characteristic_id, 911 params->characteristic_id,
912 base::Bind(&BluetoothLowEnergyStartCharacteristicNotificationsFunction:: 912 base::Bind(&BluetoothLowEnergyStartCharacteristicNotificationsFunction::
913 SuccessCallback, 913 SuccessCallback,
914 this), 914 this),
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 params_->response.value->end()); 1483 params_->response.value->end());
1484 } 1484 }
1485 event_router_->HandleRequestResponse( 1485 event_router_->HandleRequestResponse(
1486 extension(), params_->response.request_id, params_->response.is_error, 1486 extension(), params_->response.request_id, params_->response.is_error,
1487 uint8_vector); 1487 uint8_vector);
1488 Respond(NoArguments()); 1488 Respond(NoArguments());
1489 } 1489 }
1490 1490
1491 } // namespace api 1491 } // namespace api
1492 } // namespace extensions 1492 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698