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

Side by Side Diff: chrome/browser/chromeos/login/ownership_service.cc

Issue 6272012: Temporary whitelist several cases of disk I/O on the UI threads in cros. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: remove UI thread restriction, nits Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/login/ownership_service.h" 5 #include "chrome/browser/chromeos/login/ownership_service.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/threading/thread_restrictions.h"
10 #include "chrome/browser/browser_thread.h" 11 #include "chrome/browser/browser_thread.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 14
14 static base::LazyInstance<OwnershipService> g_ownership_service( 15 static base::LazyInstance<OwnershipService> g_ownership_service(
15 base::LINKER_INITIALIZED); 16 base::LINKER_INITIALIZED);
16 17
17 // static 18 // static
18 OwnershipService* OwnershipService::GetSharedInstance() { 19 OwnershipService* OwnershipService::GetSharedInstance() {
19 return g_ownership_service.Pointer(); 20 return g_ownership_service.Pointer();
20 } 21 }
21 22
22 OwnershipService::OwnershipService() 23 OwnershipService::OwnershipService()
23 : manager_(new OwnerManager), 24 : manager_(new OwnerManager),
24 utils_(OwnerKeyUtils::Create()) { 25 utils_(OwnerKeyUtils::Create()) {
25 } 26 }
26 27
27 OwnershipService::~OwnershipService() {} 28 OwnershipService::~OwnershipService() {}
28 29
29 30
30 bool OwnershipService::IsAlreadyOwned() { 31 bool OwnershipService::IsAlreadyOwned() {
32 // This should not do blocking IO from the UI thread.
33 // Temporarily allow it for now. http://crbug.com/70097
34 base::ThreadRestrictions::ScopedAllowIO allow_io;
31 return file_util::PathExists(utils_->GetOwnerKeyFilePath()); 35 return file_util::PathExists(utils_->GetOwnerKeyFilePath());
32 } 36 }
33 37
34 bool OwnershipService::StartLoadOwnerKeyAttempt() { 38 bool OwnershipService::StartLoadOwnerKeyAttempt() {
35 if (!IsAlreadyOwned()) { 39 if (!IsAlreadyOwned()) {
36 LOG(WARNING) << "Device not yet owned"; 40 LOG(WARNING) << "Device not yet owned";
37 return false; 41 return false;
38 } 42 }
39 BrowserThread::PostTask( 43 BrowserThread::PostTask(
40 BrowserThread::FILE, FROM_HERE, 44 BrowserThread::FILE, FROM_HERE,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return; 99 return;
96 } 100 }
97 101
98 bool OwnershipService::CurrentUserIsOwner() { 102 bool OwnershipService::CurrentUserIsOwner() {
99 // If this user has the private key associated with the owner's 103 // If this user has the private key associated with the owner's
100 // public key, this user is the owner. 104 // public key, this user is the owner.
101 return IsAlreadyOwned() && manager_->EnsurePrivateKey(); 105 return IsAlreadyOwned() && manager_->EnsurePrivateKey();
102 } 106 }
103 107
104 } // namespace chromeos 108 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/update_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698