summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 20:35:17 +0000
committeroshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-24 20:35:17 +0000
commite94ccaeddbb8fb4cbc4e28d9e6f8df68ce48c37e (patch)
tree44eaa7de2227c288ec3098cb11a87d632505cdea
parent3cc212e94c86c9d48a6b10609b158bf6c2943b3f (diff)
downloadchromium_src-e94ccaeddbb8fb4cbc4e28d9e6f8df68ce48c37e.zip
chromium_src-e94ccaeddbb8fb4cbc4e28d9e6f8df68ce48c37e.tar.gz
chromium_src-e94ccaeddbb8fb4cbc4e28d9e6f8df68ce48c37e.tar.bz2
* Set the color of all state of signout button white
* Tab/alt-tab should cycle over to first/last focusable item. This wasn't working because views framework cannot handle views under TYPE_CHILD correctly. This is a hack to workaround this issue until DOMUI login is ready. * Fix callback names that were changed/removed in refactoring. BUG=chromium-os:9889, chromium-os:9845, chromium-os:10655 TEST=manual. Review URL: http://codereview.chromium.org/6329016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72379 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc50
-rw-r--r--chrome/browser/chromeos/login/screen_locker.h5
-rw-r--r--chrome/browser/chromeos/login/shutdown_button.cc1
-rw-r--r--chrome/browser/chromeos/login/user_view.cc7
-rw-r--r--chrome/browser/chromeos/view_ids.h6
5 files changed, 57 insertions, 12 deletions
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index b25230f..84f431f 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/login/screen_locker.h"
+#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <string>
#include <vector>
@@ -36,6 +37,7 @@
#include "chrome/browser/chromeos/login/shutdown_button.h"
#include "chrome/browser/chromeos/system_key_event_listener.h"
#include "chrome/browser/chromeos/wm_ipc.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -209,12 +211,7 @@ class LockWindow : public views::WidgetGtk {
// GTK propagates key events from parents to children.
// Make sure LockWindow will never handle key events.
- virtual gboolean OnKeyPress(GtkWidget* widget, GdkEventKey* event) {
- // Don't handle key event in the lock window.
- return false;
- }
-
- virtual gboolean OnKeyRelease(GtkWidget* widget, GdkEventKey* event) {
+ virtual gboolean OnKeyEvent(GtkWidget* widget, GdkEventKey* event) {
// Don't handle key event in the lock window.
return false;
}
@@ -297,11 +294,17 @@ class GrabWidget : public views::WidgetGtk {
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
grab_failure_count_(0),
kbd_grab_status_(GDK_GRAB_INVALID_TIME),
- mouse_grab_status_(GDK_GRAB_INVALID_TIME) {
+ mouse_grab_status_(GDK_GRAB_INVALID_TIME),
+ signout_link_(NULL),
+ shutdown_(NULL) {
}
virtual void Show() {
views::WidgetGtk::Show();
+ signout_link_ =
+ screen_locker_->GetViewByID(VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK);
+ shutdown_ = screen_locker_->GetViewByID(VIEW_ID_SCREEN_LOCKER_SHUTDOWN);
+ // These can be null in guest mode.
}
void ClearGtkGrab() {
@@ -319,6 +322,30 @@ class GrabWidget : public views::WidgetGtk {
gtk_grab_remove(current_grab_window);
}
+ virtual gboolean OnKeyEvent(GtkWidget* widget, GdkEventKey* event) {
+ views::KeyEvent key_event(event);
+ // This is a hack to workaround the issue crosbug.com/10655 due to
+ // the limitation that a focus manager cannot handle views in
+ // TYPE_CHILD WidgetGtk correctly.
+ if (signout_link_ &&
+ event->type == GDK_KEY_PRESS &&
+ (event->keyval == GDK_Tab ||
+ event->keyval == GDK_ISO_Left_Tab ||
+ event->keyval == GDK_KP_Tab)) {
+ DCHECK(shutdown_);
+ bool reverse = event->state & GDK_SHIFT_MASK;
+ if (reverse && signout_link_->HasFocus()) {
+ shutdown_->RequestFocus();
+ return true;
+ }
+ if (!reverse && shutdown_->HasFocus()) {
+ signout_link_->RequestFocus();
+ return true;
+ }
+ }
+ return views::WidgetGtk::OnKeyEvent(widget, event);
+ }
+
virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
WidgetGtk::OnButtonPress(widget, event);
// Never propagate event to parent.
@@ -354,6 +381,9 @@ class GrabWidget : public views::WidgetGtk {
GdkGrabStatus kbd_grab_status_;
GdkGrabStatus mouse_grab_status_;
+ views::View* signout_link_;
+ views::View* shutdown_;
+
DISALLOW_COPY_AND_ASSIGN(GrabWidget);
};
@@ -924,6 +954,10 @@ void ScreenLocker::OnGrabInputs() {
ScreenLockReady();
}
+views::View* ScreenLocker::GetViewByID(int id) {
+ return lock_widget_->GetRootView()->GetViewByID(id);
+}
+
// static
void ScreenLocker::Show() {
VLOG(1) << "In ScreenLocker::Show";
diff --git a/chrome/browser/chromeos/login/screen_locker.h b/chrome/browser/chromeos/login/screen_locker.h
index a0332cf..ab401f1 100644
--- a/chrome/browser/chromeos/login/screen_locker.h
+++ b/chrome/browser/chromeos/login/screen_locker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -115,6 +115,9 @@ class ScreenLocker : public LoginStatusConsumer,
return user_;
}
+ // Returns a view that has given view |id|, or null if it doesn't exist.
+ views::View* GetViewByID(int id);
+
// Initialize ScreenLocker class. It will listen to
// LOGIN_USER_CHANGED notification so that the screen locker accepts
// lock event only after a user is logged in.
diff --git a/chrome/browser/chromeos/login/shutdown_button.cc b/chrome/browser/chromeos/login/shutdown_button.cc
index f52b1fc..113626b 100644
--- a/chrome/browser/chromeos/login/shutdown_button.cc
+++ b/chrome/browser/chromeos/login/shutdown_button.cc
@@ -72,6 +72,7 @@ void ShutdownButton::Init() {
SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON));
set_icon_text_spacing(kIconTextPadding);
SetFocusable(true);
+ SetID(VIEW_ID_SCREEN_LOCKER_SHUTDOWN);
// Set label colors.
SetEnabledColor(SK_ColorWHITE);
SetDisabledColor(SK_ColorWHITE);
diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc
index f6025f2..75c17b7 100644
--- a/chrome/browser/chromeos/login/user_view.cc
+++ b/chrome/browser/chromeos/login/user_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "chrome/browser/chromeos/login/rounded_view.h"
+#include "chrome/browser/chromeos/view_ids.h"
#include "gfx/canvas.h"
#include "gfx/canvas_skia.h"
#include "gfx/gtk_util.h"
@@ -86,6 +87,10 @@ class SignoutView : public views::View {
signout_link_->SetFont(font);
signout_link_->SetColor(kTextColor);
signout_link_->SetFocusable(true);
+ signout_link_->SetHighlightedColor(kTextColor);
+ signout_link_->SetDisabledColor(kTextColor);
+ signout_link_->SetNormalColor(kTextColor);
+ signout_link_->SetID(VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK);
AddChildView(active_user_label_);
AddChildView(signout_link_);
diff --git a/chrome/browser/chromeos/view_ids.h b/chrome/browser/chromeos/view_ids.h
index e32e94e..090490e 100644
--- a/chrome/browser/chromeos/view_ids.h
+++ b/chrome/browser/chromeos/view_ids.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,8 +11,10 @@
// View ID used in ChromeOS.
enum ChromeOSViewIds {
// Start with the offset that is big enough to avoid possible
- // collison.
+ // collision.
VIEW_ID_STATUS_AREA = VIEW_ID_PREDEFINED_COUNT + 10000,
+ VIEW_ID_SCREEN_LOCKER_SIGNOUT_LINK,
+ VIEW_ID_SCREEN_LOCKER_SHUTDOWN,
};
#endif // CHROME_BROWSER_CHROMEOS_VIEW_IDS_H_