| 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/status/clock_menu_button.h" | 5 #include "chrome/browser/chromeos/status/clock_menu_button.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // TODO(rhashimoto): Remove this workaround when WebUI provides a | 154 // TODO(rhashimoto): Remove this workaround when WebUI provides a |
| 155 // top-level widget on the ChromeOS login screen that is a window. | 155 // top-level widget on the ChromeOS login screen that is a window. |
| 156 // The current BackgroundView class for the ChromeOS login screen | 156 // The current BackgroundView class for the ChromeOS login screen |
| 157 // creates a owning Widget that has a native GtkWindow but is not a | 157 // creates a owning Widget that has a native GtkWindow but is not a |
| 158 // Window. This makes it impossible to get the NativeWindow via | 158 // Window. This makes it impossible to get the NativeWindow via |
| 159 // the views API. This workaround casts the top-level NativeWidget | 159 // the views API. This workaround casts the top-level NativeWidget |
| 160 // to a NativeWindow that we can pass to MenuItemView::RunMenuAt(). | 160 // to a NativeWindow that we can pass to MenuItemView::RunMenuAt(). |
| 161 gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView()); | 161 gfx::NativeWindow window = GTK_WINDOW(source->GetWidget()->GetNativeView()); |
| 162 | 162 |
| 163 gfx::Point screen_loc; | 163 gfx::Point screen_location; |
| 164 views::View::ConvertPointToScreen(source, &screen_loc); | 164 views::View::ConvertPointToScreen(source, &screen_location); |
| 165 gfx::Rect bounds(screen_loc, source->size()); | 165 gfx::Rect bounds(screen_location, source->size()); |
| 166 menu_->RunMenuAt( | 166 menu_->RunMenuAt( |
| 167 window, | 167 window, |
| 168 this, | 168 this, |
| 169 bounds, | 169 bounds, |
| 170 views::MenuItemView::TOPRIGHT, | 170 views::MenuItemView::TOPRIGHT, |
| 171 true); | 171 true); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // ClockMenuButton, views::View implementation: | 174 // ClockMenuButton, views::View implementation: |
| 175 | 175 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 192 const string16 clock_open_options_label = | 192 const string16 clock_open_options_label = |
| 193 l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG); | 193 l10n_util::GetStringUTF16(IDS_STATUSBAR_CLOCK_OPEN_OPTIONS_DIALOG); |
| 194 menu_->AppendMenuItemWithLabel( | 194 menu_->AppendMenuItemWithLabel( |
| 195 CLOCK_OPEN_OPTIONS_ITEM, | 195 CLOCK_OPEN_OPTIONS_ITEM, |
| 196 UTF16ToWide(clock_open_options_label)); | 196 UTF16ToWide(clock_open_options_label)); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace chromeos | 201 } // namespace chromeos |
| OLD | NEW |