summaryrefslogtreecommitdiffstats
path: root/ash/shell/lock_view.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-22 23:35:56 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-22 23:35:56 +0000
commit4b87bc2e3c13bd572a2b1b9a08ea2644120e6d6c (patch)
treed1dd9f473c130f4e51a9cda7e8b49cb42c8f13bf /ash/shell/lock_view.cc
parent4ad932db8c764a861f9c5a578599271f179a9020 (diff)
downloadchromium_src-4b87bc2e3c13bd572a2b1b9a08ea2644120e6d6c.zip
chromium_src-4b87bc2e3c13bd572a2b1b9a08ea2644120e6d6c.tar.gz
chromium_src-4b87bc2e3c13bd572a2b1b9a08ea2644120e6d6c.tar.bz2
Revert 128328 - Remove stops_event_propagation from Window, since it's broken.
Changes it to be implemented by the Aura client, via a new interface EventClient. The client can determine whether or not a given window and its subtree can receive events. I also cleaned up the way screen locking is entered/exited via the delegate, and some stuff in ash/shell. http://crbug.com/119347 TEST=none Review URL: https://chromiumcodereview.appspot.com/9788001 TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/9808044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell/lock_view.cc')
-rw-r--r--ash/shell/lock_view.cc46
1 files changed, 8 insertions, 38 deletions
diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc
index a604e89..c8a4d82 100644
--- a/ash/shell/lock_view.cc
+++ b/ash/shell/lock_view.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "ash/shell.h"
-#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/shell/example_factory.h"
#include "ash/tooltips/tooltip_controller.h"
@@ -12,7 +11,6 @@
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font.h"
-#include "ui/views/controls/button/text_button.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
@@ -21,23 +19,18 @@ using ash::Shell;
namespace ash {
namespace shell {
-class LockView : public views::WidgetDelegateView,
- public views::ButtonListener {
+class LockView : public views::WidgetDelegateView {
public:
- LockView() : unlock_button_(ALLOW_THIS_IN_INITIALIZER_LIST(
- new views::NativeTextButton(this, ASCIIToUTF16("Unlock")))) {
- AddChildView(unlock_button_);
- unlock_button_->set_focusable(true);
- }
+ LockView() {}
virtual ~LockView() {}
- // Overridden from views::View:
+ // Overridden from View:
virtual gfx::Size GetPreferredSize() OVERRIDE {
return gfx::Size(500, 400);
}
private:
- // Overridden from views::View:
+ // Overridden from View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
string16 text = ASCIIToUTF16("LOCKED!");
@@ -46,35 +39,14 @@ class LockView : public views::WidgetDelegateView,
(height() - font_.GetHeight()) / 2,
string_width, font_.GetHeight());
}
- virtual void Layout() OVERRIDE {
- gfx::Rect bounds = GetLocalBounds();
- gfx::Size ps = unlock_button_->GetPreferredSize();
- bounds.set_y(bounds.bottom() - ps.height() - 5);
- bounds.set_x((bounds.width() - ps.width()) / 2);
- bounds.set_size(ps);
- unlock_button_->SetBoundsRect(bounds);
- }
- virtual void ViewHierarchyChanged(bool is_add,
- views::View* parent,
- views::View* child) OVERRIDE {
- if (is_add && child == this)
- unlock_button_->RequestFocus();
+ virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE {
+ return true;
}
-
- // Overridden from views::WidgetDelegateView:
- virtual void WindowClosing() OVERRIDE {
- Shell::GetInstance()->delegate()->UnlockScreen();
- }
-
- // Overridden from views::ButtonListener:
- virtual void ButtonPressed(views::Button* sender,
- const views::Event& event) OVERRIDE {
- DCHECK(sender == unlock_button_);
+ virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE {
GetWidget()->Close();
}
gfx::Font font_;
- views::NativeTextButton* unlock_button_;
DISALLOW_COPY_AND_ASSIGN(LockView);
};
@@ -82,8 +54,7 @@ class LockView : public views::WidgetDelegateView,
void CreateLockScreen() {
LockView* lock_view = new LockView;
views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
gfx::Size ps = lock_view->GetPreferredSize();
gfx::Size root_window_size = Shell::GetRootWindow()->bounds().size();
@@ -98,7 +69,6 @@ void CreateLockScreen() {
widget->SetContentsView(lock_view);
widget->Show();
widget->GetNativeView()->SetName("LockView");
- widget->GetNativeView()->Focus();
Shell::GetInstance()->tooltip_controller()->UpdateTooltip(
widget->GetNativeView());