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

Unified Diff: chrome/browser/policy/device_policy_identity_strategy.cc

Issue 7298012: Consolidate data storage and notifications in the cloud policy subsystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/device_policy_identity_strategy.cc
diff --git a/chrome/browser/policy/device_policy_identity_strategy.cc b/chrome/browser/policy/device_policy_identity_strategy.cc
deleted file mode 100644
index 909cfbd2357a01e733e75dc3cad44ac6a9f6693c..0000000000000000000000000000000000000000
--- a/chrome/browser/policy/device_policy_identity_strategy.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2011 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 "chrome/browser/policy/device_policy_identity_strategy.h"
-
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
-#include "chrome/browser/chromeos/login/ownership_service.h"
-#include "chrome/browser/chromeos/login/user_manager.h"
-#include "chrome/browser/chromeos/system_access.h"
-#include "chrome/browser/net/gaia/token_service.h"
-#include "chrome/browser/policy/proto/device_management_constants.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/common/guid.h"
-#include "chrome/common/net/gaia/gaia_constants.h"
-#include "content/common/notification_service.h"
-#include "content/common/notification_type.h"
-
-// MachineInfo key names.
-static const char kMachineInfoSystemHwqual[] = "hardware_class";
-static const char kMachineInfoSerialNumber[] = "serial_number";
-
-namespace policy {
-
-DevicePolicyIdentityStrategy::DevicePolicyIdentityStrategy() {
- chromeos::SystemAccess* sys_lib = chromeos::SystemAccess::GetInstance();
-
- if (!sys_lib->GetMachineStatistic(kMachineInfoSystemHwqual,
- &machine_model_)) {
- LOG(ERROR) << "Failed to get machine model.";
- }
- if (!sys_lib->GetMachineStatistic(kMachineInfoSerialNumber,
- &machine_id_)) {
- LOG(ERROR) << "Failed to get machine serial number.";
- }
-}
-
-DevicePolicyIdentityStrategy::~DevicePolicyIdentityStrategy() {
-}
-
-std::string DevicePolicyIdentityStrategy::GetDeviceToken() {
- return device_token_;
-}
-
-std::string DevicePolicyIdentityStrategy::GetDeviceID() {
- return device_id_;
-}
-
-std::string DevicePolicyIdentityStrategy::GetMachineID() {
- return machine_id_;
-}
-
-std::string DevicePolicyIdentityStrategy::GetMachineModel() {
- return machine_model_;
-}
-
-em::DeviceRegisterRequest_Type
-DevicePolicyIdentityStrategy::GetPolicyRegisterType() {
- return em::DeviceRegisterRequest::DEVICE;
-}
-
-std::string DevicePolicyIdentityStrategy::GetPolicyType() {
- return kChromeDevicePolicyType;
-}
-
-void DevicePolicyIdentityStrategy::SetAuthCredentials(
- const std::string& username,
- const std::string& auth_token) {
- username_ = username;
- auth_token_ = auth_token;
- device_id_ = guid::GenerateGUID();
- NotifyAuthChanged();
-}
-
-void DevicePolicyIdentityStrategy::SetDeviceManagementCredentials(
- const std::string& owner_email,
- const std::string& device_id,
- const std::string& device_token) {
- username_ = owner_email;
- device_id_ = device_id;
- device_token_ = device_token;
- NotifyDeviceTokenChanged();
-}
-
-void DevicePolicyIdentityStrategy::FetchPolicy() {
- DCHECK(!device_token_.empty());
- NotifyDeviceTokenChanged();
-}
-
-bool DevicePolicyIdentityStrategy::GetCredentials(std::string* username,
- std::string* auth_token) {
- *username = username_;
- *auth_token = auth_token_;
-
- return !username->empty() && !auth_token->empty();
-}
-
-void DevicePolicyIdentityStrategy::OnDeviceTokenAvailable(
- const std::string& token) {
- device_token_ = token;
-}
-
-} // namespace policy
« no previous file with comments | « chrome/browser/policy/device_policy_identity_strategy.h ('k') | chrome/browser/policy/device_token_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698