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

Side by Side Diff: chrome/browser/chromeos/cros/cryptohome_library.cc

Issue 6869042: Add immutable settings checks when handling policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, address comments Created 9 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/enterprise_enrollment_screen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/cros/cryptohome_library.h" 5 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 typedef base::hash_map<int, Delegate*> CallbackMap; 238 typedef base::hash_map<int, Delegate*> CallbackMap;
239 mutable CallbackMap callback_map_; 239 mutable CallbackMap callback_map_;
240 240
241 void* cryptohome_connection_; 241 void* cryptohome_connection_;
242 242
243 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl); 243 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl);
244 }; 244 };
245 245
246 class CryptohomeLibraryStubImpl : public CryptohomeLibrary { 246 class CryptohomeLibraryStubImpl : public CryptohomeLibrary {
247 public: 247 public:
248 CryptohomeLibraryStubImpl() {} 248 CryptohomeLibraryStubImpl()
249 : locked_(false) {}
249 virtual ~CryptohomeLibraryStubImpl() {} 250 virtual ~CryptohomeLibraryStubImpl() {}
250 251
251 bool CheckKey(const std::string& user_email, const std::string& passhash) { 252 bool CheckKey(const std::string& user_email, const std::string& passhash) {
252 return true; 253 return true;
253 } 254 }
254 255
255 bool AsyncCheckKey(const std::string& user_email, 256 bool AsyncCheckKey(const std::string& user_email,
256 const std::string& passhash, 257 const std::string& passhash,
257 Delegate* callback) { 258 Delegate* callback) {
258 BrowserThread::PostTask( 259 BrowserThread::PostTask(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 bool InstallAttributesFinalize() { 393 bool InstallAttributesFinalize() {
393 locked_ = true; 394 locked_ = true;
394 return true; 395 return true;
395 } 396 }
396 397
397 bool InstallAttributesIsReady() { 398 bool InstallAttributesIsReady() {
398 return true; 399 return true;
399 } 400 }
400 401
401 bool InstallAttributesIsSecure() { 402 bool InstallAttributesIsSecure() {
402 return locked_; 403 return false;
403 } 404 }
404 405
405 bool InstallAttributesIsInvalid() { 406 bool InstallAttributesIsInvalid() {
406 return false; 407 return false;
407 } 408 }
408 409
409 bool InstallAttributesIsFirstInstall() { 410 bool InstallAttributesIsFirstInstall() {
410 return false; 411 return !locked_;
411 } 412 }
412 413
413 private: 414 private:
414 static void DoStubCallback(Delegate* callback) { 415 static void DoStubCallback(Delegate* callback) {
415 if (callback) 416 if (callback)
416 callback->OnComplete(true, kCryptohomeMountErrorNone); 417 callback->OnComplete(true, kCryptohomeMountErrorNone);
417 } 418 }
418 419
419 std::map<std::string, std::string> install_attrs_; 420 std::map<std::string, std::string> install_attrs_;
420 bool locked_; 421 bool locked_;
421 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryStubImpl); 422 DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryStubImpl);
422 }; 423 };
423 424
424 // static 425 // static
425 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) { 426 CryptohomeLibrary* CryptohomeLibrary::GetImpl(bool stub) {
426 if (stub) 427 if (stub)
427 return new CryptohomeLibraryStubImpl(); 428 return new CryptohomeLibraryStubImpl();
428 else 429 else
429 return new CryptohomeLibraryImpl(); 430 return new CryptohomeLibraryImpl();
430 } 431 }
431 432
432 } // namespace chromeos 433 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/enterprise_enrollment_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698