| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 5 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/message_loop/message_loop.h" | |
| 17 #include "base/metrics/histogram_base.h" | 16 #include "base/metrics/histogram_base.h" |
| 18 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 20 #include "chrome/browser/chromeos/policy/proto/install_attributes.pb.h" | 21 #include "chrome/browser/chromeos/policy/proto/install_attributes.pb.h" |
| 21 #include "chromeos/cryptohome/cryptohome_util.h" | 22 #include "chromeos/cryptohome/cryptohome_util.h" |
| 22 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 23 #include "google_apis/gaia/gaia_auth_util.h" | 24 #include "google_apis/gaia/gaia_auth_util.h" |
| 24 | 25 |
| 25 namespace policy { | 26 namespace policy { |
| 26 | 27 |
| 27 namespace cryptohome_util = chromeos::cryptohome_util; | 28 namespace cryptohome_util = chromeos::cryptohome_util; |
| 28 | 29 |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 weak_ptr_factory_.GetWeakPtr(), | 369 weak_ptr_factory_.GetWeakPtr(), |
| 369 dbus_retries)); | 370 dbus_retries)); |
| 370 } | 371 } |
| 371 | 372 |
| 372 void EnterpriseInstallAttributes::OnTpmOwnerCheckCompleted( | 373 void EnterpriseInstallAttributes::OnTpmOwnerCheckCompleted( |
| 373 int dbus_retries_remaining, | 374 int dbus_retries_remaining, |
| 374 chromeos::DBusMethodCallStatus call_status, | 375 chromeos::DBusMethodCallStatus call_status, |
| 375 bool result) { | 376 bool result) { |
| 376 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS && | 377 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS && |
| 377 dbus_retries_remaining) { | 378 dbus_retries_remaining) { |
| 378 base::MessageLoop::current()->PostDelayedTask( | 379 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 379 FROM_HERE, | 380 FROM_HERE, |
| 380 base::Bind(&EnterpriseInstallAttributes::TriggerConsistencyCheck, | 381 base::Bind(&EnterpriseInstallAttributes::TriggerConsistencyCheck, |
| 381 weak_ptr_factory_.GetWeakPtr(), | 382 weak_ptr_factory_.GetWeakPtr(), dbus_retries_remaining - 1), |
| 382 dbus_retries_remaining - 1), | |
| 383 base::TimeDelta::FromSeconds(kDbusRetryIntervalInSeconds)); | 383 base::TimeDelta::FromSeconds(kDbusRetryIntervalInSeconds)); |
| 384 return; | 384 return; |
| 385 } | 385 } |
| 386 | 386 |
| 387 base::HistogramBase::Sample state = device_locked_; | 387 base::HistogramBase::Sample state = device_locked_; |
| 388 state |= 0x2 * (registration_mode_ == DEVICE_MODE_ENTERPRISE); | 388 state |= 0x2 * (registration_mode_ == DEVICE_MODE_ENTERPRISE); |
| 389 if (call_status == chromeos::DBUS_METHOD_CALL_SUCCESS) | 389 if (call_status == chromeos::DBUS_METHOD_CALL_SUCCESS) |
| 390 state |= 0x4 * result; | 390 state |= 0x4 * result; |
| 391 else | 391 else |
| 392 state = 0x8; // This case is not a bit mask. | 392 state = 0x8; // This case is not a bit mask. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 &consumer_kiosk_enabled) && | 491 &consumer_kiosk_enabled) && |
| 492 consumer_kiosk_enabled == "true") { | 492 consumer_kiosk_enabled == "true") { |
| 493 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; | 493 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; |
| 494 } else if (enterprise_user.empty() && enterprise_owned != "true") { | 494 } else if (enterprise_user.empty() && enterprise_owned != "true") { |
| 495 // |registration_user_| is empty on consumer devices. | 495 // |registration_user_| is empty on consumer devices. |
| 496 registration_mode_ = DEVICE_MODE_CONSUMER; | 496 registration_mode_ = DEVICE_MODE_CONSUMER; |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 | 499 |
| 500 } // namespace policy | 500 } // namespace policy |
| OLD | NEW |