| 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/dbus/dbus_thread_manager.h" | 9 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 10 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 10 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ShutdownButton::LayoutIn(views::View* parent) { | 97 void ShutdownButton::LayoutIn(views::View* parent) { |
| 98 // No RTL for now. RTL will be handled in new WebUI based Login/Locker. | 98 // No RTL for now. RTL will be handled in new WebUI based Login/Locker. |
| 99 gfx::Size button_size = GetPreferredSize(); | 99 gfx::Size button_size = GetPreferredSize(); |
| 100 SetBounds( | 100 SetBounds( |
| 101 kLeftPadding, kTopPadding, button_size.width(), button_size.height()); | 101 kLeftPadding, kTopPadding, button_size.width(), button_size.height()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 gfx::NativeCursor ShutdownButton::GetCursor(const views::MouseEvent& event) { | 104 gfx::NativeCursor ShutdownButton::GetCursor(const views::MouseEvent& event) { |
| 105 return IsEnabled() ? gfx::GetCursor(GDK_HAND2) : NULL; | 105 return enabled() ? gfx::GetCursor(GDK_HAND2) : NULL; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ShutdownButton::OnLocaleChanged() { | 108 void ShutdownButton::OnLocaleChanged() { |
| 109 SetText(l10n_util::GetStringUTF16(IDS_SHUTDOWN_BUTTON)); | 109 SetText(l10n_util::GetStringUTF16(IDS_SHUTDOWN_BUTTON)); |
| 110 if (parent()) { | 110 if (parent()) { |
| 111 parent()->Layout(); | 111 parent()->Layout(); |
| 112 parent()->SchedulePaint(); | 112 parent()->SchedulePaint(); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ShutdownButton::ButtonPressed(views::Button* sender, | 116 void ShutdownButton::ButtonPressed(views::Button* sender, |
| 117 const views::Event& event) { | 117 const views::Event& event) { |
| 118 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); | 118 DBusThreadManager::Get()->GetPowerManagerClient()->RequestShutdown(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |