OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/toolbar/toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 // Both the menu position and the menu anchor type change if the UI layout | 170 // Both the menu position and the menu anchor type change if the UI layout |
171 // is right-to-left. | 171 // is right-to-left. |
172 gfx::Point menu_position(lb.origin()); | 172 gfx::Point menu_position(lb.origin()); |
173 menu_position.Offset(0, lb.height() - 1); | 173 menu_position.Offset(0, lb.height() - 1); |
174 if (base::i18n::IsRTL()) | 174 if (base::i18n::IsRTL()) |
175 menu_position.Offset(lb.width() - 1, 0); | 175 menu_position.Offset(lb.width() - 1, 0); |
176 | 176 |
177 View::ConvertPointToScreen(this, &menu_position); | 177 View::ConvertPointToScreen(this, &menu_position); |
178 | 178 |
179 #if defined(OS_WIN) | 179 #if defined(OS_CHROMEOS) |
180 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN); | |
181 #elif defined(OS_CHROMEOS) | |
182 // A window won't overlap between displays on ChromeOS. | 180 // A window won't overlap between displays on ChromeOS. |
183 // Use the left bound of the display on which | 181 // Use the left bound of the display on which |
184 // the menu button exists. | 182 // the menu button exists. |
185 gfx::NativeView view = GetWidget()->GetNativeView(); | 183 gfx::NativeView view = GetWidget()->GetNativeView(); |
186 display::Display display = | 184 display::Display display = |
187 display::Screen::GetScreen()->GetDisplayNearestView(view); | 185 display::Screen::GetScreen()->GetDisplayNearestView(view); |
188 int left_bound = display.bounds().x(); | 186 int left_bound = display.bounds().x(); |
189 #else | 187 #else |
190 // The window might be positioned over the edge between two screens. We'll | 188 // The window might be positioned over the edge between two screens. We'll |
191 // want to position the dropdown on the screen the mouse cursor is on. | 189 // want to position the dropdown on the screen the mouse cursor is on. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (state() != STATE_DISABLED) | 228 if (state() != STATE_DISABLED) |
231 SetState(STATE_NORMAL); | 229 SetState(STATE_NORMAL); |
232 | 230 |
233 menu_runner_.reset(); | 231 menu_runner_.reset(); |
234 menu_model_adapter_.reset(); | 232 menu_model_adapter_.reset(); |
235 } | 233 } |
236 | 234 |
237 const char* ToolbarButton::GetClassName() const { | 235 const char* ToolbarButton::GetClassName() const { |
238 return "ToolbarButton"; | 236 return "ToolbarButton"; |
239 } | 237 } |
OLD | NEW |