| OLD | NEW |
| 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/login/session_manager_observer.h" | 5 #include "chrome/browser/chromeos/login/session_manager_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/chromeos/login/signed_settings.h" | 8 #include "chrome/browser/chromeos/login/signed_settings.h" |
| 9 #include "chrome/browser/chromeos/login/signed_settings_cache.h" | 9 #include "chrome/browser/chromeos/login/signed_settings_cache.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SessionManagerObserver::~SessionManagerObserver() { | 46 SessionManagerObserver::~SessionManagerObserver() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void SessionManagerObserver::OwnerKeySet(bool success) { | 49 void SessionManagerObserver::OwnerKeySet(bool success) { |
| 50 VLOG(1) << "Owner key generation: " << (success ? "success" : "fail"); | 50 VLOG(1) << "Owner key generation: " << (success ? "success" : "fail"); |
| 51 int result = | 51 int result = |
| 52 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; | 52 chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED; |
| 53 if (!success) | 53 if (!success) |
| 54 result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; | 54 result = chrome::NOTIFICATION_OWNER_KEY_FETCH_ATTEMPT_FAILED; |
| 55 | 55 |
| 56 // We stored some settings in transient storage before owner was assigned. |
| 57 // Now owner is assigned and key is generated and we should persist |
| 58 // those settings into signed storage. |
| 59 if (success && g_browser_process && g_browser_process->local_state()) |
| 60 signed_settings_cache::Finalize(g_browser_process->local_state()); |
| 61 |
| 56 // Whether we exported the public key or not, send a notification | 62 // Whether we exported the public key or not, send a notification |
| 57 // indicating that we're done with this attempt. | 63 // indicating that we're done with this attempt. |
| 58 content::NotificationService::current()->Notify( | 64 content::NotificationService::current()->Notify( |
| 59 result, | 65 result, |
| 60 content::NotificationService::AllSources(), | 66 content::NotificationService::AllSources(), |
| 61 content::NotificationService::NoDetails()); | 67 content::NotificationService::NoDetails()); |
| 62 | |
| 63 // We stored some settings in transient storage before owner was assigned. | |
| 64 // Now owner is assigned and key is generated and we should persist | |
| 65 // those settings into signed storage. | |
| 66 if (g_browser_process && g_browser_process->local_state()) { | |
| 67 signed_settings_cache::Finalize(g_browser_process->local_state()); | |
| 68 } | |
| 69 } | 68 } |
| 70 | 69 |
| 71 void SessionManagerObserver::PropertyChangeComplete(bool success) { | 70 void SessionManagerObserver::PropertyChangeComplete(bool success) { |
| 72 if (success) { | 71 if (success) { |
| 73 StubDelegate* stub = new StubDelegate(); // Manages its own lifetime. | 72 StubDelegate* stub = new StubDelegate(); // Manages its own lifetime. |
| 74 stub->set_fetcher(SignedSettings::CreateRetrievePolicyOp(stub)); | 73 stub->set_fetcher(SignedSettings::CreateRetrievePolicyOp(stub)); |
| 75 stub->fetcher()->Execute(); | 74 stub->fetcher()->Execute(); |
| 76 } | 75 } |
| 77 } | 76 } |
| 78 | 77 |
| 79 } // namespace chromeos | 78 } // namespace chromeos |
| OLD | NEW |