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_temp_storage.h" | 9 #include "chrome/browser/chromeos/login/signed_settings_temp_storage.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
11 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
12 #include "content/common/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class StubDelegate | 18 class StubDelegate |
19 : public SignedSettings::Delegate< | 19 : public SignedSettings::Delegate< |
20 const enterprise_management::PolicyFetchResponse&> { | 20 const enterprise_management::PolicyFetchResponse&> { |
21 public: | 21 public: |
22 StubDelegate() : policy_fetcher_(NULL) {} | 22 StubDelegate() : policy_fetcher_(NULL) {} |
(...skipping 25 matching lines...) Expand all Loading... |
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 // Whether we exported the public key or not, send a notification | 56 // Whether we exported the public key or not, send a notification |
57 // indicating that we're done with this attempt. | 57 // indicating that we're done with this attempt. |
58 NotificationService::current()->Notify(result, | 58 content::NotificationService::current()->Notify( |
59 NotificationService::AllSources(), | 59 result, |
60 NotificationService::NoDetails()); | 60 content::NotificationService::AllSources(), |
| 61 content::NotificationService::NoDetails()); |
61 | 62 |
62 // We stored some settings in transient storage before owner was assigned. | 63 // We stored some settings in transient storage before owner was assigned. |
63 // Now owner is assigned and key is generated and we should persist | 64 // Now owner is assigned and key is generated and we should persist |
64 // those settings into signed storage. | 65 // those settings into signed storage. |
65 if (g_browser_process && g_browser_process->local_state()) { | 66 if (g_browser_process && g_browser_process->local_state()) { |
66 SignedSettingsTempStorage::Finalize(g_browser_process->local_state()); | 67 SignedSettingsTempStorage::Finalize(g_browser_process->local_state()); |
67 } | 68 } |
68 } | 69 } |
69 | 70 |
70 void SessionManagerObserver::PropertyChangeComplete(bool success) { | 71 void SessionManagerObserver::PropertyChangeComplete(bool success) { |
71 if (success) { | 72 if (success) { |
72 StubDelegate* stub = new StubDelegate(); // Manages its own lifetime. | 73 StubDelegate* stub = new StubDelegate(); // Manages its own lifetime. |
73 stub->set_fetcher(SignedSettings::CreateRetrievePolicyOp(stub)); | 74 stub->set_fetcher(SignedSettings::CreateRetrievePolicyOp(stub)); |
74 stub->fetcher()->Execute(); | 75 stub->fetcher()->Execute(); |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 } // namespace chromeos | 79 } // namespace chromeos |
OLD | NEW |