summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 03:48:14 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-27 03:48:14 +0000
commit5c3039618c8877b29712a5aececb99f8b4a4dd41 (patch)
tree190f9e93f7e06cecd0c9c7164e73624bd681f658 /chrome
parente82f366761fe478f9ba29179be26937a8a376e83 (diff)
downloadchromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.zip
chromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.tar.gz
chromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.tar.bz2
Scrap WNDCLASSEX.hCursor, update GetCursorForPoint.
Default to Win arrow in View::GetCursorForPoint & RootView::UpdateCursor. Simplify WidgetWin::SetCursor, avoid sending NULL. Only SetCuror on client events (DWM handles non-client). RIP TextButtonWithHandCursorOver (r57652 through r64531). RIP WindowWin::InitClass & |resize_cursors_|. Add OVERRIDE specifiers liberally. BUG=35356 TEST=Cursor styles shown in Win & Linux toolkit_views. Review URL: http://codereview.chromium.org/6880201 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/login/background_view.cc24
-rw-r--r--chrome/browser/chromeos/login/shutdown_button.cc12
-rw-r--r--chrome/browser/chromeos/login/shutdown_button.h12
-rw-r--r--chrome/browser/chromeos/login/user_view.cc15
-rw-r--r--chrome/browser/chromeos/login/user_view.h7
-rw-r--r--chrome/browser/chromeos/login/username_view.cc5
-rw-r--r--chrome/browser/chromeos/login/username_view.h11
-rw-r--r--chrome/browser/ui/views/content_setting_bubble_contents.cc11
8 files changed, 29 insertions, 68 deletions
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc
index 3650562..6802b94 100644
--- a/chrome/browser/chromeos/login/background_view.cc
+++ b/chrome/browser/chromeos/login/background_view.cc
@@ -72,30 +72,6 @@ int GetStepId(size_t step) {
}
}
-// The same as TextButton but switches cursor to hand cursor when mouse
-// is over the button.
-class TextButtonWithHandCursorOver : public views::TextButton {
- public:
- TextButtonWithHandCursorOver(views::ButtonListener* listener,
- const std::wstring& text)
- : views::TextButton(listener, text) {
- }
-
- virtual ~TextButtonWithHandCursorOver() {}
-
- virtual gfx::NativeCursor GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p) {
- if (!IsEnabled()) {
- return NULL;
- }
- return gfx::GetCursor(GDK_HAND2);
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TextButtonWithHandCursorOver);
-};
-
// This gets rid of the ugly X default cursor.
static void ResetXCursor() {
// TODO(sky): nuke this once new window manager is in place.
diff --git a/chrome/browser/chromeos/login/shutdown_button.cc b/chrome/browser/chromeos/login/shutdown_button.cc
index 693a363..248a364 100644
--- a/chrome/browser/chromeos/login/shutdown_button.cc
+++ b/chrome/browser/chromeos/login/shutdown_button.cc
@@ -43,7 +43,7 @@ class HoverBackground : public views::Background {
}
// views::Background implementation.
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
views::TextButton* button = static_cast<views::TextButton*>(view);
if (button->state() == views::CustomButton::BS_HOT) {
hover_->Paint(canvas, view);
@@ -114,13 +114,9 @@ void ShutdownButton::OnLocaleChanged() {
}
}
-gfx::NativeCursor ShutdownButton::GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p) {
- if (!IsEnabled()) {
- return NULL;
- }
- return gfx::GetCursor(GDK_HAND2);
+gfx::NativeCursor ShutdownButton::GetCursorForPoint(ui::EventType event_type,
+ const gfx::Point& p) {
+ return IsEnabled() ? gfx::GetCursor(GDK_HAND2) : NULL;
}
void ShutdownButton::ButtonPressed(views::Button* sender,
diff --git a/chrome/browser/chromeos/login/shutdown_button.h b/chrome/browser/chromeos/login/shutdown_button.h
index 15cb2ad..23fbc60 100644
--- a/chrome/browser/chromeos/login/shutdown_button.h
+++ b/chrome/browser/chromeos/login/shutdown_button.h
@@ -24,17 +24,17 @@ class ShutdownButton : public views::TextButton,
private:
// views::View overrides.
- virtual void OnLocaleChanged();
- virtual gfx::NativeCursor GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p);
+ virtual void OnLocaleChanged() OVERRIDE;
+ virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type,
+ const gfx::Point& p) OVERRIDE;
// views::ButtonListener implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(ShutdownButton);
};
} // namespace chromeos
-#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SHUTDOWN_BUTTON_H
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SHUTDOWN_BUTTON_H_
diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc
index e20d660..811bdfb 100644
--- a/chrome/browser/chromeos/login/user_view.cc
+++ b/chrome/browser/chromeos/login/user_view.cc
@@ -148,7 +148,7 @@ class RemoveButton : public views::TextButton {
protected:
// Overridden from View:
- virtual void OnMouseExited(const views::MouseEvent& event) {
+ virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE {
SetIcon(icon_);
views::TextButton::SetText(std::wstring());
ClearMaxTextSize();
@@ -159,7 +159,7 @@ class RemoveButton : public views::TextButton {
was_first_click_ = false;
}
- void NotifyClick(const views::Event& event) {
+ virtual void NotifyClick(const views::Event& event) OVERRIDE {
if (!was_first_click_) {
// On first click transform image to "remove" label.
SetIcon(SkBitmap());
@@ -190,7 +190,7 @@ class RemoveButton : public views::TextButton {
}
}
- void SetText(const std::wstring& text) {
+ virtual void SetText(const std::wstring& text) OVERRIDE {
text_ = text;
}
@@ -227,17 +227,16 @@ class PodImageView : public views::ImageView {
protected:
// Overridden from View:
- virtual void OnMouseEntered(const views::MouseEvent& event) {
+ virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE {
views::ImageView::SetImage(image_hot_);
}
- virtual void OnMouseExited(const views::MouseEvent& event) {
+ virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE {
views::ImageView::SetImage(image_);
}
- gfx::NativeCursor GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p) {
+ gfx::NativeCursor GetCursorForPoint(ui::EventType event_type,
+ const gfx::Point& p) OVERRIDE {
return (delegate_->IsUserSelected()) ? NULL : gfx::GetCursor(GDK_HAND2);
}
diff --git a/chrome/browser/chromeos/login/user_view.h b/chrome/browser/chromeos/login/user_view.h
index 9afa8ab..19d5f23 100644
--- a/chrome/browser/chromeos/login/user_view.h
+++ b/chrome/browser/chromeos/login/user_view.h
@@ -53,8 +53,8 @@ class UserView : public views::View,
UserView(Delegate* delegate, bool is_login, bool need_background);
// view::View overrides.
- virtual gfx::Size GetPreferredSize();
- virtual void OnLocaleChanged();
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void OnLocaleChanged() OVERRIDE;
// Sets the user's image. If image's size is less than
// 75% of window size, image size is preserved to avoid blur. Otherwise,
@@ -76,7 +76,8 @@ class UserView : public views::View,
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
// Overridden from views::ButtonListener.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) OVERRIDE;
private:
void Init(bool need_background);
diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc
index 58b06a5..a93cb01 100644
--- a/chrome/browser/chromeos/login/username_view.cc
+++ b/chrome/browser/chromeos/login/username_view.cc
@@ -97,9 +97,8 @@ UsernameView* UsernameView::CreateShapedUsernameView(
return new HalfRoundedView<UsernameView>(username, use_small_shape);
}
-gfx::NativeCursor UsernameView::GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p) {
+gfx::NativeCursor UsernameView::GetCursorForPoint(ui::EventType event_type,
+ const gfx::Point& p) {
return use_small_shape_ ? gfx::GetCursor(GDK_HAND2) : NULL;
}
diff --git a/chrome/browser/chromeos/login/username_view.h b/chrome/browser/chromeos/login/username_view.h
index 5c5f3db..46d1c57 100644
--- a/chrome/browser/chromeos/login/username_view.h
+++ b/chrome/browser/chromeos/login/username_view.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.
@@ -37,7 +37,7 @@ class UsernameView : public views::Label {
UsernameView(const std::wstring& username, bool use_small_shape);
// Overriden from views::Label.
- virtual void OnPaint(gfx::Canvas* canvas);
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
// True indicates that this UsernameView is used for a user pod not
// currently selected.
@@ -45,10 +45,9 @@ class UsernameView : public views::Label {
private:
// Overriden from View.
- virtual gfx::NativeCursor GetCursorForPoint(
- ui::EventType event_type,
- const gfx::Point& p);
- virtual void OnLocaleChanged();
+ virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type,
+ const gfx::Point& p) OVERRIDE;
+ virtual void OnLocaleChanged() OVERRIDE;
// Paints username to the bitmap with the bounds given.
void PaintUsername(const gfx::Rect& bounds);
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index 01261f3..5011140 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -50,10 +50,6 @@ class ContentSettingBubbleContents::Favicon : public views::ImageView {
virtual ~Favicon();
private:
-#if defined(OS_WIN)
- static HCURSOR g_hand_cursor;
-#endif
-
// views::View overrides:
virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
@@ -64,10 +60,6 @@ class ContentSettingBubbleContents::Favicon : public views::ImageView {
views::Link* link_;
};
-#if defined(OS_WIN)
-HCURSOR ContentSettingBubbleContents::Favicon::g_hand_cursor = NULL;
-#endif
-
ContentSettingBubbleContents::Favicon::Favicon(
const SkBitmap& image,
ContentSettingBubbleContents* parent,
@@ -97,8 +89,7 @@ gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint(
ui::EventType event_type,
const gfx::Point& p) {
#if defined(OS_WIN)
- if (!g_hand_cursor)
- g_hand_cursor = LoadCursor(NULL, IDC_HAND);
+ static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND);
return g_hand_cursor;
#elif defined(OS_LINUX)
return gfx::GetCursor(GDK_HAND2);