Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 2751833004: Reland "Add display::GetDisplayNearestView" (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 View::ConvertPointToScreen(this, &menu_position); 177 View::ConvertPointToScreen(this, &menu_position);
178 178
179 #if defined(OS_WIN) 179 #if defined(OS_WIN)
180 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN); 180 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN);
181 #elif defined(OS_CHROMEOS) 181 #elif defined(OS_CHROMEOS)
182 // A window won't overlap between displays on ChromeOS. 182 // A window won't overlap between displays on ChromeOS.
183 // Use the left bound of the display on which 183 // Use the left bound of the display on which
184 // the menu button exists. 184 // the menu button exists.
185 gfx::NativeView view = GetWidget()->GetNativeView(); 185 gfx::NativeView view = GetWidget()->GetNativeView();
186 display::Display display = 186 display::Display display =
187 display::Screen::GetScreen()->GetDisplayNearestWindow(view); 187 display::Screen::GetScreen()->GetDisplayNearestView(view);
188 int left_bound = display.bounds().x(); 188 int left_bound = display.bounds().x();
189 #else 189 #else
190 // The window might be positioned over the edge between two screens. We'll 190 // 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. 191 // want to position the dropdown on the screen the mouse cursor is on.
192 display::Screen* screen = display::Screen::GetScreen(); 192 display::Screen* screen = display::Screen::GetScreen();
193 display::Display display = 193 display::Display display =
194 screen->GetDisplayNearestPoint(screen->GetCursorScreenPoint()); 194 screen->GetDisplayNearestPoint(screen->GetCursorScreenPoint());
195 int left_bound = display.bounds().x(); 195 int left_bound = display.bounds().x();
196 #endif 196 #endif
197 if (menu_position.x() < left_bound) 197 if (menu_position.x() < left_bound)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (state() != STATE_DISABLED) 230 if (state() != STATE_DISABLED)
231 SetState(STATE_NORMAL); 231 SetState(STATE_NORMAL);
232 232
233 menu_runner_.reset(); 233 menu_runner_.reset();
234 menu_model_adapter_.reset(); 234 menu_model_adapter_.reset();
235 } 235 }
236 236
237 const char* ToolbarButton::GetClassName() const { 237 const char* ToolbarButton::GetClassName() const {
238 return "ToolbarButton"; 238 return "ToolbarButton";
239 } 239 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698