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

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

Issue 6880201: Scrap WNDCLASSEX.hCursor, update GetCursorForPoint, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use brace style struct init for WNDCLASSEX |class_ex|, fix comment. Created 9 years, 8 months 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
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/shutdown_button.h" 5 #include "chrome/browser/chromeos/login/shutdown_button.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/cros/power_library.h" 9 #include "chrome/browser/chromeos/cros/power_library.h"
10 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 10 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
(...skipping 25 matching lines...) Expand all
36 // Rounded corner radious. 36 // Rounded corner radious.
37 const int kCornerRadius = 4; 37 const int kCornerRadius = 4;
38 38
39 class HoverBackground : public views::Background { 39 class HoverBackground : public views::Background {
40 public: 40 public:
41 HoverBackground(views::Background* normal, views::Background* hover) 41 HoverBackground(views::Background* normal, views::Background* hover)
42 : normal_(normal), hover_(hover) { 42 : normal_(normal), hover_(hover) {
43 } 43 }
44 44
45 // views::Background implementation. 45 // views::Background implementation.
46 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { 46 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
47 views::TextButton* button = static_cast<views::TextButton*>(view); 47 views::TextButton* button = static_cast<views::TextButton*>(view);
48 if (button->state() == views::CustomButton::BS_HOT) { 48 if (button->state() == views::CustomButton::BS_HOT) {
49 hover_->Paint(canvas, view); 49 hover_->Paint(canvas, view);
50 } else { 50 } else {
51 normal_->Paint(canvas, view); 51 normal_->Paint(canvas, view);
52 } 52 }
53 } 53 }
54 54
55 private: 55 private:
56 views::Background* normal_; 56 views::Background* normal_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 void ShutdownButton::OnLocaleChanged() { 109 void ShutdownButton::OnLocaleChanged() {
110 SetText(UTF8ToWide(l10n_util::GetStringUTF8(IDS_SHUTDOWN_BUTTON))); 110 SetText(UTF8ToWide(l10n_util::GetStringUTF8(IDS_SHUTDOWN_BUTTON)));
111 if (parent()) { 111 if (parent()) {
112 parent()->Layout(); 112 parent()->Layout();
113 parent()->SchedulePaint(); 113 parent()->SchedulePaint();
114 } 114 }
115 } 115 }
116 116
117 gfx::NativeCursor ShutdownButton::GetCursorForPoint( 117 gfx::NativeCursor ShutdownButton::GetCursorForPoint(ui::EventType event_type,
118 ui::EventType event_type, 118 const gfx::Point& p) {
119 const gfx::Point& p) { 119 return IsEnabled() ? gfx::GetCursor(GDK_HAND2) : NULL;
120 if (!IsEnabled()) {
121 return NULL;
122 }
123 return gfx::GetCursor(GDK_HAND2);
124 } 120 }
125 121
126 void ShutdownButton::ButtonPressed(views::Button* sender, 122 void ShutdownButton::ButtonPressed(views::Button* sender,
127 const views::Event& event) { 123 const views::Event& event) {
128 DCHECK(CrosLibrary::Get()->EnsureLoaded()); 124 DCHECK(CrosLibrary::Get()->EnsureLoaded());
129 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); 125 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown();
130 } 126 }
131 127
132 } // namespace chromeos 128 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/shutdown_button.h ('k') | chrome/browser/chromeos/login/user_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698