| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // (e.g. when CapsLock indicator appears) | 335 // (e.g. when CapsLock indicator appears) |
| 336 gfx::Size widget_size(width()/2, | 336 gfx::Size widget_size(width()/2, |
| 337 status_area_->GetPreferredSize().height()); | 337 status_area_->GetPreferredSize().height()); |
| 338 const int widget_x = base::i18n::IsRTL() ? | 338 const int widget_x = base::i18n::IsRTL() ? |
| 339 kStatusAreaCornerPadding : | 339 kStatusAreaCornerPadding : |
| 340 width() - widget_size.width() - kStatusAreaCornerPadding; | 340 width() - widget_size.width() - kStatusAreaCornerPadding; |
| 341 gfx::Rect widget_bounds(widget_x, kStatusAreaCornerPadding, | 341 gfx::Rect widget_bounds(widget_x, kStatusAreaCornerPadding, |
| 342 widget_size.width(), widget_size.height()); | 342 widget_size.width(), widget_size.height()); |
| 343 // TODO(nkostylev|oshima): Make status area in the same window as | 343 // TODO(nkostylev|oshima): Make status area in the same window as |
| 344 // |webui_login_| once RenderWidgetHostViewViews and compositor are | 344 // |webui_login_| once RenderWidgetHostViewViews and compositor are |
| 345 // ready. | 345 // ready. This will also avoid having to override the status area |
| 346 views::Widget::InitParams widget_params( | 346 // widget type for the lock screen. |
| 347 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 347 views::Widget::InitParams widget_params(GetStatusAreaWidgetType()); |
| 348 widget_params.bounds = widget_bounds; | 348 widget_params.bounds = widget_bounds; |
| 349 widget_params.transparent = true; | 349 widget_params.transparent = true; |
| 350 widget_params.parent_widget = login_window_; | 350 widget_params.parent_widget = login_window_; |
| 351 status_window_ = new views::Widget; | 351 status_window_ = new views::Widget; |
| 352 status_window_->Init(widget_params); | 352 status_window_->Init(widget_params); |
| 353 | 353 |
| 354 #if defined(TOOLKIT_USES_GTK) | 354 #if defined(TOOLKIT_USES_GTK) |
| 355 std::vector<int> params; |
| 356 params.push_back(1); // Show while screen is locked. |
| 355 chromeos::WmIpc::instance()->SetWindowType( | 357 chromeos::WmIpc::instance()->SetWindowType( |
| 356 status_window_->GetNativeView(), | 358 status_window_->GetNativeView(), |
| 357 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, | 359 chromeos::WM_IPC_WINDOW_CHROME_INFO_BUBBLE, |
| 358 NULL); | 360 ¶ms); |
| 359 #endif | 361 #endif |
| 360 | 362 |
| 361 views::View* contents_view = new RightAlignedView; | 363 views::View* contents_view = new RightAlignedView; |
| 362 contents_view->AddChildView(status_area_); | 364 contents_view->AddChildView(status_area_); |
| 363 status_window_->SetContentsView(contents_view); | 365 status_window_->SetContentsView(contents_view); |
| 364 status_window_->Show(); | 366 status_window_->Show(); |
| 365 } | 367 } |
| 366 | 368 |
| 369 views::Widget::InitParams::Type WebUILoginView::GetStatusAreaWidgetType() { |
| 370 return views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; |
| 371 } |
| 372 |
| 367 // WebUILoginView private: ----------------------------------------------------- | 373 // WebUILoginView private: ----------------------------------------------------- |
| 368 | 374 |
| 369 bool WebUILoginView::HandleContextMenu(const ContextMenuParams& params) { | 375 bool WebUILoginView::HandleContextMenu(const ContextMenuParams& params) { |
| 370 // Do not show the context menu. | 376 // Do not show the context menu. |
| 371 #ifndef NDEBUG | 377 #ifndef NDEBUG |
| 372 return false; | 378 return false; |
| 373 #else | 379 #else |
| 374 return true; | 380 return true; |
| 375 #endif | 381 #endif |
| 376 } | 382 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 405 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding | 411 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding |
| 406 // an immediate authentication error (See crbug.com/103643). | 412 // an immediate authentication error (See crbug.com/103643). |
| 407 if (event.type == WebKit::WebInputEvent::KeyDown) { | 413 if (event.type == WebKit::WebInputEvent::KeyDown) { |
| 408 WebUI* web_ui = GetWebUI(); | 414 WebUI* web_ui = GetWebUI(); |
| 409 if (web_ui) | 415 if (web_ui) |
| 410 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 416 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
| 411 } | 417 } |
| 412 } | 418 } |
| 413 | 419 |
| 414 } // namespace chromeos | 420 } // namespace chromeos |
| OLD | NEW |