OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 ShutdownButton::ShutdownButton() | 66 ShutdownButton::ShutdownButton() |
67 : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, std::wstring())) { | 67 : ALLOW_THIS_IN_INITIALIZER_LIST(TextButton(this, std::wstring())) { |
68 } | 68 } |
69 | 69 |
70 void ShutdownButton::Init() { | 70 void ShutdownButton::Init() { |
71 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 71 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
72 SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON)); | 72 SetIcon(*rb.GetBitmapNamed(IDR_SHUTDOWN_ICON)); |
73 set_icon_text_spacing(kIconTextPadding); | 73 set_icon_text_spacing(kIconTextPadding); |
74 SetFocusable(true); | 74 SetFocusable(true); |
| 75 SetID(VIEW_ID_SCREEN_LOCKER_SHUTDOWN); |
75 // Set label colors. | 76 // Set label colors. |
76 SetEnabledColor(SK_ColorWHITE); | 77 SetEnabledColor(SK_ColorWHITE); |
77 SetDisabledColor(SK_ColorWHITE); | 78 SetDisabledColor(SK_ColorWHITE); |
78 SetHighlightColor(SK_ColorWHITE); | 79 SetHighlightColor(SK_ColorWHITE); |
79 SetHoverColor(SK_ColorWHITE); | 80 SetHoverColor(SK_ColorWHITE); |
80 // Disable throbbing and make border always visible. | 81 // Disable throbbing and make border always visible. |
81 SetAnimationDuration(0); | 82 SetAnimationDuration(0); |
82 SetNormalHasBorder(true); | 83 SetNormalHasBorder(true); |
83 // Setup round shapes. | 84 // Setup round shapes. |
84 set_background( | 85 set_background( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return gfx::GetCursor(GDK_HAND2); | 124 return gfx::GetCursor(GDK_HAND2); |
124 } | 125 } |
125 | 126 |
126 void ShutdownButton::ButtonPressed(views::Button* sender, | 127 void ShutdownButton::ButtonPressed(views::Button* sender, |
127 const views::Event& event) { | 128 const views::Event& event) { |
128 DCHECK(CrosLibrary::Get()->EnsureLoaded()); | 129 DCHECK(CrosLibrary::Get()->EnsureLoaded()); |
129 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); | 130 CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); |
130 } | 131 } |
131 | 132 |
132 } // namespace chromeos | 133 } // namespace chromeos |
OLD | NEW |