Chromium Code Reviews| Index: chrome/browser/chromeos/status/power_menu_button.cc |
| diff --git a/chrome/browser/chromeos/status/power_menu_button.cc b/chrome/browser/chromeos/status/power_menu_button.cc |
| index 04ec6b3f8c67ceceb6e15a647be54bdc7b0085ae..4d22db9cd62de949b6c64809c8fe3b5263f387bf 100644 |
| --- a/chrome/browser/chromeos/status/power_menu_button.cc |
| +++ b/chrome/browser/chromeos/status/power_menu_button.cc |
| @@ -4,15 +4,19 @@ |
| #include "chrome/browser/chromeos/status/power_menu_button.h" |
| +#include "base/debug/trace_event.h" |
| #include "base/string_number_conversions.h" |
| #include "base/time.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/chromeos/cros/cros_library.h" |
| #include "grit/generated_resources.h" |
| #include "grit/theme_resources.h" |
| +#include "ui/base/animation/slide_animation.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/canvas.h" |
| +#include "ui/gfx/transform.h" |
| +#include "ui/gfx/compositor/compositor.h" |
| #include "views/controls/menu/menu_item_view.h" |
| #include "views/controls/menu/submenu_view.h" |
| #include "views/widget/widget.h" |
| @@ -26,7 +30,7 @@ enum { |
| POWER_NO_BATTERY, |
| }; |
| -} // namespace |
| +} // namespace |
|
sadrul
2011/06/29 20:35:10
two spaces between } and //
|
| namespace chromeos { |
| @@ -126,26 +130,51 @@ void PowerMenuButton::OnLocaleChanged() { |
| // PowerMenuButton, views::ViewMenuDelegate implementation: |
| void PowerMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
| - UpdateMenu(); |
| +//UpdateMenu(); |
| +// |
| +//// TODO(rhashimoto): Remove this workaround when WebUI provides a |
| +//// top-level widget on the ChromeOS login screen that is a window. |
| +//// The current BackgroundView class for the ChromeOS login screen |
| +//// creates a owning Widget that has a native GtkWindow but is not a |
| +//// Window. This makes it impossible to get the NativeWindow via |
| +//// the views API. This workaround casts the top-level NativeWidget |
| +//// to a NativeWindow that we can pass to MenuItemView::RunMenuAt(). |
| +//gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView()); |
| +// |
| +//gfx::Point screen_loc; |
| +//views::View::ConvertPointToScreen(source, &screen_loc); |
| +//gfx::Rect bounds(screen_loc, source->size()); |
| +//menu_->RunMenuAt( |
| +// window, |
| +// this, |
| +// bounds, |
| +// views::MenuItemView::TOPRIGHT, |
| +// true); |
| + |
| + static int i = 0; |
| + |
| + sensors::ScreenOrientationChange change; |
| + switch (i) { |
| + case 0: change.upward = sensors::ScreenOrientationChange::LEFT; break; |
| + case 1: change.upward = sensors::ScreenOrientationChange::BOTTOM; break; |
| + case 2: change.upward = sensors::ScreenOrientationChange::RIGHT; break; |
| + case 3: change.upward = sensors::ScreenOrientationChange::TOP; break; |
| + case 4: change.upward = sensors::ScreenOrientationChange::BOTTOM; break; |
| + case 5: change.upward = sensors::ScreenOrientationChange::TOP; break; |
| + case 6: change.upward = sensors::ScreenOrientationChange::LEFT; break; |
| + case 7: change.upward = sensors::ScreenOrientationChange::RIGHT; break; |
| + case 8: change.upward = sensors::ScreenOrientationChange::LEFT; break; |
| + case 9: change.upward = sensors::ScreenOrientationChange::TOP; break; |
| + case 10: change.upward = sensors::ScreenOrientationChange::RIGHT; break; |
| + case 11: change.upward = sensors::ScreenOrientationChange::BOTTOM; break; |
| + case 12: change.upward = sensors::ScreenOrientationChange::LEFT; break; |
| + case 13: change.upward = sensors::ScreenOrientationChange::TOP; break; |
| + } |
| + i = (i + 1) % 14; |
| + std::string data(reinterpret_cast<const char*>(&change), sizeof(change)); |
| - // TODO(rhashimoto): Remove this workaround when WebUI provides a |
| - // top-level widget on the ChromeOS login screen that is a window. |
| - // The current BackgroundView class for the ChromeOS login screen |
| - // creates a owning Widget that has a native GtkWindow but is not a |
| - // Window. This makes it impossible to get the NativeWindow via |
| - // the views API. This workaround casts the top-level NativeWidget |
| - // to a NativeWindow that we can pass to MenuItemView::RunMenuAt(). |
| - gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView()); |
| - |
| - gfx::Point screen_loc; |
| - views::View::ConvertPointToScreen(source, &screen_loc); |
| - gfx::Rect bounds(screen_loc, source->size()); |
| - menu_->RunMenuAt( |
| - window, |
| - this, |
| - bounds, |
| - views::MenuItemView::TOPRIGHT, |
| - true); |
| + sensors::Provider::GetInstance()->FireSensorChanged( |
| + sensors::kScreenOrientationChannel, data); |
|
sadrul
2011/06/29 20:35:10
Since we are upstreaming this change, I think it'd
|
| } |
| //////////////////////////////////////////////////////////////////////////////// |