aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2016-04-19 15:41:19 -0700
committerAlex Vakulenko <avakulenko@google.com>2016-04-20 21:50:14 +0000
commit22ca81ad3a68f5bc93bcce2abd4c37f3dae55bfd (patch)
tree83fc3123b8f3b6a173dfde8dbb099b9d15199232
parent3f59975c93597ead7c6574ff780ed2acf6dc8d02 (diff)
downloadlibweave-22ca81ad3a68f5bc93bcce2abd4c37f3dae55bfd.tar.gz
libweave: Clean up code
Fixed minor issues like misspelling in comments, formatting. Removed unused function prototypes and make sure function declarations match exactly the implementations. Change-Id: Ie30342657c0c22fa19b1546321400cc65d0e028d Reviewed-on: https://weave-review.googlesource.com/3230 Reviewed-by: Robert Ginda <rginda@google.com>
-rw-r--r--include/weave/provider/http_client.h2
-rw-r--r--include/weave/provider/network.h2
-rw-r--r--include/weave/provider/test/fake_task_runner.h4
-rw-r--r--src/access_revocation_manager_impl.cc5
-rw-r--r--src/config_unittest.cc42
-rw-r--r--src/privet/constants.h2
-rw-r--r--src/privet/privet_handler.h6
-rw-r--r--src/privet/privet_manager.cc6
-rw-r--r--src/privet/security_delegate.h4
-rw-r--r--src/privet/security_manager.cc2
-rw-r--r--src/streams.cc2
11 files changed, 33 insertions, 44 deletions
diff --git a/include/weave/provider/http_client.h b/include/weave/provider/http_client.h
index bf01022..5a53374 100644
--- a/include/weave/provider/http_client.h
+++ b/include/weave/provider/http_client.h
@@ -48,7 +48,7 @@ namespace provider {
// request is complete), callback should be invokes on the same thread.
// Callback should never be called before SendRequest(...) returns.
//
-// When invoking callback function, user should privide implementation
+// When invoking callback function, user should provide implementation
// of the Response interface. For example, the following could be used as a
// simple implementation:
// struct ResponseImpl : public provider::HttpClient::Response {
diff --git a/include/weave/provider/network.h b/include/weave/provider/network.h
index a73b75e..2be2dfb 100644
--- a/include/weave/provider/network.h
+++ b/include/weave/provider/network.h
@@ -20,7 +20,7 @@ namespace provider {
// sockets, implementing XMPP push notifications channel.
//
// There are 2 main parts of this interface. One part is used to check network
-// connection status and signup for notification if connection status changes.
+// connection status and sign up for notification if connection status changes.
// Implementation of GetConnectionState() should return current network
// connection state (enum Network::State).
// Implementation of AddConnectionChangedCallback() should remember callback
diff --git a/include/weave/provider/test/fake_task_runner.h b/include/weave/provider/test/fake_task_runner.h
index 4080072..9476d02 100644
--- a/include/weave/provider/test/fake_task_runner.h
+++ b/include/weave/provider/test/fake_task_runner.h
@@ -34,10 +34,6 @@ class FakeTaskRunner : public TaskRunner {
size_t GetTaskQueueSize() const;
private:
- void SaveTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay);
-
using QueueItem = std::pair<std::pair<base::Time, size_t>, base::Closure>;
struct Greater {
diff --git a/src/access_revocation_manager_impl.cc b/src/access_revocation_manager_impl.cc
index 035e1ad..93bdf3f 100644
--- a/src/access_revocation_manager_impl.cc
+++ b/src/access_revocation_manager_impl.cc
@@ -159,8 +159,9 @@ bool AccessRevocationManagerImpl::IsBlocked(const std::vector<uint8_t>& user_id,
const std::vector<uint8_t>& app_id,
base::Time timestamp) const {
Entry entry_to_find;
- for (const auto& user : {{}, user_id}) {
- for (const auto& app : {{}, app_id}) {
+ const std::vector<uint8_t> no_id;
+ for (const auto& user : {no_id, user_id}) {
+ for (const auto& app : {no_id, app_id}) {
entry_to_find.user_id = user;
entry_to_find.app_id = app;
auto match = entries_.find(entry_to_find);
diff --git a/src/config_unittest.cc b/src/config_unittest.cc
index 3c020f4..9e8fc42 100644
--- a/src/config_unittest.cc
+++ b/src/config_unittest.cc
@@ -263,27 +263,27 @@ TEST_F(ConfigTest, Setters) {
.WillOnce(WithArgs<1, 2>(
Invoke([](const std::string& json, const DoneCallback& callback) {
auto expected = R"({
- 'version': 1,
- 'api_key': 'set_api_key',
- 'client_id': 'set_client_id',
- 'client_secret': 'set_client_secret',
- 'cloud_id': 'set_cloud_id',
- 'description': 'set_description',
- 'device_id': 'set_device_id',
- 'last_configured_ssid': 'set_last_configured_ssid',
- 'local_anonymous_access_role': 'user',
- 'root_client_token_owner': 'cloud',
- 'local_discovery_enabled': true,
- 'local_pairing_enabled': true,
- 'location': 'set_location',
- 'name': 'set_name',
- 'oauth_url': 'set_oauth_url',
- 'refresh_token': 'set_token',
- 'robot_account': 'set_account',
- 'secret': 'AQIDBAU=',
- 'service_url': 'set_service_url',
- 'xmpp_endpoint': 'set_xmpp_endpoint'
- })";
+ 'version': 1,
+ 'api_key': 'set_api_key',
+ 'client_id': 'set_client_id',
+ 'client_secret': 'set_client_secret',
+ 'cloud_id': 'set_cloud_id',
+ 'description': 'set_description',
+ 'device_id': 'set_device_id',
+ 'last_configured_ssid': 'set_last_configured_ssid',
+ 'local_anonymous_access_role': 'user',
+ 'root_client_token_owner': 'cloud',
+ 'local_discovery_enabled': true,
+ 'local_pairing_enabled': true,
+ 'location': 'set_location',
+ 'name': 'set_name',
+ 'oauth_url': 'set_oauth_url',
+ 'refresh_token': 'set_token',
+ 'robot_account': 'set_account',
+ 'secret': 'AQIDBAU=',
+ 'service_url': 'set_service_url',
+ 'xmpp_endpoint': 'set_xmpp_endpoint'
+ })";
EXPECT_JSON_EQ(expected, *test::CreateValue(json));
callback.Run(nullptr);
})));
diff --git a/src/privet/constants.h b/src/privet/constants.h
index 67f993d..c4f3c49 100644
--- a/src/privet/constants.h
+++ b/src/privet/constants.h
@@ -7,7 +7,6 @@
namespace weave {
namespace privet {
-
namespace errors {
extern const char kInvalidClientCommitment[];
@@ -31,6 +30,7 @@ extern const char kInvalidPassphrase[];
extern const char kNotFound[];
extern const char kNotImplemented[];
extern const char kAlreadyClaimed[];
+
} // namespace errors
} // namespace privet
} // namespace weave
diff --git a/src/privet/privet_handler.h b/src/privet/privet_handler.h
index 7b212e4..e64151b 100644
--- a/src/privet/privet_handler.h
+++ b/src/privet/privet_handler.h
@@ -101,12 +101,6 @@ class PrivetHandler {
void HandleSetupStatus(const base::DictionaryValue&,
const UserInfo& user_info,
const RequestCallback& callback);
- void HandleState(const base::DictionaryValue& input,
- const UserInfo& user_info,
- const RequestCallback& callback);
- void HandleCommandDefs(const base::DictionaryValue& input,
- const UserInfo& user_info,
- const RequestCallback& callback);
void HandleCommandsExecute(const base::DictionaryValue& input,
const UserInfo& user_info,
const RequestCallback& callback);
diff --git a/src/privet/privet_manager.cc b/src/privet/privet_manager.cc
index 1858168..54f1155 100644
--- a/src/privet/privet_manager.cc
+++ b/src/privet/privet_manager.cc
@@ -114,9 +114,9 @@ std::string Manager::GetCurrentlyConnectedSsid() const {
}
void Manager::AddOnPairingChangedCallbacks(
- const SecurityManager::PairingStartListener& on_start,
- const SecurityManager::PairingEndListener& on_end) {
- security_->RegisterPairingListeners(on_start, on_end);
+ const Device::PairingBeginCallback& begin_callback,
+ const Device::PairingEndCallback& end_callback) {
+ security_->RegisterPairingListeners(begin_callback, end_callback);
}
void Manager::OnDeviceInfoChanged(const weave::Settings&) {
diff --git a/src/privet/security_delegate.h b/src/privet/security_delegate.h
index 867ff2a..0cc33b2 100644
--- a/src/privet/security_delegate.h
+++ b/src/privet/security_delegate.h
@@ -47,8 +47,8 @@ class SecurityDelegate {
// Returns Root Client Authorization Token.
virtual std::string ClaimRootClientAuthToken(ErrorPtr* error) = 0;
- // Confirms pending pending token claim or checks that token is valid for the
- // active secret.
+ // Confirms pending token claim or checks that token is valid for the active
+ // secret.
virtual bool ConfirmClientAuthToken(const std::string& token,
ErrorPtr* error) = 0;
diff --git a/src/privet/security_manager.cc b/src/privet/security_manager.cc
index 3c11935..157c8d6 100644
--- a/src/privet/security_manager.cc
+++ b/src/privet/security_manager.cc
@@ -251,7 +251,7 @@ bool SecurityManager::IsValidPairingCode(
return true;
}
}
- LOG(ERROR) << "Attempt to authenticate with invalide code.";
+ LOG(ERROR) << "Attempt to authenticate with invalid code.";
return false;
}
diff --git a/src/streams.cc b/src/streams.cc
index 22527c9..c5e147f 100644
--- a/src/streams.cc
+++ b/src/streams.cc
@@ -11,8 +11,6 @@
namespace weave {
-namespace {} // namespace
-
MemoryStream::MemoryStream(const std::vector<uint8_t>& data,
provider::TaskRunner* task_runner)
: data_{data}, task_runner_{task_runner} {}