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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 View::ConvertPointToScreen(this, &menu_position); | 216 View::ConvertPointToScreen(this, &menu_position); |
217 | 217 |
218 #if defined(OS_WIN) | 218 #if defined(OS_WIN) |
219 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN); | 219 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN); |
220 #elif defined(OS_CHROMEOS) | 220 #elif defined(OS_CHROMEOS) |
221 // A window won't overlap between displays on ChromeOS. | 221 // A window won't overlap between displays on ChromeOS. |
222 // Use the left bound of the display on which | 222 // Use the left bound of the display on which |
223 // the menu button exists. | 223 // the menu button exists. |
224 gfx::NativeView view = GetWidget()->GetNativeView(); | 224 gfx::NativeView view = GetWidget()->GetNativeView(); |
225 gfx::Display display = gfx::Screen::GetScreenFor( | 225 gfx::Display display = |
226 view)->GetDisplayNearestWindow(view); | 226 gfx::Screen::GetScreen()->GetDisplayNearestWindow(view); |
227 int left_bound = display.bounds().x(); | 227 int left_bound = display.bounds().x(); |
228 #else | 228 #else |
229 // The window might be positioned over the edge between two screens. We'll | 229 // The window might be positioned over the edge between two screens. We'll |
230 // want to position the dropdown on the screen the mouse cursor is on. | 230 // want to position the dropdown on the screen the mouse cursor is on. |
231 gfx::NativeView view = GetWidget()->GetNativeView(); | 231 gfx::Screen* screen = gfx::Screen::GetScreen(); |
232 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | |
233 gfx::Display display = screen->GetDisplayNearestPoint( | 232 gfx::Display display = screen->GetDisplayNearestPoint( |
234 screen->GetCursorScreenPoint()); | 233 screen->GetCursorScreenPoint()); |
235 int left_bound = display.bounds().x(); | 234 int left_bound = display.bounds().x(); |
236 #endif | 235 #endif |
237 if (menu_position.x() < left_bound) | 236 if (menu_position.x() < left_bound) |
238 menu_position.set_x(left_bound); | 237 menu_position.set_x(left_bound); |
239 | 238 |
240 // Make the button look depressed while the menu is open. | 239 // Make the button look depressed while the menu is open. |
241 SetState(STATE_PRESSED); | 240 SetState(STATE_PRESSED); |
242 | 241 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 SetMouseHandler(nullptr); | 275 SetMouseHandler(nullptr); |
277 | 276 |
278 // Set the state back to normal after the drop down menu is closed. | 277 // Set the state back to normal after the drop down menu is closed. |
279 if (state() != STATE_DISABLED) | 278 if (state() != STATE_DISABLED) |
280 SetState(STATE_NORMAL); | 279 SetState(STATE_NORMAL); |
281 } | 280 } |
282 | 281 |
283 const char* ToolbarButton::GetClassName() const { | 282 const char* ToolbarButton::GetClassName() const { |
284 return "ToolbarButton"; | 283 return "ToolbarButton"; |
285 } | 284 } |
OLD | NEW |