| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102   gfx::Size button_size = GetPreferredSize(); | 102   gfx::Size button_size = GetPreferredSize(); | 
| 103   SetBounds( | 103   SetBounds( | 
| 104       parent->width() - button_size.width()- kRightPadding, | 104       parent->width() - button_size.width()- kRightPadding, | 
| 105       parent->height() - button_size.height() - kBottomPadding, | 105       parent->height() - button_size.height() - kBottomPadding, | 
| 106       button_size.width(), | 106       button_size.width(), | 
| 107       button_size.height()); | 107       button_size.height()); | 
| 108 } | 108 } | 
| 109 | 109 | 
| 110 void ShutdownButton::OnLocaleChanged() { | 110 void ShutdownButton::OnLocaleChanged() { | 
| 111   SetText(UTF8ToWide(l10n_util::GetStringUTF8(IDS_SHUTDOWN_BUTTON))); | 111   SetText(UTF8ToWide(l10n_util::GetStringUTF8(IDS_SHUTDOWN_BUTTON))); | 
| 112   if (GetParent()) { | 112   if (parent()) { | 
| 113     GetParent()->Layout(); | 113     parent()->Layout(); | 
| 114     GetParent()->SchedulePaint(); | 114     parent()->SchedulePaint(); | 
| 115   } | 115   } | 
| 116 } | 116 } | 
| 117 | 117 | 
| 118 gfx::NativeCursor ShutdownButton::GetCursorForPoint( | 118 gfx::NativeCursor ShutdownButton::GetCursorForPoint( | 
| 119     views::Event::EventType event_type, | 119     views::Event::EventType event_type, | 
| 120     const gfx::Point& p) { | 120     const gfx::Point& p) { | 
| 121   if (!IsEnabled()) { | 121   if (!IsEnabled()) { | 
| 122     return NULL; | 122     return NULL; | 
| 123   } | 123   } | 
| 124   return gfx::GetCursor(GDK_HAND2); | 124   return gfx::GetCursor(GDK_HAND2); | 
| 125 } | 125 } | 
| 126 | 126 | 
| 127 void ShutdownButton::ButtonPressed(views::Button* sender, | 127 void ShutdownButton::ButtonPressed(views::Button* sender, | 
| 128                                    const views::Event& event) { | 128                                    const views::Event& event) { | 
| 129   DCHECK(CrosLibrary::Get()->EnsureLoaded()); | 129   DCHECK(CrosLibrary::Get()->EnsureLoaded()); | 
| 130   CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); | 130   CrosLibrary::Get()->GetPowerLibrary()->RequestShutdown(); | 
| 131 } | 131 } | 
| 132 | 132 | 
| 133 }  // namespace chromeos | 133 }  // namespace chromeos | 
| OLD | NEW | 
|---|