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