diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-02 19:03:55 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-02 19:03:55 +0000 |
commit | 217fb93c6fd3c94a32f659059d7b6a571343dab0 (patch) | |
tree | 446738dbc116b2d15f5159581818361c41337365 /chrome/browser/policy | |
parent | 7144bbd6ae932dc8bf475150ac6e5aeb9475e9ed (diff) | |
download | chromium_src-217fb93c6fd3c94a32f659059d7b6a571343dab0.zip chromium_src-217fb93c6fd3c94a32f659059d7b6a571343dab0.tar.gz chromium_src-217fb93c6fd3c94a32f659059d7b6a571343dab0.tar.bz2 |
Don't alias namespace enterprise_management to namespace em in headers.
Mechanical changes only.
BUG=None
TEST=Compiles and passes tests.
Review URL: http://codereview.chromium.org/9068002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116104 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy')
30 files changed, 170 insertions, 135 deletions
diff --git a/chrome/browser/policy/auto_enrollment_client.cc b/chrome/browser/policy/auto_enrollment_client.cc index 3b989a7..627fc72 100644 --- a/chrome/browser/policy/auto_enrollment_client.cc +++ b/chrome/browser/policy/auto_enrollment_client.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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/auto_enrollment_client.h" +#include "base/callback.h" #include "base/command_line.h" #include "base/logging.h" #include "base/string_number_conversions.h" @@ -13,6 +14,8 @@ #include "chrome/common/guid.h" #include "crypto/sha2.h" +namespace em = enterprise_management; + namespace { // The modulus value is sent in an int64 field in the protobuf, whose maximum diff --git a/chrome/browser/policy/auto_enrollment_client.h b/chrome/browser/policy/auto_enrollment_client.h index 7d2bbe7..3cbfa35 100644 --- a/chrome/browser/policy/auto_enrollment_client.h +++ b/chrome/browser/policy/auto_enrollment_client.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,7 +9,7 @@ #include <string> #include "base/basictypes.h" -#include "base/callback.h" +#include "base/callback_forward.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/policy/device_management_backend.h" @@ -65,7 +65,8 @@ class AutoEnrollmentClient // Implementation of DeviceAutoEnrollmentResponseDelegate: virtual void HandleAutoEnrollmentResponse( - const em::DeviceAutoEnrollmentResponse& response) OVERRIDE; + const enterprise_management::DeviceAutoEnrollmentResponse& + response) OVERRIDE; virtual void OnError(DeviceManagementBackend::ErrorCode code) OVERRIDE; // Returns true if |serial_number_hash_| is contained in |hashes|. diff --git a/chrome/browser/policy/auto_enrollment_client_unittest.cc b/chrome/browser/policy/auto_enrollment_client_unittest.cc index abaf4eb..dc8b233 100644 --- a/chrome/browser/policy/auto_enrollment_client_unittest.cc +++ b/chrome/browser/policy/auto_enrollment_client_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -6,13 +6,14 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/rand_util.h" #include "chrome/browser/policy/mock_device_management_backend.h" #include "chrome/browser/policy/mock_device_management_service.h" #include "crypto/sha2.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace em = enterprise_management; + namespace policy { namespace { diff --git a/chrome/browser/policy/cloud_policy_cache_base.cc b/chrome/browser/policy/cloud_policy_cache_base.cc index f0d3dc5..5eb692c 100644 --- a/chrome/browser/policy/cloud_policy_cache_base.cc +++ b/chrome/browser/policy/cloud_policy_cache_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -11,6 +11,8 @@ #include "chrome/browser/policy/enterprise_metrics.h" #include "chrome/browser/policy/policy_notifier.h" +namespace em = enterprise_management; + namespace policy { CloudPolicyCacheBase::CloudPolicyCacheBase() diff --git a/chrome/browser/policy/cloud_policy_cache_base.h b/chrome/browser/policy/cloud_policy_cache_base.h index 78ef72d..54b0eaac 100644 --- a/chrome/browser/policy/cloud_policy_cache_base.h +++ b/chrome/browser/policy/cloud_policy_cache_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -17,8 +17,6 @@ namespace policy { class PolicyNotifier; -namespace em = enterprise_management; - // Caches policy information, as set by calls to |SetPolicy()|, persists // it to disk or session_manager (depending on subclass implementation), // and makes it available via policy providers. @@ -50,7 +48,8 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { virtual void Load() = 0; // Resets the policy information. - virtual void SetPolicy(const em::PolicyFetchResponse& policy) = 0; + virtual void SetPolicy( + const enterprise_management::PolicyFetchResponse& policy) = 0; virtual void SetUnmanaged() = 0; @@ -107,9 +106,10 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { // NULL if they don't care. |check_for_timestamp_validity| tells this method // to discard policy data with a timestamp from the future. // Returns true upon success. - bool SetPolicyInternal(const em::PolicyFetchResponse& policy, - base::Time* timestamp, - bool check_for_timestamp_validity); + bool SetPolicyInternal( + const enterprise_management::PolicyFetchResponse& policy, + base::Time* timestamp, + bool check_for_timestamp_validity); void SetUnmanagedInternal(const base::Time& timestamp); @@ -118,17 +118,19 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { // Decodes |policy_data|, populating |mandatory| and |recommended| with // the results. - virtual bool DecodePolicyData(const em::PolicyData& policy_data, - PolicyMap* mandatory, - PolicyMap* recommended) = 0; + virtual bool DecodePolicyData( + const enterprise_management::PolicyData& policy_data, + PolicyMap* mandatory, + PolicyMap* recommended) = 0; // Decodes a PolicyFetchResponse into two PolicyMaps and a timestamp. // Also performs verification, returns NULL if any check fails. - bool DecodePolicyResponse(const em::PolicyFetchResponse& policy_response, - PolicyMap* mandatory, - PolicyMap* recommended, - base::Time* timestamp, - PublicKeyVersion* public_key_version); + bool DecodePolicyResponse( + const enterprise_management::PolicyFetchResponse& policy_response, + PolicyMap* mandatory, + PolicyMap* recommended, + base::Time* timestamp, + PublicKeyVersion* public_key_version); // Notifies observers if the cache IsReady(). void NotifyObservers(); diff --git a/chrome/browser/policy/cloud_policy_controller.h b/chrome/browser/policy/cloud_policy_controller.h index 7099c85..d3388c0 100644 --- a/chrome/browser/policy/cloud_policy_controller.h +++ b/chrome/browser/policy/cloud_policy_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -49,7 +49,7 @@ class CloudPolicyController // DevicePolicyResponseDelegate implementation: virtual void HandlePolicyResponse( - const em::DevicePolicyResponse& response) OVERRIDE; + const enterprise_management::DevicePolicyResponse& response) OVERRIDE; virtual void OnError(DeviceManagementBackend::ErrorCode code) OVERRIDE; // CloudPolicyDataStore::Observer implementation: diff --git a/chrome/browser/policy/cloud_policy_controller_unittest.cc b/chrome/browser/policy/cloud_policy_controller_unittest.cc index fa1b4ed..f249e0c 100644 --- a/chrome/browser/policy/cloud_policy_controller_unittest.cc +++ b/chrome/browser/policy/cloud_policy_controller_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,6 +19,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace em = enterprise_management; + namespace policy { using ::testing::AnyNumber; diff --git a/chrome/browser/policy/cloud_policy_data_store.cc b/chrome/browser/policy/cloud_policy_data_store.cc index b4373b3..9fb0a50 100644 --- a/chrome/browser/policy/cloud_policy_data_store.cc +++ b/chrome/browser/policy/cloud_policy_data_store.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,6 +9,8 @@ #include "chrome/browser/policy/proto/device_management_backend.pb.h" #include "chrome/browser/policy/proto/device_management_constants.h" +namespace em = enterprise_management; + namespace policy { CloudPolicyDataStore::~CloudPolicyDataStore() {} diff --git a/chrome/browser/policy/cloud_policy_data_store.h b/chrome/browser/policy/cloud_policy_data_store.h index 69e22ca..0b4e05a 100644 --- a/chrome/browser/policy/cloud_policy_data_store.h +++ b/chrome/browser/policy/cloud_policy_data_store.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -10,15 +10,14 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" +#include "chrome/browser/policy/proto/device_management_backend.pb.h" + #if defined(OS_CHROMEOS) #include "chrome/browser/policy/device_status_collector.h" #endif -#include "chrome/browser/policy/proto/device_management_backend.pb.h" namespace policy { -namespace em = enterprise_management; - // Stores in memory all the data that is used in the cloud policy subsystem, // and manages notification about changes to these fields. // TODO(gfeher): The policy data stored in CloudPolicyCacheBase is currently @@ -97,7 +96,8 @@ class CloudPolicyDataStore { bool has_auth_token() const; const std::string& machine_id() const; const std::string& machine_model() const; - em::DeviceRegisterRequest_Type policy_register_type() const; + enterprise_management::DeviceRegisterRequest_Type + policy_register_type() const; const std::string& policy_type() const; bool token_cache_loaded() const; const std::string& user_name() const; @@ -111,7 +111,7 @@ class CloudPolicyDataStore { private: CloudPolicyDataStore( - const em::DeviceRegisterRequest_Type policy_register_type, + const enterprise_management::DeviceRegisterRequest_Type register_type, const std::string& policy_type); // Data necessary for constructing register requests. @@ -125,7 +125,7 @@ class CloudPolicyDataStore { // Constants that won't change over the life-time of a cloud policy // subsystem. - const em::DeviceRegisterRequest_Type policy_register_type_; + const enterprise_management::DeviceRegisterRequest_Type policy_register_type_; const std::string policy_type_; // Data used for constructiong both register and policy requests. diff --git a/chrome/browser/policy/cloud_policy_provider_unittest.cc b/chrome/browser/policy/cloud_policy_provider_unittest.cc index 40e2f77..197602c 100644 --- a/chrome/browser/policy/cloud_policy_provider_unittest.cc +++ b/chrome/browser/policy/cloud_policy_provider_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,16 +9,16 @@ #include "chrome/browser/policy/browser_policy_connector.h" #include "chrome/browser/policy/cloud_policy_cache_base.h" #include "chrome/browser/policy/cloud_policy_provider_impl.h" -#include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/configuration_policy_provider.h" #include "chrome/browser/policy/mock_configuration_policy_provider.h" #include "policy/policy_constants.h" #include "testing/gmock/include/gmock/gmock.h" -using testing::AnyNumber; using testing::Mock; using testing::_; +namespace em = enterprise_management; + namespace policy { class MockCloudPolicyCache : public CloudPolicyCacheBase { diff --git a/chrome/browser/policy/device_management_backend.h b/chrome/browser/policy/device_management_backend.h index 81c93c5..58000a1 100644 --- a/chrome/browser/policy/device_management_backend.h +++ b/chrome/browser/policy/device_management_backend.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,8 +14,6 @@ namespace policy { -namespace em = enterprise_management; - // Interface for clients that need to converse with the device management // server, which provides services to register Chrome installations and CrOS // devices for the purpose of fetching centrally-administered policy from the @@ -60,7 +58,7 @@ class DeviceManagementBackend : base::NonThreadSafe { public: virtual ~DeviceRegisterResponseDelegate() {} virtual void HandleRegisterResponse( - const em::DeviceRegisterResponse& response) = 0; + const enterprise_management::DeviceRegisterResponse& response) = 0; virtual void OnError(ErrorCode code) = 0; protected: @@ -74,7 +72,7 @@ class DeviceManagementBackend : base::NonThreadSafe { public: virtual ~DeviceUnregisterResponseDelegate() {} virtual void HandleUnregisterResponse( - const em::DeviceUnregisterResponse& response) = 0; + const enterprise_management::DeviceUnregisterResponse& response) = 0; virtual void OnError(ErrorCode code) = 0; protected: @@ -89,7 +87,7 @@ class DeviceManagementBackend : base::NonThreadSafe { virtual ~DevicePolicyResponseDelegate() {} virtual void HandlePolicyResponse( - const em::DevicePolicyResponse& response) = 0; + const enterprise_management::DevicePolicyResponse& response) = 0; virtual void OnError(ErrorCode code) = 0; protected: @@ -104,7 +102,8 @@ class DeviceManagementBackend : base::NonThreadSafe { virtual ~DeviceAutoEnrollmentResponseDelegate() {} virtual void HandleAutoEnrollmentResponse( - const em::DeviceAutoEnrollmentResponse& response) = 0; + const enterprise_management::DeviceAutoEnrollmentResponse& + response) = 0; virtual void OnError(ErrorCode code) = 0; protected: @@ -120,26 +119,26 @@ class DeviceManagementBackend : base::NonThreadSafe { const std::string& gaia_auth_token, const std::string& oauth_token, const std::string& device_id, - const em::DeviceRegisterRequest& request, + const enterprise_management::DeviceRegisterRequest& request, DeviceRegisterResponseDelegate* delegate) = 0; virtual void ProcessUnregisterRequest( const std::string& device_management_token, const std::string& device_id, - const em::DeviceUnregisterRequest& request, + const enterprise_management::DeviceUnregisterRequest& request, DeviceUnregisterResponseDelegate* delegate) = 0; virtual void ProcessPolicyRequest( const std::string& device_management_token, const std::string& device_id, CloudPolicyDataStore::UserAffiliation user_affiliation, - const em::DevicePolicyRequest& request, - const em::DeviceStatusReportRequest* device_status, + const enterprise_management::DevicePolicyRequest& request, + const enterprise_management::DeviceStatusReportRequest* device_status, DevicePolicyResponseDelegate* delegate) = 0; virtual void ProcessAutoEnrollmentRequest( const std::string& device_id, - const em::DeviceAutoEnrollmentRequest& request, + const enterprise_management::DeviceAutoEnrollmentRequest& request, DeviceAutoEnrollmentResponseDelegate* delegate) = 0; protected: diff --git a/chrome/browser/policy/device_management_backend_impl.cc b/chrome/browser/policy/device_management_backend_impl.cc index 3705654..77e1e90 100644 --- a/chrome/browser/policy/device_management_backend_impl.cc +++ b/chrome/browser/policy/device_management_backend_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -21,6 +21,8 @@ #include "chrome/browser/chromeos/system/statistics_provider.h" #endif +namespace em = enterprise_management; + namespace policy { // Name constants for URL query parameters. diff --git a/chrome/browser/policy/device_management_backend_impl.h b/chrome/browser/policy/device_management_backend_impl.h index 244aa30..23468ed 100644 --- a/chrome/browser/policy/device_management_backend_impl.h +++ b/chrome/browser/policy/device_management_backend_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -64,23 +64,23 @@ class DeviceManagementBackendImpl : public DeviceManagementBackend { const std::string& gaia_auth_token, const std::string& oauth_token, const std::string& device_id, - const em::DeviceRegisterRequest& request, + const enterprise_management::DeviceRegisterRequest& request, DeviceRegisterResponseDelegate* response_delegate) OVERRIDE; virtual void ProcessUnregisterRequest( const std::string& device_management_token, const std::string& device_id, - const em::DeviceUnregisterRequest& request, + const enterprise_management::DeviceUnregisterRequest& request, DeviceUnregisterResponseDelegate* response_delegate) OVERRIDE; virtual void ProcessPolicyRequest( const std::string& device_management_token, const std::string& device_id, CloudPolicyDataStore::UserAffiliation affiliation, - const em::DevicePolicyRequest& request, - const em::DeviceStatusReportRequest* device_status, + const enterprise_management::DevicePolicyRequest& request, + const enterprise_management::DeviceStatusReportRequest* device_status, DevicePolicyResponseDelegate* response_delegate) OVERRIDE; virtual void ProcessAutoEnrollmentRequest( const std::string& device_id, - const em::DeviceAutoEnrollmentRequest& request, + const enterprise_management::DeviceAutoEnrollmentRequest& request, DeviceAutoEnrollmentResponseDelegate* delegate) OVERRIDE; // Converts a user affiliation to the appropriate query parameter value. diff --git a/chrome/browser/policy/device_management_backend_mock.h b/chrome/browser/policy/device_management_backend_mock.h index 62b0c2d..2f3a179 100644 --- a/chrome/browser/policy/device_management_backend_mock.h +++ b/chrome/browser/policy/device_management_backend_mock.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,7 +19,8 @@ class DeviceRegisterResponseDelegateMock DeviceRegisterResponseDelegateMock(); virtual ~DeviceRegisterResponseDelegateMock(); - MOCK_METHOD1(HandleRegisterResponse, void(const em::DeviceRegisterResponse&)); + MOCK_METHOD1(HandleRegisterResponse, + void(const enterprise_management::DeviceRegisterResponse&)); MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error)); }; @@ -30,7 +31,7 @@ class DeviceUnregisterResponseDelegateMock virtual ~DeviceUnregisterResponseDelegateMock(); MOCK_METHOD1(HandleUnregisterResponse, - void(const em::DeviceUnregisterResponse&)); + void(const enterprise_management::DeviceUnregisterResponse&)); MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error)); }; @@ -40,7 +41,8 @@ class DevicePolicyResponseDelegateMock DevicePolicyResponseDelegateMock(); virtual ~DevicePolicyResponseDelegateMock(); - MOCK_METHOD1(HandlePolicyResponse, void(const em::DevicePolicyResponse&)); + MOCK_METHOD1(HandlePolicyResponse, + void(const enterprise_management::DevicePolicyResponse&)); MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error)); }; @@ -50,8 +52,9 @@ class DeviceAutoEnrollmentResponseDelegateMock DeviceAutoEnrollmentResponseDelegateMock(); virtual ~DeviceAutoEnrollmentResponseDelegateMock(); - MOCK_METHOD1(HandleAutoEnrollmentResponse, - void(const em::DeviceAutoEnrollmentResponse&)); + MOCK_METHOD1( + HandleAutoEnrollmentResponse, + void(const enterprise_management::DeviceAutoEnrollmentResponse&)); MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error)); }; diff --git a/chrome/browser/policy/device_management_service.cc b/chrome/browser/policy/device_management_service.cc index e2983d7..73cbbf9 100644 --- a/chrome/browser/policy/device_management_service.cc +++ b/chrome/browser/policy/device_management_service.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -28,6 +28,8 @@ using content::BrowserThread; +namespace em = enterprise_management; + namespace policy { namespace { diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc index 7088e37..992fbf2 100644 --- a/chrome/browser/policy/device_management_service_browsertest.cc +++ b/chrome/browser/policy/device_management_service_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,6 +19,8 @@ using testing::Invoke; using testing::InvokeWithoutArgs; using testing::_; +namespace em = enterprise_management; + namespace policy { // Dummy service URL for testing with request interception enabled. diff --git a/chrome/browser/policy/device_management_service_unittest.cc b/chrome/browser/policy/device_management_service_unittest.cc index 1682dd2..449b914 100644 --- a/chrome/browser/policy/device_management_service_unittest.cc +++ b/chrome/browser/policy/device_management_service_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -24,10 +24,11 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -using testing::IgnoreResult; using testing::InvokeWithoutArgs; using testing::_; +namespace em = enterprise_management; + namespace policy { const char kServiceUrl[] = "https://example.com/management_service"; diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc index 75a6890..ff1c38a 100644 --- a/chrome/browser/policy/device_policy_cache.cc +++ b/chrome/browser/policy/device_policy_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -25,10 +25,11 @@ #include "chrome/browser/policy/enterprise_metrics.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/proto/device_management_backend.pb.h" -#include "chrome/browser/policy/proto/device_management_constants.h" #include "chrome/browser/policy/proto/device_management_local.pb.h" #include "policy/configuration_policy_type.h" +namespace em = enterprise_management; + namespace { // Stores policy, updates the owner key if required and reports the status diff --git a/chrome/browser/policy/device_policy_cache.h b/chrome/browser/policy/device_policy_cache.h index 4a2fd11..d7f3c8e 100644 --- a/chrome/browser/policy/device_policy_cache.h +++ b/chrome/browser/policy/device_policy_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -21,8 +21,6 @@ class CloudPolicyDataStore; class EnterpriseInstallAttributes; class PolicyMap; -namespace em = enterprise_management; - // CloudPolicyCacheBase implementation that persists policy information // to ChromeOS' session manager (via SignedSettingsHelper). class DevicePolicyCache : public CloudPolicyCacheBase { @@ -33,11 +31,13 @@ class DevicePolicyCache : public CloudPolicyCacheBase { // CloudPolicyCacheBase implementation: virtual void Load() OVERRIDE; - virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; + virtual void SetPolicy( + const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; virtual void SetUnmanaged() OVERRIDE; - void OnRetrievePolicyCompleted(chromeos::SignedSettings::ReturnCode code, - const em::PolicyFetchResponse& policy); + void OnRetrievePolicyCompleted( + chromeos::SignedSettings::ReturnCode code, + const enterprise_management::PolicyFetchResponse& policy); private: friend class DevicePolicyCacheTest; @@ -51,9 +51,10 @@ class DevicePolicyCache : public CloudPolicyCacheBase { chromeos::SignedSettingsHelper* signed_settings_helper); // CloudPolicyCacheBase implementation: - virtual bool DecodePolicyData(const em::PolicyData& policy_data, - PolicyMap* mandatory, - PolicyMap* recommended) OVERRIDE; + virtual bool DecodePolicyData( + const enterprise_management::PolicyData& policy_data, + PolicyMap* mandatory, + PolicyMap* recommended) OVERRIDE; void PolicyStoreOpCompleted(chromeos::SignedSettings::ReturnCode code); @@ -63,13 +64,15 @@ class DevicePolicyCache : public CloudPolicyCacheBase { // Tries to install the initial device policy retrieved from signed settings. // Fills in |device_token| if it could be extracted from the loaded protobuf. - void InstallInitialPolicy(chromeos::SignedSettings::ReturnCode code, - const em::PolicyFetchResponse& policy, - std::string* device_token); - - static void DecodeDevicePolicy(const em::ChromeDeviceSettingsProto& policy, - PolicyMap* mandatory, - PolicyMap* recommended); + void InstallInitialPolicy( + chromeos::SignedSettings::ReturnCode code, + const enterprise_management::PolicyFetchResponse& policy, + std::string* device_token); + + static void DecodeDevicePolicy( + const enterprise_management::ChromeDeviceSettingsProto& policy, + PolicyMap* mandatory, + PolicyMap* recommended); CloudPolicyDataStore* data_store_; EnterpriseInstallAttributes* install_attributes_; diff --git a/chrome/browser/policy/device_policy_cache_unittest.cc b/chrome/browser/policy/device_policy_cache_unittest.cc index f28b99e..d97a69d 100644 --- a/chrome/browser/policy/device_policy_cache_unittest.cc +++ b/chrome/browser/policy/device_policy_cache_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -13,6 +13,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace em = enterprise_management; + namespace policy { namespace { diff --git a/chrome/browser/policy/device_token_fetcher.h b/chrome/browser/policy/device_token_fetcher.h index f446f66..398ddfe 100644 --- a/chrome/browser/policy/device_token_fetcher.h +++ b/chrome/browser/policy/device_token_fetcher.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -18,8 +18,6 @@ class DelayedWorkScheduler; class DeviceManagementService; class PolicyNotifier; -namespace em = enterprise_management; - // Fetches the device token that can be used for policy requests with the device // management server, either from disk if it already has been successfully // requested, otherwise from the device management server. An instance of the @@ -55,7 +53,7 @@ class DeviceTokenFetcher // DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides: virtual void HandleRegisterResponse( - const em::DeviceRegisterResponse& response) OVERRIDE; + const enterprise_management::DeviceRegisterResponse& response) OVERRIDE; virtual void OnError(DeviceManagementBackend::ErrorCode code) OVERRIDE; private: diff --git a/chrome/browser/policy/device_token_fetcher_unittest.cc b/chrome/browser/policy/device_token_fetcher_unittest.cc index e2caa8c..a0cdbb1 100644 --- a/chrome/browser/policy/device_token_fetcher_unittest.cc +++ b/chrome/browser/policy/device_token_fetcher_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -17,6 +17,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +namespace em = enterprise_management; + namespace policy { const char kTestToken[] = "device_token_fetcher_test_auth_token"; diff --git a/chrome/browser/policy/mock_device_management_backend.h b/chrome/browser/policy/mock_device_management_backend.h index 88058d4..9054c89 100644 --- a/chrome/browser/policy/mock_device_management_backend.h +++ b/chrome/browser/policy/mock_device_management_backend.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -18,8 +18,6 @@ namespace policy { -namespace em = enterprise_management; - // Useful for unit testing when a server-based backend isn't // available. Simulates both successful and failed requests to the device // management server. @@ -33,26 +31,26 @@ class MockDeviceManagementBackend : public DeviceManagementBackend { const std::string& gaia_auth_token, const std::string& oauth_token, const std::string& device_id, - const em::DeviceRegisterRequest& request, + const enterprise_management::DeviceRegisterRequest& request, DeviceRegisterResponseDelegate* delegate)); MOCK_METHOD4(ProcessUnregisterRequest, void( const std::string& device_management_token, const std::string& device_id, - const em::DeviceUnregisterRequest& request, + const enterprise_management::DeviceUnregisterRequest& request, DeviceUnregisterResponseDelegate* delegate)); MOCK_METHOD6(ProcessPolicyRequest, void( const std::string& device_management_token, const std::string& device_id, CloudPolicyDataStore::UserAffiliation affiliation, - const em::DevicePolicyRequest& request, - const em::DeviceStatusReportRequest* device_status, + const enterprise_management::DevicePolicyRequest& request, + const enterprise_management::DeviceStatusReportRequest* device_status, DevicePolicyResponseDelegate* delegate)); MOCK_METHOD3(ProcessAutoEnrollmentRequest, void( const std::string& device_id, - const em::DeviceAutoEnrollmentRequest& request, + const enterprise_management::DeviceAutoEnrollmentRequest& request, DeviceAutoEnrollmentResponseDelegate* delegate)); private: @@ -60,7 +58,7 @@ class MockDeviceManagementBackend : public DeviceManagementBackend { }; ACTION(MockDeviceManagementBackendSucceedRegister) { - em::DeviceRegisterResponse response; + enterprise_management::DeviceRegisterResponse response; std::string token("FAKE_DEVICE_TOKEN_"); static int next_token_suffix; token += next_token_suffix++; @@ -69,11 +67,13 @@ ACTION(MockDeviceManagementBackendSucceedRegister) { } ACTION(MockDeviceManagementBackendSucceedSpdyCloudPolicy) { - em::PolicyData signed_response; - em::CloudPolicySettings settings; - em::DisableSpdyProto* spdy_proto = settings.mutable_disablespdy(); + enterprise_management::PolicyData signed_response; + enterprise_management::CloudPolicySettings settings; + enterprise_management::DisableSpdyProto* spdy_proto = + settings.mutable_disablespdy(); spdy_proto->set_disablespdy(true); - spdy_proto->mutable_policy_options()->set_mode(em::PolicyOptions::MANDATORY); + spdy_proto->mutable_policy_options()->set_mode( + enterprise_management::PolicyOptions::MANDATORY); EXPECT_TRUE( settings.SerializeToString(signed_response.mutable_policy_value())); base::TimeDelta timestamp = @@ -81,8 +81,9 @@ ACTION(MockDeviceManagementBackendSucceedSpdyCloudPolicy) { signed_response.set_timestamp(timestamp.InMilliseconds()); std::string serialized_signed_response; EXPECT_TRUE(signed_response.SerializeToString(&serialized_signed_response)); - em::DevicePolicyResponse response; - em::PolicyFetchResponse* fetch_response = response.add_response(); + enterprise_management::DevicePolicyResponse response; + enterprise_management::PolicyFetchResponse* fetch_response = + response.add_response(); fetch_response->set_policy_data(serialized_signed_response); // TODO(jkummerow): Set proper new_public_key and signature (when // implementing support for signature verification). diff --git a/chrome/browser/policy/mock_device_management_service.cc b/chrome/browser/policy/mock_device_management_service.cc index 80315ea..ec3081d 100644 --- a/chrome/browser/policy/mock_device_management_service.cc +++ b/chrome/browser/policy/mock_device_management_service.cc @@ -1,9 +1,11 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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/mock_device_management_service.h" +namespace em = enterprise_management; + namespace policy { ProxyDeviceManagementBackend::ProxyDeviceManagementBackend( diff --git a/chrome/browser/policy/mock_device_management_service.h b/chrome/browser/policy/mock_device_management_service.h index b854330..9f999b13 100644 --- a/chrome/browser/policy/mock_device_management_service.h +++ b/chrome/browser/policy/mock_device_management_service.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -29,23 +29,23 @@ class ProxyDeviceManagementBackend : public DeviceManagementBackend { const std::string& gaia_auth_token, const std::string& oauth_token, const std::string& device_id, - const em::DeviceRegisterRequest& request, + const enterprise_management::DeviceRegisterRequest& request, DeviceRegisterResponseDelegate* delegate) OVERRIDE; virtual void ProcessUnregisterRequest( const std::string& device_management_token, const std::string& device_id, - const em::DeviceUnregisterRequest& request, + const enterprise_management::DeviceUnregisterRequest& request, DeviceUnregisterResponseDelegate* delegate) OVERRIDE; virtual void ProcessPolicyRequest( const std::string& device_management_token, const std::string& device_id, CloudPolicyDataStore::UserAffiliation affiliation, - const em::DevicePolicyRequest& request, - const em::DeviceStatusReportRequest* device_status, + const enterprise_management::DevicePolicyRequest& request, + const enterprise_management::DeviceStatusReportRequest* device_status, DevicePolicyResponseDelegate* delegate) OVERRIDE; virtual void ProcessAutoEnrollmentRequest( const std::string& device_id, - const em::DeviceAutoEnrollmentRequest& request, + const enterprise_management::DeviceAutoEnrollmentRequest& request, DeviceAutoEnrollmentResponseDelegate* delegate) OVERRIDE; private: diff --git a/chrome/browser/policy/user_policy_cache.cc b/chrome/browser/policy/user_policy_cache.cc index 4969e4d..62ec294 100644 --- a/chrome/browser/policy/user_policy_cache.cc +++ b/chrome/browser/policy/user_policy_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -11,7 +11,6 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/metrics/histogram.h" -#include "chrome/browser/policy/configuration_policy_pref_store.h" #include "chrome/browser/policy/enterprise_metrics.h" #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/policy/proto/cloud_policy.pb.h" @@ -20,6 +19,8 @@ #include "policy/configuration_policy_type.h" #include "policy/policy_constants.h" +namespace em = enterprise_management; + namespace policy { // Decodes a CloudPolicySettings object into two maps with mandatory and diff --git a/chrome/browser/policy/user_policy_cache.h b/chrome/browser/policy/user_policy_cache.h index a32a36a..1696430 100644 --- a/chrome/browser/policy/user_policy_cache.h +++ b/chrome/browser/policy/user_policy_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -27,8 +27,6 @@ class GenericValue; namespace policy { -namespace em = enterprise_management; - class PolicyMap; // CloudPolicyCacheBase implementation that persists policy information @@ -45,7 +43,8 @@ class UserPolicyCache : public CloudPolicyCacheBase, // CloudPolicyCacheBase implementation: virtual void Load() OVERRIDE; - virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; + virtual void SetPolicy( + const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; virtual void SetUnmanaged() OVERRIDE; virtual void SetFetchingDone() OVERRIDE; @@ -55,12 +54,14 @@ class UserPolicyCache : public CloudPolicyCacheBase, // UserPolicyDiskCache::Delegate implementation: virtual void OnDiskCacheLoaded( UserPolicyDiskCache::LoadResult result, - const em::CachedCloudPolicyResponse& cached_response) OVERRIDE; + const enterprise_management::CachedCloudPolicyResponse& + cached_response) OVERRIDE; // CloudPolicyCacheBase implementation: - virtual bool DecodePolicyData(const em::PolicyData& policy_data, - PolicyMap* mandatory, - PolicyMap* recommended) OVERRIDE; + virtual bool DecodePolicyData( + const enterprise_management::PolicyData& policy_data, + PolicyMap* mandatory, + PolicyMap* recommended) OVERRIDE; // Checks if this cache is ready, and invokes SetReady() if so. void CheckIfReady(); @@ -78,7 +79,7 @@ class UserPolicyCache : public CloudPolicyCacheBase, PolicyMap* recommended); Value* DecodeIntegerValue(google::protobuf::int64 value) const; - Value* DecodeValue(const em::GenericValue& value) const; + Value* DecodeValue(const enterprise_management::GenericValue& value) const; // </Old-style policy support> diff --git a/chrome/browser/policy/user_policy_cache_unittest.cc b/chrome/browser/policy/user_policy_cache_unittest.cc index 50095d8..1ab3042 100644 --- a/chrome/browser/policy/user_policy_cache_unittest.cc +++ b/chrome/browser/policy/user_policy_cache_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -22,6 +22,8 @@ using content::BrowserThread; using testing::_; +namespace em = enterprise_management; + namespace policy { // Decodes a CloudPolicySettings object into two maps with mandatory and diff --git a/chrome/browser/policy/user_policy_disk_cache.cc b/chrome/browser/policy/user_policy_disk_cache.cc index dc0ab0f..1aa19a5 100644 --- a/chrome/browser/policy/user_policy_disk_cache.cc +++ b/chrome/browser/policy/user_policy_disk_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,6 +14,8 @@ using content::BrowserThread; +namespace em = enterprise_management; + namespace { // Other places can sample on the same UMA counter, so make sure they all do diff --git a/chrome/browser/policy/user_policy_disk_cache.h b/chrome/browser/policy/user_policy_disk_cache.h index ee96b96..b68be8a 100644 --- a/chrome/browser/policy/user_policy_disk_cache.h +++ b/chrome/browser/policy/user_policy_disk_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -12,15 +12,11 @@ #include "base/memory/weak_ptr.h" namespace enterprise_management { - class CachedCloudPolicyResponse; - } namespace policy { -namespace em = enterprise_management; - // Handles the on-disk cache file used by UserPolicyCache. This class handles // the necessary thread switching and may outlive the associated UserPolicyCache // instance. @@ -45,7 +41,7 @@ class UserPolicyDiskCache virtual ~Delegate(); virtual void OnDiskCacheLoaded( LoadResult result, - const em::CachedCloudPolicyResponse& policy) = 0; + const enterprise_management::CachedCloudPolicyResponse& policy) = 0; }; UserPolicyDiskCache(const base::WeakPtr<Delegate>& delegate, @@ -57,7 +53,7 @@ class UserPolicyDiskCache void Load(); // Triggers a write operation to the disk cache on the FILE thread. - void Store(const em::CachedCloudPolicyResponse& policy); + void Store(const enterprise_management::CachedCloudPolicyResponse& policy); private: friend class base::RefCountedThreadSafe<UserPolicyDiskCache>; @@ -68,14 +64,16 @@ class UserPolicyDiskCache // Forwards the result to the UI thread. void LoadDone(LoadResult result, - const em::CachedCloudPolicyResponse& policy); + const enterprise_management::CachedCloudPolicyResponse& policy); // Passes back the successfully read policy to the cache on the UI thread. - void ReportResultOnUIThread(LoadResult result, - const em::CachedCloudPolicyResponse& policy); + void ReportResultOnUIThread( + LoadResult result, + const enterprise_management::CachedCloudPolicyResponse& policy); // Saves a policy blob on the FILE thread. - void StoreOnFileThread(const em::CachedCloudPolicyResponse& policy); + void StoreOnFileThread( + const enterprise_management::CachedCloudPolicyResponse& policy); base::WeakPtr<Delegate> delegate_; const FilePath backing_file_path_; |