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

Unified Diff: chrome/browser/chromeos/login/ownership_status_checker.cc

Issue 7741045: Delay the metrics policy migration call to make sure ownership has been taken. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nits. Created 9 years, 4 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/chromeos/login/ownership_status_checker.cc
diff --git a/chrome/browser/chromeos/login/ownership_status_checker.cc b/chrome/browser/chromeos/login/ownership_status_checker.cc
index f7d67ab9399323a61d4f30aa145a19173fe5d09a..7e7a7e1519c0e6a9a0244b3b52ae2798d97f0e4b 100644
--- a/chrome/browser/chromeos/login/ownership_status_checker.cc
+++ b/chrome/browser/chromeos/login/ownership_status_checker.cc
@@ -28,13 +28,16 @@ void OwnershipStatusChecker::Core::Check() {
DCHECK(origin_loop_->BelongsToCurrentThread());
OwnershipService::Status status =
OwnershipService::GetSharedInstance()->GetStatus(false);
- if (status != OwnershipService::OWNERSHIP_UNKNOWN) {
+ // We can only report the OWNERSHIP_NONE status without executing code on the
+ // file thread because checking whether the current user is owner needs file
+ // access.
+ if (status == OwnershipService::OWNERSHIP_NONE) {
// Take a spin on the message loop in order to avoid reentrancy in callers.
origin_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this,
&OwnershipStatusChecker::Core::ReportResult,
- status));
+ status, false));
} else {
// Switch to the file thread to make the blocking call.
BrowserThread::PostTask(
@@ -53,18 +56,20 @@ void OwnershipStatusChecker::Core::CheckOnFileThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
OwnershipService::Status status =
OwnershipService::GetSharedInstance()->GetStatus(true);
+ bool current_user_is_owner =
+ OwnershipService::GetSharedInstance()->CurrentUserIsOwner();
origin_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this,
&OwnershipStatusChecker::Core::ReportResult,
- status));
+ status, current_user_is_owner));
}
void OwnershipStatusChecker::Core::ReportResult(
- OwnershipService::Status status) {
+ OwnershipService::Status status, bool current_user_is_owner) {
DCHECK(origin_loop_->BelongsToCurrentThread());
if (callback_.get()) {
- callback_->Run(status);
+ callback_->Run(status, current_user_is_owner);
callback_.reset();
}
}
« no previous file with comments | « chrome/browser/chromeos/login/ownership_status_checker.h ('k') | chrome/browser/chromeos/login/signed_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698