diff options
11 files changed, 18 insertions, 43 deletions
diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc index 1a8d98d..88ca35e 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.cc @@ -181,7 +181,7 @@ void AutoEnrollmentController::OnOwnershipStatusCheckDone( } void AutoEnrollmentController::StartClient( - const std::vector<std::string>& state_keys, bool first_boot) { + const std::vector<std::string>& state_keys) { policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); policy::DeviceManagementService* service = @@ -202,8 +202,7 @@ void AutoEnrollmentController::StartClient( std::string device_id; if (GetMode() == MODE_FORCED_RE_ENROLLMENT) { retrieve_device_state = true; - if (!state_keys.empty() && !first_boot) - device_id = state_keys.front(); + device_id = state_keys.empty() ? std::string() : state_keys.front(); } else { device_id = policy::DeviceCloudPolicyManagerChromeOS::GetMachineID(); } diff --git a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h index cef6dce..9035bc8 100644 --- a/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h +++ b/chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h @@ -75,7 +75,7 @@ class AutoEnrollmentController { DeviceSettingsService::OwnershipStatus status); // Starts the auto-enrollment client. - void StartClient(const std::vector<std::string>& state_keys, bool first_boot); + void StartClient(const std::vector<std::string>& state_keys); // Sets |state_| and notifies |progress_callbacks_|. void UpdateState(policy::AutoEnrollmentState state); diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc index 2727964..a73b8d3 100644 --- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc +++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc @@ -218,7 +218,7 @@ void EnrollmentHandlerChromeOS::OnStoreError(CloudPolicyStore* store) { } void EnrollmentHandlerChromeOS::HandleStateKeysResult( - const std::vector<std::string>& state_keys, bool /* first_boot */) { + const std::vector<std::string>& state_keys) { CHECK_EQ(STEP_STATE_KEYS, enrollment_step_); // Make sure state keys are available if forced re-enrollment is on. diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h index 38cd1d5..8b761f4 100644 --- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h +++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.h @@ -121,8 +121,7 @@ class EnrollmentHandlerChromeOS : public CloudPolicyClient::Observer, }; // Handles the response to a request for server-backed state keys. - void HandleStateKeysResult(const std::vector<std::string>& state_keys, - bool first_boot); + void HandleStateKeysResult(const std::vector<std::string>& state_keys); // Starts registration if the store is initialized. void StartRegistration(); diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc index 99d945d..df174e2 100644 --- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc +++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.cc @@ -28,7 +28,6 @@ ServerBackedStateKeysBroker::ServerBackedStateKeysBroker( scoped_refptr<base::TaskRunner> delayed_task_runner) : session_manager_client_(session_manager_client), delayed_task_runner_(delayed_task_runner), - first_boot_(false), requested_(false), initial_retrieval_completed_(false), weak_factory_(this) { @@ -54,7 +53,7 @@ void ServerBackedStateKeysBroker::RequestStateKeys( } if (!callback.is_null()) - callback.Run(state_keys_, first_boot_); + callback.Run(state_keys_); return; } @@ -68,7 +67,7 @@ void ServerBackedStateKeysBroker::FetchStateKeys() { } void ServerBackedStateKeysBroker::StoreStateKeys( - const std::vector<std::string>& state_keys, bool first_boot) { + const std::vector<std::string>& state_keys) { bool send_notification = !initial_retrieval_completed_; requested_ = false; @@ -81,7 +80,6 @@ void ServerBackedStateKeysBroker::StoreStateKeys( } else { send_notification |= state_keys_ != state_keys; state_keys_ = state_keys; - first_boot_ = first_boot; } if (send_notification) @@ -94,7 +92,7 @@ void ServerBackedStateKeysBroker::StoreStateKeys( callback != callbacks.end(); ++callback) { if (!callback->is_null()) - callback->Run(state_keys_, first_boot_); + callback->Run(state_keys_); } delayed_task_runner_->PostDelayedTask( diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h index ab9f8d8..e3d8e68 100644 --- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h +++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker.h @@ -30,7 +30,7 @@ namespace policy { class ServerBackedStateKeysBroker { public: typedef scoped_ptr<base::CallbackList<void()>::Subscription> Subscription; - typedef base::Callback<void(const std::vector<std::string>&, bool)> + typedef base::Callback<void(const std::vector<std::string>&)> StateKeysCallback; ServerBackedStateKeysBroker( @@ -71,8 +71,7 @@ class ServerBackedStateKeysBroker { void FetchStateKeys(); // Stores newly-received state keys and notifies consumers. - void StoreStateKeys(const std::vector<std::string>& state_keys, - bool first_boot); + void StoreStateKeys(const std::vector<std::string>& state_keys); chromeos::SessionManagerClient* session_manager_client_; @@ -81,9 +80,6 @@ class ServerBackedStateKeysBroker { // The current set of state keys. std::vector<std::string> state_keys_; - // Set to true on first run after factory reset. - bool first_boot_; - // Whether a request for state keys is pending. bool requested_; diff --git a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc index 32ddf18..2dad66b 100644 --- a/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc +++ b/chrome/browser/chromeos/policy/server_backed_state_keys_broker_unittest.cc @@ -20,7 +20,6 @@ class ServerBackedStateKeysBrokerTest : public testing::Test { ServerBackedStateKeysBrokerTest() : task_runner_(new base::TestSimpleTaskRunner()), broker_(&fake_session_manager_client_, task_runner_), - first_boot_(false), updated_(false), callback_invoked_(false) { state_keys_.push_back("1"); @@ -41,11 +40,9 @@ class ServerBackedStateKeysBrokerTest : public testing::Test { EXPECT_EQ(state_keys_.front(), broker_.current_state_key()); } - void HandleStateKeysCallback(const std::vector<std::string>& state_keys, - bool first_boot) { + void HandleStateKeysCallback(const std::vector<std::string>& state_keys) { callback_invoked_ = true; callback_state_keys_ = state_keys; - first_boot_ = first_boot; } protected: @@ -54,7 +51,6 @@ class ServerBackedStateKeysBrokerTest : public testing::Test { chromeos::FakeSessionManagerClient fake_session_manager_client_; ServerBackedStateKeysBroker broker_; std::vector<std::string> state_keys_; - bool first_boot_; bool updated_; std::vector<std::string> callback_state_keys_; bool callback_invoked_; @@ -137,7 +133,6 @@ TEST_F(ServerBackedStateKeysBrokerTest, Request) { base::RunLoop().RunUntilIdle(); ExpectGood(); EXPECT_TRUE(callback_invoked_); - EXPECT_FALSE(first_boot_); EXPECT_EQ(state_keys_, callback_state_keys_); } diff --git a/chromeos/dbus/fake_session_manager_client.cc b/chromeos/dbus/fake_session_manager_client.cc index b3aabae..c5fe549 100644 --- a/chromeos/dbus/fake_session_manager_client.cc +++ b/chromeos/dbus/fake_session_manager_client.cc @@ -13,8 +13,7 @@ namespace chromeos { FakeSessionManagerClient::FakeSessionManagerClient() - : first_boot_(false), - start_device_wipe_call_count_(0), + : start_device_wipe_call_count_(0), notify_lock_screen_shown_call_count_(0), notify_lock_screen_dismissed_call_count_(0) { } @@ -136,7 +135,7 @@ void FakeSessionManagerClient::SetFlagsForUser( void FakeSessionManagerClient::GetServerBackedStateKeys( const StateKeysCallback& callback) { base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(callback, server_backed_state_keys_, first_boot_)); + FROM_HERE, base::Bind(callback, server_backed_state_keys_)); } const std::string& FakeSessionManagerClient::device_policy() const { diff --git a/chromeos/dbus/fake_session_manager_client.h b/chromeos/dbus/fake_session_manager_client.h index d0effc6..f69e262 100644 --- a/chromeos/dbus/fake_session_manager_client.h +++ b/chromeos/dbus/fake_session_manager_client.h @@ -85,8 +85,6 @@ class FakeSessionManagerClient : public SessionManagerClient { server_backed_state_keys_ = state_keys; } - void set_first_boot(bool first_boot) { first_boot_ = first_boot; } - int start_device_wipe_call_count() const { return start_device_wipe_call_count_; } @@ -108,7 +106,6 @@ class FakeSessionManagerClient : public SessionManagerClient { ObserverList<Observer> observers_; SessionManagerClient::ActiveSessionsMap user_sessions_; std::vector<std::string> server_backed_state_keys_; - bool first_boot_; int start_device_wipe_call_count_; int notify_lock_screen_shown_call_count_; diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc index c74de10..5a67ee8 100644 --- a/chromeos/dbus/session_manager_client.cc +++ b/chromeos/dbus/session_manager_client.cc @@ -525,7 +525,6 @@ class SessionManagerClientImpl : public SessionManagerClient { void OnGetServerBackedStateKeys(const StateKeysCallback& callback, dbus::Response* response) { std::vector<std::string> state_keys; - bool first_run = false; if (!response) { LOG(ERROR) << "Failed to call " << login_manager::kSessionManagerStartSession; @@ -548,14 +547,10 @@ class SessionManagerClientImpl : public SessionManagerClient { std::string(reinterpret_cast<const char*>(data), size)); } } - if (!reader.PopBool(&first_run)) { - // TODO(tnagel): After 2014-11-19 turn this warning into an error. - LOG(WARNING) << "Chrome OS is too old. Defaulting to first_run=false."; - } } if (!callback.is_null()) - callback.Run(state_keys, first_run); + callback.Run(state_keys); } @@ -718,7 +713,7 @@ class SessionManagerClientStubImpl : public SessionManagerClient { state_keys.push_back(crypto::SHA256HashString(base::IntToString(i))); if (!callback.is_null()) - callback.Run(state_keys, false); + callback.Run(state_keys); } private: diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h index b007bee..d4c0706 100644 --- a/chromeos/dbus/session_manager_client.h +++ b/chromeos/dbus/session_manager_client.h @@ -168,16 +168,13 @@ class CHROMEOS_EXPORT SessionManagerClient : public DBusClient { virtual void SetFlagsForUser(const std::string& username, const std::vector<std::string>& flags) = 0; - typedef base::Callback<void(const std::vector<std::string>& state_keys, - bool first_boot)> StateKeysCallback; + typedef base::Callback<void(const std::vector<std::string>& state_keys)> + StateKeysCallback; // Get the currently valid server-backed state keys for the device. // Server-backed state keys are opaque, device-unique, time-dependent, // client-determined identifiers that are used for keying state in the cloud - // for the device to retrieve after a device factory reset. The |first_boot| - // parameter indicates if this is the very first boot of the device after - // being assembled (even a "factory reset" will not trigger this again) in - // which case doing the enrollment check makes no sense. + // for the device to retrieve after a device factory reset. // // The state keys are returned asynchronously via |callback|. The callback // will be invoked with an empty state key vector in case of errors. |