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

Unified Diff: chromeos/components/tether/local_device_data_provider.cc

Issue 2951303002: [CrOS Tether] Move LocalDeviceDataProvider from //chromeos/components/tether to //components/crypta… (Closed)
Patch Set: Rebased. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/components/tether/local_device_data_provider.cc
diff --git a/chromeos/components/tether/local_device_data_provider.cc b/chromeos/components/tether/local_device_data_provider.cc
deleted file mode 100644
index 38fbcc10e3b618c90143b48aa2bea04a9814a869..0000000000000000000000000000000000000000
--- a/chromeos/components/tether/local_device_data_provider.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chromeos/components/tether/local_device_data_provider.h"
-
-#include "components/cryptauth/cryptauth_device_manager.h"
-#include "components/cryptauth/cryptauth_enrollment_manager.h"
-#include "components/cryptauth/cryptauth_service.h"
-#include "components/cryptauth/proto/cryptauth_api.pb.h"
-
-namespace chromeos {
-
-namespace tether {
-
-LocalDeviceDataProvider::LocalDeviceDataProvider(
- cryptauth::CryptAuthService* cryptauth_service)
- : cryptauth_service_(cryptauth_service) {}
-
-LocalDeviceDataProvider::~LocalDeviceDataProvider() {}
-
-bool LocalDeviceDataProvider::GetLocalDeviceData(
- std::string* public_key_out,
- std::vector<cryptauth::BeaconSeed>* beacon_seeds_out) const {
- DCHECK(public_key_out || beacon_seeds_out);
-
- std::string public_key =
- cryptauth_service_->GetCryptAuthEnrollmentManager()->GetUserPublicKey();
- if (public_key.empty()) {
- return false;
- }
-
- std::vector<cryptauth::ExternalDeviceInfo> synced_devices =
- cryptauth_service_->GetCryptAuthDeviceManager()->GetSyncedDevices();
- for (const auto& device : synced_devices) {
- if (device.has_public_key() && device.public_key() == public_key &&
- device.beacon_seeds_size() > 0) {
- if (public_key_out) {
- public_key_out->assign(public_key);
- }
-
- if (beacon_seeds_out) {
- beacon_seeds_out->clear();
- for (int i = 0; i < device.beacon_seeds_size(); i++) {
- beacon_seeds_out->push_back(device.beacon_seeds(i));
- }
- }
-
- return true;
- }
- }
-
- return false;
-}
-
-} // namespace tether
-
-} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698