OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/ui/webui/chromeos/login/enable_debugging_screen_handler
.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/enable_debugging_screen_handler
.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 DVLOG(1) << "Showing enable debugging screen."; | 52 DVLOG(1) << "Showing enable debugging screen."; |
53 | 53 |
54 // Wait for cryptohomed before checking debugd. See http://crbug.com/440506. | 54 // Wait for cryptohomed before checking debugd. See http://crbug.com/440506. |
55 chromeos::CryptohomeClient* client = | 55 chromeos::CryptohomeClient* client = |
56 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 56 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
57 client->WaitForServiceToBeAvailable(base::Bind( | 57 client->WaitForServiceToBeAvailable(base::Bind( |
58 &EnableDebuggingScreenHandler::OnCryptohomeDaemonAvailabilityChecked, | 58 &EnableDebuggingScreenHandler::OnCryptohomeDaemonAvailabilityChecked, |
59 weak_ptr_factory_.GetWeakPtr())); | 59 weak_ptr_factory_.GetWeakPtr())); |
60 } | 60 } |
61 | 61 |
62 void EnableDebuggingScreenHandler::Show() { | 62 void EnableDebuggingScreenHandler::SetDelegate(Delegate* delegate) { |
| 63 delegate_ = delegate; |
| 64 if (page_is_ready()) |
| 65 Initialize(); |
| 66 } |
| 67 |
| 68 void EnableDebuggingScreenHandler::Show(OobeScreen screen) { |
| 69 if (screen != kScreenId) |
| 70 return; |
| 71 |
63 if (!page_is_ready()) { | 72 if (!page_is_ready()) { |
64 show_on_init_ = true; | 73 show_on_init_ = true; |
65 return; | 74 return; |
66 } | 75 } |
67 | 76 |
68 ShowWithParams(); | 77 ShowWithParams(); |
69 } | 78 } |
70 | 79 |
71 void EnableDebuggingScreenHandler::Hide() { | 80 void EnableDebuggingScreenHandler::Hide(OobeScreen screen) { |
| 81 if (screen != kScreenId) |
| 82 return; |
| 83 |
72 weak_ptr_factory_.InvalidateWeakPtrs(); | 84 weak_ptr_factory_.InvalidateWeakPtrs(); |
73 } | 85 } |
74 | 86 |
75 void EnableDebuggingScreenHandler::SetDelegate(Delegate* delegate) { | |
76 delegate_ = delegate; | |
77 if (page_is_ready()) | |
78 Initialize(); | |
79 } | |
80 | |
81 void EnableDebuggingScreenHandler::DeclareLocalizedValues( | 87 void EnableDebuggingScreenHandler::DeclareLocalizedValues( |
82 ::login::LocalizedValuesBuilder* builder) { | 88 ::login::LocalizedValuesBuilder* builder) { |
83 builder->Add("enableDebuggingScreenTitle", | 89 builder->Add("enableDebuggingScreenTitle", |
84 IDS_ENABLE_DEBUGGING_SCREEN_TITLE); | 90 IDS_ENABLE_DEBUGGING_SCREEN_TITLE); |
85 builder->Add("enableDebuggingScreenAccessibleTitle", | 91 builder->Add("enableDebuggingScreenAccessibleTitle", |
86 IDS_ENABLE_DEBUGGING_SCREEN_TITLE); | 92 IDS_ENABLE_DEBUGGING_SCREEN_TITLE); |
87 builder->Add("enableDebuggingCancelButton", IDS_CANCEL); | 93 builder->Add("enableDebuggingCancelButton", IDS_CANCEL); |
88 builder->Add("enableDebuggingOKButton", IDS_OK); | 94 builder->Add("enableDebuggingOKButton", IDS_OK); |
89 builder->Add("enableDebuggingRemoveButton", | 95 builder->Add("enableDebuggingRemoveButton", |
90 IDS_ENABLE_DEBUGGING_REMOVE_ROOTFS_BUTTON); | 96 IDS_ENABLE_DEBUGGING_REMOVE_ROOTFS_BUTTON); |
(...skipping 29 matching lines...) Expand all Loading... |
120 // static | 126 // static |
121 void EnableDebuggingScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 127 void EnableDebuggingScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
122 registry->RegisterBooleanPref(prefs::kDebuggingFeaturesRequested, false); | 128 registry->RegisterBooleanPref(prefs::kDebuggingFeaturesRequested, false); |
123 } | 129 } |
124 | 130 |
125 void EnableDebuggingScreenHandler::Initialize() { | 131 void EnableDebuggingScreenHandler::Initialize() { |
126 if (!page_is_ready() || !delegate_) | 132 if (!page_is_ready() || !delegate_) |
127 return; | 133 return; |
128 | 134 |
129 if (show_on_init_) { | 135 if (show_on_init_) { |
130 Show(); | 136 Show(kScreenId); |
131 show_on_init_ = false; | 137 show_on_init_ = false; |
132 } | 138 } |
133 } | 139 } |
134 | 140 |
135 void EnableDebuggingScreenHandler::RegisterMessages() { | 141 void EnableDebuggingScreenHandler::RegisterMessages() { |
136 AddCallback("enableDebuggingOnCancel", | 142 AddCallback("enableDebuggingOnCancel", |
137 &EnableDebuggingScreenHandler::HandleOnCancel); | 143 &EnableDebuggingScreenHandler::HandleOnCancel); |
138 AddCallback("enableDebuggingOnDone", | 144 AddCallback("enableDebuggingOnDone", |
139 &EnableDebuggingScreenHandler::HandleOnDone); | 145 &EnableDebuggingScreenHandler::HandleOnDone); |
140 AddCallback("enableDebuggingOnLearnMore", | 146 AddCallback("enableDebuggingOnLearnMore", |
141 &EnableDebuggingScreenHandler::HandleOnLearnMore); | 147 &EnableDebuggingScreenHandler::HandleOnLearnMore); |
142 AddCallback("enableDebuggingOnRemoveRootFSProtection", | 148 AddCallback("enableDebuggingOnRemoveRootFSProtection", |
143 &EnableDebuggingScreenHandler::HandleOnRemoveRootFSProtection); | 149 &EnableDebuggingScreenHandler::HandleOnRemoveRootFSProtection); |
144 AddCallback("enableDebuggingOnSetup", | 150 AddCallback("enableDebuggingOnSetup", |
145 &EnableDebuggingScreenHandler::HandleOnSetup); | 151 &EnableDebuggingScreenHandler::HandleOnSetup); |
146 } | 152 } |
147 | 153 |
148 void EnableDebuggingScreenHandler::HandleOnCancel() { | 154 void EnableDebuggingScreenHandler::HandleOnCancel() { |
149 if (delegate_) | 155 if (delegate_) |
150 delegate_->OnExit(false); | 156 delegate_->OnEnableDebuggingScreenViewExit(false); |
151 } | 157 } |
152 | 158 |
153 void EnableDebuggingScreenHandler::HandleOnDone() { | 159 void EnableDebuggingScreenHandler::HandleOnDone() { |
154 if (delegate_) | 160 if (delegate_) |
155 delegate_->OnExit(true); | 161 delegate_->OnEnableDebuggingScreenViewExit(true); |
156 } | 162 } |
157 | 163 |
158 void EnableDebuggingScreenHandler::HandleOnRemoveRootFSProtection() { | 164 void EnableDebuggingScreenHandler::HandleOnRemoveRootFSProtection() { |
159 UpdateUIState(UI_STATE_WAIT); | 165 UpdateUIState(UI_STATE_WAIT); |
160 chromeos::DebugDaemonClient* client = | 166 chromeos::DebugDaemonClient* client = |
161 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); | 167 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
162 client->RemoveRootfsVerification( | 168 client->RemoveRootfsVerification( |
163 base::Bind(&EnableDebuggingScreenHandler::OnRemoveRootfsVerification, | 169 base::Bind(&EnableDebuggingScreenHandler::OnRemoveRootfsVerification, |
164 weak_ptr_factory_.GetWeakPtr())); | 170 weak_ptr_factory_.GetWeakPtr())); |
165 } | 171 } |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 LoginWebDialog* dialog = new LoginWebDialog( | 288 LoginWebDialog* dialog = new LoginWebDialog( |
283 Profile::FromWebUI(web_ui()), | 289 Profile::FromWebUI(web_ui()), |
284 NULL, | 290 NULL, |
285 GetNativeWindow(), | 291 GetNativeWindow(), |
286 base::string16(), | 292 base::string16(), |
287 data_url); | 293 data_url); |
288 dialog->Show(); | 294 dialog->Show(); |
289 } | 295 } |
290 | 296 |
291 } // namespace chromeos | 297 } // namespace chromeos |
OLD | NEW |