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

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

Issue 4252002: address comments in CL 4054001 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/chromeos/login/shutdown_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/cros/cros_library.h" 10 #include "chrome/browser/chromeos/cros/cros_library.h"
11 #include "chrome/browser/chromeos/cros/power_library.h" 11 #include "chrome/browser/chromeos/cros/power_library.h"
12 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 12 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
13 #include "chrome/browser/chromeos/view_ids.h" 13 #include "chrome/browser/chromeos/view_ids.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
16 #include "views/background.h" 16 #include "views/background.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Bottom/Right Padding for Shutdown button. 20 // Style parameters for Shutdown button.
21
22 // Bottom/Right padding to locale the shutdown button.
21 const int kBottomPadding = 12; 23 const int kBottomPadding = 12;
22 const int kRightPadding = 12; 24 const int kRightPadding = 12;
23 25
26 // Normal/Hover colors.
27 const SkColor kButtonColor = 0xFF242A35;
28 const SkColor kHoverColor = 0xFF353E4E;
29
30 // Padding inside button.
31 const int kVerticalPadding = 13;
32 const int kIconTextPadding = 10;
33 const int kHorizontalPadding = 13;
34
35 // Rounded corner radious.
36 const int kCornerRadius = 4;
37
24 class HoverBackground : public views::Background { 38 class HoverBackground : public views::Background {
25 public: 39 public:
26 HoverBackground(views::Background* normal, views::Background* hover) 40 HoverBackground(views::Background* normal, views::Background* hover)
27 : normal_(normal), hover_(hover) { 41 : normal_(normal), hover_(hover) {
28 } 42 }
29 43
30 // views::Background implementation. 44 // views::Background implementation.
31 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { 45 virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
32 views::TextButton* button = static_cast<views::TextButton*>(view); 46 views::TextButton* button = static_cast<views::TextButton*>(view);
33 if (button->state() == views::CustomButton::BS_HOT) { 47 if (button->state() == views::CustomButton::BS_HOT) {
(...skipping 12 matching lines...) Expand all
46 60
47 } // namespace 61 } // namespace
48 62
49 namespace chromeos { 63 namespace chromeos {
50 64
51 ShutdownButton::ShutdownButton() 65 ShutdownButton::ShutdownButton()
52 : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, std::wstring())) { 66 : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, std::wstring())) {
53 } 67 }
54 68
55 void ShutdownButton::Init() { 69 void ShutdownButton::Init() {
56 SkColor kButtonColor = 0xFF242A35;
57 SkColor kHoverColor = 0xFF353E4E;
58 int kVerticalPadding = 13;
59 int kIconTextPadding = 10;
60 int kHorizontalPadding = 13;
61 int kCornerRadius = 4;
62
63 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 70 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
64 SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON)); 71 SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON));
65 set_icon_text_spacing(kIconTextPadding); 72 set_icon_text_spacing(kIconTextPadding);
66 SetFocusable(true); 73 SetFocusable(true);
67 // Set label colors. 74 // Set label colors.
68 SetEnabledColor(SK_ColorWHITE); 75 SetEnabledColor(SK_ColorWHITE);
69 SetDisabledColor(SK_ColorWHITE); 76 SetDisabledColor(SK_ColorWHITE);
70 SetHighlightColor(SK_ColorWHITE); 77 SetHighlightColor(SK_ColorWHITE);
71 SetHoverColor(SK_ColorWHITE); 78 SetHoverColor(SK_ColorWHITE);
72 // Disable throbbing and make border always visible. 79 // Disable throbbing and make border always visible.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return gdk_cursor_new(GDK_HAND2); 122 return gdk_cursor_new(GDK_HAND2);
116 } 123 }
117 124
118 void ShutdownButton::ButtonPressed(views::Button* sender, 125 void ShutdownButton::ButtonPressed(views::Button* sender,
119 const views::Event& event) { 126 const views::Event& event) {
120 DCHECK(CrosLibrary::Get()->EnsureLoaded()); 127 DCHECK(CrosLibrary::Get()->EnsureLoaded());
121 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); 128 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown();
122 } 129 }
123 130
124 } // namespace chromeos 131 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/shutdown_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698