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/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/webui_login_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 status_area_visibility_on_init_ = visible; | 217 status_area_visibility_on_init_ = visible; |
218 } | 218 } |
219 | 219 |
220 // WebUILoginView protected: --------------------------------------------------- | 220 // WebUILoginView protected: --------------------------------------------------- |
221 | 221 |
222 void WebUILoginView::Layout() { | 222 void WebUILoginView::Layout() { |
223 DCHECK(webui_login_); | 223 DCHECK(webui_login_); |
224 webui_login_->SetBoundsRect(bounds()); | 224 webui_login_->SetBoundsRect(bounds()); |
225 } | 225 } |
226 | 226 |
| 227 void WebUILoginView::OnLocaleChanged() { |
| 228 // Proxy settings dialog contains localized strings. |
| 229 proxy_settings_dialog_.reset(); |
| 230 SchedulePaint(); |
| 231 } |
| 232 |
227 void WebUILoginView::ChildPreferredSizeChanged(View* child) { | 233 void WebUILoginView::ChildPreferredSizeChanged(View* child) { |
228 Layout(); | 234 Layout(); |
229 SchedulePaint(); | 235 SchedulePaint(); |
230 } | 236 } |
231 | 237 |
232 // Overridden from StatusAreaButton::Delegate: | 238 // Overridden from StatusAreaButton::Delegate: |
233 | 239 |
234 bool WebUILoginView::ShouldExecuteStatusAreaCommand( | 240 bool WebUILoginView::ShouldExecuteStatusAreaCommand( |
235 const views::View* button_view, int command_id) const { | 241 const views::View* button_view, int command_id) const { |
236 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS) | 242 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS) |
237 return true; | 243 return true; |
238 return false; | 244 return false; |
239 } | 245 } |
240 | 246 |
241 void WebUILoginView::ExecuteStatusAreaCommand( | 247 void WebUILoginView::ExecuteStatusAreaCommand( |
242 const views::View* button_view, int command_id) { | 248 const views::View* button_view, int command_id) { |
243 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS) { | 249 if (command_id == StatusAreaButton::Delegate::SHOW_NETWORK_OPTIONS) { |
244 if (proxy_settings_dialog_.get() == NULL) { | 250 if (proxy_settings_dialog_.get() == NULL) { |
245 proxy_settings_dialog_.reset(new ProxySettingsDialog( | 251 proxy_settings_dialog_.reset(new ProxySettingsDialog(NULL, |
246 this, GetNativeWindow())); | 252 GetNativeWindow())); |
247 } | 253 } |
248 proxy_settings_dialog_->Show(); | 254 proxy_settings_dialog_->Show(); |
249 } | 255 } |
250 } | 256 } |
251 | 257 |
252 gfx::Font WebUILoginView::GetStatusAreaFont(const gfx::Font& font) const { | 258 gfx::Font WebUILoginView::GetStatusAreaFont(const gfx::Font& font) const { |
253 return font; | 259 return font; |
254 } | 260 } |
255 | 261 |
256 StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const { | 262 StatusAreaButton::TextStyle WebUILoginView::GetStatusAreaTextStyle() const { |
257 return StatusAreaButton::GRAY_PLAIN; | 263 return StatusAreaButton::GRAY_PLAIN; |
258 } | 264 } |
259 | 265 |
260 void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) { | 266 void WebUILoginView::ButtonVisibilityChanged(views::View* button_view) { |
261 status_area_->UpdateButtonVisibility(); | 267 status_area_->UpdateButtonVisibility(); |
262 } | 268 } |
263 | 269 |
264 // Overridden from LoginHtmlDialog::Delegate: | |
265 | |
266 void WebUILoginView::OnDialogClosed() { | |
267 } | |
268 | |
269 void WebUILoginView::OnLocaleChanged() { | |
270 // Proxy settings dialog contains localized strings. | |
271 proxy_settings_dialog_.reset(); | |
272 SchedulePaint(); | |
273 } | |
274 | |
275 void WebUILoginView::OnRenderHostCreated(RenderViewHost* host) { | 270 void WebUILoginView::OnRenderHostCreated(RenderViewHost* host) { |
276 new SnifferObserver(host, GetWebUI()); | 271 new SnifferObserver(host, GetWebUI()); |
277 } | 272 } |
278 | 273 |
279 void WebUILoginView::OnTabMainFrameLoaded() { | 274 void WebUILoginView::OnTabMainFrameLoaded() { |
280 VLOG(1) << "WebUI login main frame loaded."; | 275 VLOG(1) << "WebUI login main frame loaded."; |
281 } | 276 } |
282 | 277 |
283 void WebUILoginView::OnTabMainFrameFirstRender() { | 278 void WebUILoginView::OnTabMainFrameFirstRender() { |
284 VLOG(1) << "WebUI login main frame rendered."; | 279 VLOG(1) << "WebUI login main frame rendered."; |
| 280 StatusAreaViewChromeos::SetScreenMode( |
| 281 StatusAreaViewChromeos::LOGIN_MODE_WEBUI); |
285 // In aura there's a global status area shown already. | 282 // In aura there's a global status area shown already. |
286 // TODO(nkostylev): Figure out how to communicate from login screen with | 283 // TODO(nkostylev): Figure out how to communicate from login screen with |
287 // global status area. | 284 // global status area. |
288 #if !defined(USE_AURA) | 285 #if !defined(USE_AURA) |
289 InitStatusArea(); | 286 InitStatusArea(); |
290 #endif | 287 #endif |
291 | 288 |
292 #if defined(TOOLKIT_USES_GTK) | 289 #if defined(TOOLKIT_USES_GTK) |
293 if (host_window_frozen_) { | 290 if (host_window_frozen_) { |
294 host_window_frozen_ = false; | 291 host_window_frozen_ = false; |
(...skipping 19 matching lines...) Expand all Loading... |
314 OobeUI* oobe_ui = static_cast<OobeUI*>(GetWebUI()); | 311 OobeUI* oobe_ui = static_cast<OobeUI*>(GetWebUI()); |
315 // Notify OOBE that the login frame has been rendered. Currently | 312 // Notify OOBE that the login frame has been rendered. Currently |
316 // this is used to start camera presence check. | 313 // this is used to start camera presence check. |
317 oobe_ui->OnLoginPromptVisible(); | 314 oobe_ui->OnLoginPromptVisible(); |
318 } | 315 } |
319 | 316 |
320 void WebUILoginView::InitStatusArea() { | 317 void WebUILoginView::InitStatusArea() { |
321 DCHECK(status_area_ == NULL); | 318 DCHECK(status_area_ == NULL); |
322 DCHECK(status_window_ == NULL); | 319 DCHECK(status_window_ == NULL); |
323 status_area_ = new StatusAreaViewChromeos(); | 320 status_area_ = new StatusAreaViewChromeos(); |
324 status_area_->Init(this, StatusAreaViewChromeos::LOGIN_MODE_WEBUI); | 321 status_area_->Init(this); |
325 status_area_->SetVisible(status_area_visibility_on_init_); | 322 status_area_->SetVisible(status_area_visibility_on_init_); |
326 | 323 |
327 // Width of |status_window| is meant to be large enough. | 324 // Width of |status_window| is meant to be large enough. |
328 // The current value of status_area_->GetPreferredSize().width() | 325 // The current value of status_area_->GetPreferredSize().width() |
329 // will be too small when button status is changed. | 326 // will be too small when button status is changed. |
330 // (e.g. when CapsLock indicator appears) | 327 // (e.g. when CapsLock indicator appears) |
331 gfx::Size widget_size(width()/2, | 328 gfx::Size widget_size(width()/2, |
332 status_area_->GetPreferredSize().height()); | 329 status_area_->GetPreferredSize().height()); |
333 const int widget_x = base::i18n::IsRTL() ? | 330 const int widget_x = base::i18n::IsRTL() ? |
334 kStatusAreaCornerPadding : | 331 kStatusAreaCornerPadding : |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding | 402 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding |
406 // an immediate authentication error (See crbug.com/103643). | 403 // an immediate authentication error (See crbug.com/103643). |
407 if (event.type == WebKit::WebInputEvent::KeyDown) { | 404 if (event.type == WebKit::WebInputEvent::KeyDown) { |
408 WebUI* web_ui = GetWebUI(); | 405 WebUI* web_ui = GetWebUI(); |
409 if (web_ui) | 406 if (web_ui) |
410 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 407 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
411 } | 408 } |
412 } | 409 } |
413 | 410 |
414 } // namespace chromeos | 411 } // namespace chromeos |
OLD | NEW |