Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: chrome/browser/chromeos/login/user_controller_gtk.cc

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/login/user_controller.h"
6
7 #include "views/widget/native_widget_gtk.h"
8
9 using views::NativeWidgetGtk;
10
11 namespace chromeos {
12
13 namespace {
14
15 class ControlsWidget : public NativeWidgetGtk {
16 public:
17 ControlsWidget() : NativeWidgetGtk(new views::Widget) {
18 }
19
20 private:
21 // NativeWidgetGtk overrides:
22 virtual void OnMap(GtkWidget* widget) OVERRIDE {
23 // For some reason, Controls window never gets first expose event,
24 // which makes WM believe that the login screen is not ready.
25 // This is a workaround to let WM show the login screen. While
26 // this may allow WM to show unpainted window, we haven't seen any
27 // issue (yet). We will not investigate this further because we're
28 // migrating to different implemention (WebUI).
29 UpdateFreezeUpdatesProperty(GTK_WINDOW(GetNativeView()),
30 false /* remove */);
31 }
32
33 DISALLOW_COPY_AND_ASSIGN(ControlsWidget);
34 };
35
36 // Widget that notifies window manager about clicking on itself.
37 // Doesn't send anything if user is selected.
38 class ClickNotifyingWidget : public NativeWidgetGtk {
39 public:
40 explicit ClickNotifyingWidget(UserController* controller)
41 : NativeWidgetGtk(new views::Widget),
42 controller_(controller) {
43 }
44
45 private:
46 gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
47 if (!controller_->IsUserSelected())
48 controller_->SelectUserRelative(0);
49
50 return NativeWidgetGtk::OnButtonPress(widget, event);
51 }
52
53 UserController* controller_;
54
55 DISALLOW_COPY_AND_ASSIGN(ClickNotifyingWidget);
56 };
57
58 views::Widget* InitWidget(
59 views::WidgetDelegate* delegate,
60 views::internal::NativeWidgetPrivate* native_widget_private,
61 const gfx::Rect& bounds) {
62 views::Widget::InitParams params(
63 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
64 params.delegate = delegate;
65 params.transparent = true;
66 params.bounds = bounds;
67 params.native_widget = native_widget_private;
68 native_widget_private->GetWidget()->Init(params);
69 GdkWindow* gdk_window =
70 native_widget_private->GetWidget()->GetNativeView()->window;
71 gdk_window_set_back_pixmap(gdk_window, NULL, false);
72 return native_widget_private->GetWidget();
73 }
74
75 } // namespace
76
77 // static
78 views::Widget* UserController::CreateControlsWidget(
79 views::WidgetDelegate* delegate,
80 const gfx::Rect& bounds) {
81 return InitWidget(delegate, new ControlsWidget(), bounds);
82 }
83
84 // static
85 views::Widget* UserController::CreateClickNotifyingWidget(
86 UserController* controller,
87 const gfx::Rect& bounds) {
88 return InitWidget(controller, new ClickNotifyingWidget(controller), bounds);
89 }
90
91 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_controller.cc ('k') | chrome/browser/chromeos/login/user_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698