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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix other os's Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/ash/ash_init.h" 11 #include "chrome/browser/ui/ash/ash_init.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/browser/ui/browser_window_state.h" 15 #include "chrome/browser/ui/browser_window_state.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "ui/gfx/screen.h" 17 #include "ui/gfx/screen.h"
18 18
19 // Minimum height of the visible part of a window. 19 // Minimum height of the visible part of a window.
20 const int kMinVisibleHeight = 30; 20 const int kMinVisibleHeight = 30;
21 // Minimum width of the visible part of a window. 21 // Minimum width of the visible part of a window.
22 const int kMinVisibleWidth = 30; 22 const int kMinVisibleWidth = 30;
23 23
24 class DefaultMonitorInfoProvider : public MonitorInfoProvider { 24 class DefaultMonitorInfoProvider : public MonitorInfoProvider {
25 public: 25 public:
26 // Overridden from MonitorInfoProvider: 26 // Overridden from MonitorInfoProvider:
27 virtual gfx::Rect GetPrimaryDisplayWorkArea() const OVERRIDE { 27 virtual gfx::Rect GetPrimaryDisplayWorkArea() const OVERRIDE {
28 return gfx::Screen::GetPrimaryDisplay().work_area(); 28 return gfx::Screen::GetPrimaryDisplay(
29 gfx::Screen::BadTwoWorldsContext()).work_area();
29 } 30 }
30 virtual gfx::Rect GetPrimaryDisplayBounds() const OVERRIDE { 31 virtual gfx::Rect GetPrimaryDisplayBounds() const OVERRIDE {
31 return gfx::Screen::GetPrimaryDisplay().bounds(); 32 return gfx::Screen::GetPrimaryDisplay(
33 gfx::Screen::BadTwoWorldsContext()).bounds();
32 } 34 }
33 virtual gfx::Rect GetMonitorWorkAreaMatching( 35 virtual gfx::Rect GetMonitorWorkAreaMatching(
34 const gfx::Rect& match_rect) const OVERRIDE { 36 const gfx::Rect& match_rect) const OVERRIDE {
35 return gfx::Screen::GetDisplayMatching(match_rect).work_area(); 37 return gfx::Screen::GetDisplayMatching(
38 gfx::Screen::BadTwoWorldsContext(), match_rect).work_area();
36 } 39 }
37 }; 40 };
38 41
39 /////////////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////////////
40 // An implementation of WindowSizer::StateProvider that gets the last active 43 // An implementation of WindowSizer::StateProvider that gets the last active
41 // and persistent state from the browser window and the user's profile. 44 // and persistent state from the browser window and the user's profile.
42 class DefaultStateProvider : public WindowSizer::StateProvider { 45 class DefaultStateProvider : public WindowSizer::StateProvider {
43 public: 46 public:
44 DefaultStateProvider(const std::string& app_name, const Browser* browser) 47 DefaultStateProvider(const std::string& app_name, const Browser* browser)
45 : app_name_(app_name), browser_(browser) { 48 : app_name_(app_name), browser_(browser) {
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 bool WindowSizer::GetBoundsOverride( 336 bool WindowSizer::GetBoundsOverride(
334 const gfx::Rect& specified_bounds, 337 const gfx::Rect& specified_bounds,
335 gfx::Rect* bounds) const { 338 gfx::Rect* bounds) const {
336 #if defined(USE_ASH) 339 #if defined(USE_ASH)
337 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312 340 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312
338 if (chrome::ShouldOpenAshOnStartup()) 341 if (chrome::ShouldOpenAshOnStartup())
339 return GetBoundsOverrideAsh(specified_bounds, bounds); 342 return GetBoundsOverrideAsh(specified_bounds, bounds);
340 #endif 343 #endif
341 return false; 344 return false;
342 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698