summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 04:36:56 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-15 04:36:56 +0000
commit2ad669a5d97593c90cc9dbdbecec53890c9246e6 (patch)
treef952abcf9a37f8ea5640fd8ff5c47a2d166ee445
parent3a90b45428982c2f69b8e9256adb548fb92478c5 (diff)
downloadchromium_src-2ad669a5d97593c90cc9dbdbecec53890c9246e6.zip
chromium_src-2ad669a5d97593c90cc9dbdbecec53890c9246e6.tar.gz
chromium_src-2ad669a5d97593c90cc9dbdbecec53890c9246e6.tar.bz2
move --aura-host-window-size to --ash-host-window-bounds
remove --use-fullscreen-window as this is no longer necessary. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/12261018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182617 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash_switches.cc6
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/display/display_manager.cc52
-rw-r--r--ash/display/display_manager.h13
-rw-r--r--ash/test/ash_test_base.cc4
-rw-r--r--ash/test/display_manager_test_api.cc3
-rw-r--r--ash/wm/custom_frame_view_ash_unittest.cc1
-rw-r--r--chrome/browser/about_flags.cc4
-rw-r--r--chrome/browser/ui/ash/ash_init.cc9
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_unittest.cc2
-rw-r--r--content/shell/shell_aura.cc2
-rw-r--r--ui/aura/aura.gyp4
-rw-r--r--ui/aura/aura_switches.cc17
-rw-r--r--ui/aura/aura_switches.h24
-rw-r--r--ui/aura/bench/bench_main.cc9
-rw-r--r--ui/aura/demo/demo_main.cc6
-rw-r--r--ui/aura/display_util.cc52
-rw-r--r--ui/aura/display_util.h35
-rw-r--r--ui/aura/root_window.cc1
-rw-r--r--ui/aura/test/aura_test_helper.cc2
-rw-r--r--ui/aura/test/test_screen.cc31
-rw-r--r--ui/aura/test/test_screen.h6
-rw-r--r--ui/views/widget/native_widget_aura_unittest.cc1
24 files changed, 97 insertions, 194 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 2511688..13636d8 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -73,6 +73,12 @@ const char kAshEnableOak[] = "ash-enable-oak";
// Enables showing the tray bubble by dragging on the shelf.
const char kAshEnableTrayDragging[] = "ash-enable-tray-dragging";
+// Sets a window size, optional position, and optional scale factor.
+// "1024x768" creates a window of size 1024x768.
+// "100+200-1024x768" positions the window at 100,200.
+// "1024x768*2" sets the scale factor to 2 for a high DPI display.
+const char kAshHostWindowBounds[] = "ash-host-window-bounds";
+
// Enables immersive mode.
const char kAshImmersiveMode[] = "ash-immersive-mode";
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 5d92e6c..233bfbd 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -38,6 +38,7 @@ ASH_EXPORT extern const char kAshEnableNewNetworkStatusArea[];
ASH_EXPORT extern const char kAshEnableOak[];
ASH_EXPORT extern const char kAshEnableTrayDragging[];
ASH_EXPORT extern const char kAshEnableWorkspaceScrubbing[];
+ASH_EXPORT extern const char kAshHostWindowBounds[];
ASH_EXPORT extern const char kAshImmersiveMode[];
ASH_EXPORT extern const char kAshImmersiveHideTabIndicators[];
ASH_EXPORT extern const char kAshSecondaryDisplayLayout[];
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index f46fd53..8fa1223 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -7,27 +7,28 @@
#include <string>
#include <vector>
+#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
#include "ash/host/root_window_host_factory.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "base/command_line.h"
+#include "base/logging.h"
#include "base/stl_util.h"
+#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_strings.h"
-#include "ui/aura/aura_switches.h"
#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/display_util.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/root_window_host.h"
#include "ui/aura/window_property.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/display.h"
-#include "ui/gfx/screen.h"
#include "ui/gfx/rect.h"
+#include "ui/gfx/screen.h"
#include "ui/gfx/size_conversions.h"
#if defined(USE_X11)
@@ -51,6 +52,12 @@ namespace ash {
namespace internal {
namespace {
+// Default bounds for a display.
+const int kDefaultHostWindowX = 200;
+const int kDefaultHostWindowY = 200;
+const int kDefaultHostWindowWidth = 1280;
+const int kDefaultHostWindowHeight = 1024;
+
struct DisplaySortFunctor {
bool operator()(const gfx::Display& a, const gfx::Display& b) {
return a.id() < b.id();
@@ -423,7 +430,11 @@ std::string DisplayManager::GetDisplayNameFor(
void DisplayManager::OnRootWindowResized(const aura::RootWindow* root,
const gfx::Size& old_size) {
- if (!aura::UseFullscreenHostWindow()) {
+ bool user_may_change_root = false;
+#if defined(OS_CHROMEOS)
+ user_may_change_root = !base::chromeos::IsRunningOnChromeOS();
+#endif
+ if (user_may_change_root) {
gfx::Display& display = FindDisplayForRootWindow(root);
if (display.size() != root->GetHostSize()) {
display.SetSize(root->GetHostSize());
@@ -450,13 +461,9 @@ void DisplayManager::Init() {
RefreshDisplayInfo();
-#if defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8)
- aura::SetUseFullscreenHostWindow(true);
-#endif
// TODO(oshima): Move this logic to DisplayChangeObserver.
const string size_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kAuraHostWindowSize);
+ switches::kAshHostWindowBounds);
vector<string> parts;
base::SplitString(size_str, ',', &parts);
for (vector<string>::const_iterator iter = parts.begin();
@@ -477,7 +484,7 @@ void DisplayManager::CycleDisplayImpl() {
aura::RootWindow* primary = Shell::GetPrimaryRootWindow();
gfx::Rect host_bounds =
gfx::Rect(primary->GetHostOrigin(), primary->GetHostSize());
- new_displays.push_back(aura::CreateDisplayFromSpec(
+ new_displays.push_back(CreateDisplayFromSpec(
StringPrintf("%d+%d-500x400", host_bounds.x(), host_bounds.bottom())));
}
OnNativeDisplaysChanged(new_displays);
@@ -520,7 +527,7 @@ gfx::Display& DisplayManager::FindDisplayForId(int64 id) {
}
void DisplayManager::AddDisplayFromSpec(const std::string& spec) {
- gfx::Display display = aura::CreateDisplayFromSpec(spec);
+ gfx::Display display = CreateDisplayFromSpec(spec);
const gfx::Insets insets = display.GetWorkAreaInsets();
const gfx::Rect& native_bounds = display.bounds_in_pixel();
@@ -623,5 +630,28 @@ void DisplayManager::SetHasOverscanFlagForTest(int64 id, bool has_overscan) {
display_info_[id].has_overscan = has_overscan;
}
+gfx::Display CreateDisplayFromSpec(const std::string& spec) {
+ static int64 synthesized_display_id = 1000;
+
+#if defined(OS_WIN)
+ gfx::Rect bounds(aura::RootWindowHost::GetNativeScreenSize());
+#else
+ gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY,
+ kDefaultHostWindowWidth, kDefaultHostWindowHeight);
+#endif
+ int x = 0, y = 0, width, height;
+ float scale = 1.0f;
+ if (sscanf(spec.c_str(), "%dx%d*%f", &width, &height, &scale) >= 2 ||
+ sscanf(spec.c_str(), "%d+%d-%dx%d*%f", &x, &y, &width, &height,
+ &scale) >= 4) {
+ bounds.SetRect(x, y, width, height);
+ }
+
+ gfx::Display display(synthesized_display_id++);
+ display.SetScaleAndBounds(scale, bounds);
+ DVLOG(1) << "Display bounds=" << bounds.ToString() << ", scale=" << scale;
+ return display;
+}
+
} // namespace internal
} // namespace ash
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h
index 56834d5..bbc2280 100644
--- a/ash/display/display_manager.h
+++ b/ash/display/display_manager.h
@@ -163,8 +163,7 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root);
gfx::Display& FindDisplayForId(int64 id);
- // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for
- // the format of |spec|.
+ // Refer to |CreateDisplayFromSpec| API for the format of |spec|.
void AddDisplayFromSpec(const std::string& spec);
// Set the 1st display as an internal display and returns the display Id for
@@ -202,6 +201,16 @@ class ASH_EXPORT DisplayManager : public aura::RootWindowObserver {
DISALLOW_COPY_AND_ASSIGN(DisplayManager);
};
+// Creates a display from string spec. 100+200-1440x800 creates display
+// whose size is 1440x800 at the location (100, 200) in screen's coordinates.
+// The location can be omitted and be just "1440x800", which creates
+// display at the origin of the screen. An empty string creates
+// the display with default size.
+// The device scale factor can be specified by "*", like "1280x780*2",
+// or will use the value of |gfx::Display::GetForcedDeviceScaleFactor()| if
+// --force-device-scale-factor is specified.
+ASH_EXPORT gfx::Display CreateDisplayFromSpec(const std::string& str);
+
extern const aura::WindowProperty<int64>* const kDisplayIdKey;
} // namespace internal
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc
index 5e78ec7..4cfdac7 100644
--- a/ash/test/ash_test_base.cc
+++ b/ash/test/ash_test_base.cc
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
+#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
#include "ash/display/display_manager.h"
#include "ash/screen_ash.h"
@@ -17,7 +18,6 @@
#include "base/command_line.h"
#include "base/run_loop.h"
#include "content/public/test/web_contents_tester.h"
-#include "ui/aura/aura_switches.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
@@ -85,7 +85,7 @@ void AshTestBase::SetUp() {
// Use the origin (1,1) so that it doesn't over
// lap with the native mouse cursor.
CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kAuraHostWindowSize, "1+1-800x600");
+ switches::kAshHostWindowBounds, "1+1-800x600");
#if defined(OS_WIN)
aura::test::SetUsePopupAsRootWindowForTest(true);
#endif
diff --git a/ash/test/display_manager_test_api.cc b/ash/test/display_manager_test_api.cc
index 0f87b62..dbfb8495 100644
--- a/ash/test/display_manager_test_api.cc
+++ b/ash/test/display_manager_test_api.cc
@@ -9,7 +9,6 @@
#include "ash/display/display_manager.h"
#include "ash/shell.h"
#include "base/string_split.h"
-#include "ui/aura/display_util.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/display.h"
@@ -24,7 +23,7 @@ std::vector<gfx::Display> CreateDisplaysFromString(
base::SplitString(specs, ',', &parts);
for (std::vector<std::string>::const_iterator iter = parts.begin();
iter != parts.end(); ++iter) {
- displays.push_back(aura::CreateDisplayFromSpec(*iter));
+ displays.push_back(internal::CreateDisplayFromSpec(*iter));
}
return displays;
}
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc
index e404b9a..ada4134 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/custom_frame_view_ash_unittest.cc
@@ -12,7 +12,6 @@
#include "ash/wm/workspace/frame_maximize_button.h"
#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
-#include "ui/aura/aura_switches.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/test/event_generator.h"
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 5be1afb..f0ade21 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -40,10 +40,6 @@
#include "ash/ash_switches.h"
#endif
-#if defined(USE_AURA)
-#include "ui/aura/aura_switches.h"
-#endif
-
#if defined(OS_CHROMEOS)
#include "chromeos/chromeos_switches.h"
#endif
diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc
index d6484a9..fd955dd 100644
--- a/chrome/browser/ui/ash/ash_init.cc
+++ b/chrome/browser/ui/ash/ash_init.cc
@@ -21,8 +21,6 @@
#include "chrome/browser/ui/ash/event_rewriter.h"
#include "chrome/browser/ui/ash/screenshot_taker.h"
#include "chrome/common/chrome_switches.h"
-#include "ui/aura/aura_switches.h"
-#include "ui/aura/display_util.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/compositor/compositor_setup.h"
@@ -57,12 +55,8 @@ bool ShouldInitiallyHideCursor() {
#endif
void OpenAsh() {
- bool use_fullscreen = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAuraHostWindowUseFullscreen);
-
#if defined(OS_CHROMEOS)
if (base::chromeos::IsRunningOnChromeOS()) {
- use_fullscreen = true;
// Hides the cursor outside of the Aura root window. The cursor will be
// drawn within the Aura root window, and it'll remain hidden after the
// Aura window is closed.
@@ -74,9 +68,6 @@ void OpenAsh() {
ash::Shell::set_initially_hide_cursor(true);
#endif
- if (use_fullscreen)
- aura::SetUseFullscreenHostWindow(true);
-
// Its easier to mark all windows as persisting and exclude the ones we care
// about (browser windows), rather than explicitly excluding certain windows.
ash::SetDefaultPersistsAcrossAllWorkspaces(true);
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 6034563..a28641b 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -1017,7 +1017,7 @@ class DetachToBrowserInSeparateDisplayTabDragControllerTest
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII("aura-host-window-size",
+ command_line->AppendSwitchASCII("ash-host-window-bounds",
"0+0-250x250,251+0-250x250");
}
@@ -1151,7 +1151,7 @@ class DifferentDeviceScaleFactorDisplayTabDragControllerTest
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII("aura-host-window-size",
+ command_line->AppendSwitchASCII("ash-host-window-bounds",
"400x400,800x800*2");
}
@@ -1250,7 +1250,7 @@ class DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
TabDragControllerTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII("aura-host-window-size",
+ command_line->AppendSwitchASCII("ash-host-window-bounds",
"0+0-250x250,251+0-250x250");
}
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 2606365..b8a3ee5 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -500,7 +500,7 @@ class RenderWidgetHostTest : public testing::Test {
delegate_.reset(new MockRenderWidgetHostDelegate());
process_ = new RenderWidgetHostProcess(browser_context_.get());
#if defined(USE_AURA)
- screen_.reset(new aura::TestScreen);
+ screen_.reset(aura::TestScreen::Create());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_.get());
#endif
host_.reset(
diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc
index e580228..2297587 100644
--- a/content/shell/shell_aura.cc
+++ b/content/shell/shell_aura.cc
@@ -282,7 +282,7 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Initialize();
gfx::Screen::SetScreenInstance(
- gfx::SCREEN_TYPE_NATIVE, new aura::TestScreen);
+ gfx::SCREEN_TYPE_NATIVE, aura::TestScreen::Create());
minimal_ash_ = new content::MinimalAsh(default_window_size);
#else
gfx::Screen::SetScreenInstance(
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp
index 609690c..8f12d52 100644
--- a/ui/aura/aura.gyp
+++ b/ui/aura/aura.gyp
@@ -23,8 +23,6 @@
'AURA_IMPLEMENTATION',
],
'sources': [
- 'aura_switches.cc',
- 'aura_switches.h',
'client/activation_change_observer.h',
'client/activation_change_observer.cc',
'client/activation_client.cc',
@@ -68,8 +66,6 @@
'device_list_updater_aurax11.cc',
'device_list_updater_aurax11.h',
'dispatcher_win.cc',
- 'display_util.cc',
- 'display_util.h',
'env.cc',
'env.h',
'env_observer.h',
diff --git a/ui/aura/aura_switches.cc b/ui/aura/aura_switches.cc
deleted file mode 100644
index bb4aa47..0000000
--- a/ui/aura/aura_switches.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/aura/aura_switches.h"
-
-#include "base/command_line.h"
-
-namespace switches {
-
-// Initial dimensions for the host window in the form "1024x768".
-const char kAuraHostWindowSize[] = "aura-host-window-size";
-
-// Whether to use the full screen for aura's host window.
-const char kAuraHostWindowUseFullscreen[] = "aura-host-window-use-fullscreen";
-
-} // namespace switches
diff --git a/ui/aura/aura_switches.h b/ui/aura/aura_switches.h
deleted file mode 100644
index 12cd026..0000000
--- a/ui/aura/aura_switches.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_AURA_AURA_SWITCHES_H_
-#define UI_AURA_AURA_SWITCHES_H_
-
-#include "ui/aura/aura_export.h"
-
-namespace switches {
-
-// Please keep alphabetized.
-
-// Sets a window size, optional position, and optional scale factor.
-// "1024x768" creates a window of size 1024x768.
-// "100+200-1024x768" positions the window at 100,200.
-// "1024x768*2" sets the scale factor to 2 for a high DPI display.
-AURA_EXPORT extern const char kAuraHostWindowSize[];
-
-AURA_EXPORT extern const char kAuraHostWindowUseFullscreen[];
-
-} // namespace switches
-
-#endif // UI_AURA_AURA_SWITCHES_H_
diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc
index 7d0e134..a0c3d1c 100644
--- a/ui/aura/bench/bench_main.cc
+++ b/ui/aura/bench/bench_main.cc
@@ -13,7 +13,6 @@
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/skia/include/core/SkXfermode.h"
#include "ui/aura/client/default_capture_client.h"
-#include "ui/aura/display_util.h"
#include "ui/aura/env.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
@@ -299,11 +298,11 @@ int main(int argc, char** argv) {
MessageLoop message_loop(MessageLoop::TYPE_UI);
ui::CompositorTestSupport::Initialize();
aura::Env::GetInstance();
- aura::SetUseFullscreenHostWindow(true);
- aura::TestScreen test_screen;
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &test_screen);
+ scoped_ptr<aura::TestScreen> test_screen(
+ aura::TestScreen::CreateFullscreen());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get());
scoped_ptr<aura::RootWindow> root_window(
- test_screen.CreateRootWindowForPrimaryDisplay());
+ test_screen->CreateRootWindowForPrimaryDisplay());
aura::client::SetCaptureClient(
root_window.get(),
new aura::client::DefaultCaptureClient(root_window.get()));
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index ea32fd0..e78940b 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -112,10 +112,10 @@ int DemoMain() {
MessageLoop message_loop(MessageLoop::TYPE_UI);
ui::CompositorTestSupport::Initialize();
aura::Env::GetInstance();
- aura::TestScreen test_screen;
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &test_screen);
+ scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create());
+ gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get());
scoped_ptr<aura::RootWindow> root_window(
- test_screen.CreateRootWindowForPrimaryDisplay());
+ test_screen->CreateRootWindowForPrimaryDisplay());
scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient(
root_window.get()));
diff --git a/ui/aura/display_util.cc b/ui/aura/display_util.cc
deleted file mode 100644
index 07f6965..0000000
--- a/ui/aura/display_util.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/aura/display_util.h"
-
-#include "ui/aura/root_window_host.h"
-#include "ui/gfx/display.h"
-#include "base/logging.h"
-#include "base/string_number_conversions.h"
-
-namespace aura {
-namespace {
-
-bool use_fullscreen_host_window = false;
-
-// Default bounds for a display.
-const int kDefaultHostWindowX = 200;
-const int kDefaultHostWindowY = 200;
-const int kDefaultHostWindowWidth = 1280;
-const int kDefaultHostWindowHeight = 1024;
-
-} // namespace
-
-void SetUseFullscreenHostWindow(bool value) {
- use_fullscreen_host_window = value;
-}
-
-bool UseFullscreenHostWindow() {
- return use_fullscreen_host_window;
-}
-
-gfx::Display CreateDisplayFromSpec(const std::string& spec) {
- static int64 synthesized_display_id = 1000;
- gfx::Rect bounds(kDefaultHostWindowX, kDefaultHostWindowY,
- kDefaultHostWindowWidth, kDefaultHostWindowHeight);
- int x = 0, y = 0, width, height;
- float scale = 1.0f;
- if (sscanf(spec.c_str(), "%dx%d*%f", &width, &height, &scale) >= 2 ||
- sscanf(spec.c_str(), "%d+%d-%dx%d*%f", &x, &y, &width, &height,
- &scale) >= 4) {
- bounds.SetRect(x, y, width, height);
- } else if (use_fullscreen_host_window) {
- bounds = gfx::Rect(aura::RootWindowHost::GetNativeScreenSize());
- }
- gfx::Display display(synthesized_display_id++);
- display.SetScaleAndBounds(scale, bounds);
- DVLOG(1) << "Display bounds=" << bounds.ToString() << ", scale=" << scale;
- return display;
-}
-
-} // namespace aura
diff --git a/ui/aura/display_util.h b/ui/aura/display_util.h
deleted file mode 100644
index 4505e98..0000000
--- a/ui/aura/display_util.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_AURA_DISPLAY_UTIL_H_
-#define UI_AURA_DISPLAY_UTIL_H_
-
-#include <string>
-
-#include "ui/aura/aura_export.h"
-
-namespace gfx {
-class Display;
-}
-
-namespace aura {
-
-// TODO(oshima): OBSOLETE. Eliminate this flag.
-AURA_EXPORT void SetUseFullscreenHostWindow(bool use_fullscreen_window);
-AURA_EXPORT bool UseFullscreenHostWindow();
-
-// Creates a display from string spec. 100+200-1440x800 creates display
-// whose size is 1440x800 at the location (100, 200) in screen's coordinates.
-// The location can be omitted and be just "1440x800", which creates
-// display at the origin of the screen. An empty string creates
-// the display with default size.
-// The device scale factor can be specified by "*", like "1280x780*2",
-// or will use the value of |gfx::Display::GetForcedDeviceScaleFactor()| if
-// --force-device-scale-factor is specified.
-// static gfx::Display CreateDisplayFromSpec(const std::string& spec);
-AURA_EXPORT gfx::Display CreateDisplayFromSpec(const std::string& str);
-
-} // namespace aura
-
-#endif // UI_AURA_DISPLAY_UTIL_H_
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 710eca6..7ea9013 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -12,7 +12,6 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "ui/aura/aura_switches.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/client/cursor_client.h"
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
index 617cd5c..a4400bf 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -42,7 +42,7 @@ AuraTestHelper::~AuraTestHelper() {
void AuraTestHelper::SetUp() {
setup_called_ = true;
Env::GetInstance();
- test_screen_.reset(new TestScreen());
+ test_screen_.reset(TestScreen::Create());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay());
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc
index b80b73f..a4bd03b 100644
--- a/ui/aura/test/test_screen.cc
+++ b/ui/aura/test/test_screen.cc
@@ -4,23 +4,24 @@
#include "ui/aura/test/test_screen.h"
-#include "base/command_line.h"
#include "base/logging.h"
-#include "ui/aura/aura_switches.h"
-#include "ui/aura/display_util.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/root_window_host.h"
#include "ui/aura/window.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/screen.h"
namespace aura {
-TestScreen::TestScreen() : root_window_(NULL) {
- const std::string size_str =
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kAuraHostWindowSize);
- display_ = aura::CreateDisplayFromSpec(size_str);
+// static
+TestScreen* TestScreen::Create() {
+ return new TestScreen(gfx::Rect(1, 1, 800, 600));
+}
+
+// static
+TestScreen* TestScreen::CreateFullscreen() {
+ return new TestScreen(gfx::Rect(RootWindowHost::GetNativeScreenSize()));
}
TestScreen::~TestScreen() {
@@ -31,8 +32,6 @@ RootWindow* TestScreen::CreateRootWindowForPrimaryDisplay() {
root_window_ = new RootWindow(RootWindow::CreateParams(display_.bounds()));
root_window_->AddObserver(this);
root_window_->Init();
- if (UseFullscreenHostWindow())
- root_window_->ConfineCursorToWindow();
return root_window_;
}
@@ -42,10 +41,8 @@ bool TestScreen::IsDIPEnabled() {
void TestScreen::OnWindowBoundsChanged(
Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) {
- if (!UseFullscreenHostWindow()) {
- DCHECK_EQ(root_window_, window);
- display_.SetSize(new_bounds.size());
- }
+ DCHECK_EQ(root_window_, window);
+ display_.SetSize(new_bounds.size());
}
void TestScreen::OnWindowDestroying(Window* window) {
@@ -89,4 +86,10 @@ void TestScreen::AddObserver(gfx::DisplayObserver* observer) {
void TestScreen::RemoveObserver(gfx::DisplayObserver* observer) {
}
+TestScreen::TestScreen(const gfx::Rect& screen_bounds) : root_window_(NULL) {
+ static int64 synthesized_display_id = 2000;
+ display_.set_id(synthesized_display_id++);
+ display_.SetScaleAndBounds(1.0f, screen_bounds);
+}
+
} // namespace aura
diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h
index 8b9d74b..16f0376 100644
--- a/ui/aura/test/test_screen.h
+++ b/ui/aura/test/test_screen.h
@@ -22,7 +22,9 @@ class Window;
class TestScreen : public gfx::Screen,
public WindowObserver {
public:
- TestScreen();
+ static TestScreen* Create();
+ // Creates a TestScreen that uses fullscreen for the display.
+ static TestScreen* CreateFullscreen();
virtual ~TestScreen();
RootWindow* CreateRootWindowForPrimaryDisplay();
@@ -50,6 +52,8 @@ class TestScreen : public gfx::Screen,
virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE;
private:
+ explicit TestScreen(const gfx::Rect& screen_bounds);
+
aura::RootWindow* root_window_;
gfx::Display display_;
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index ffa4cba..b53be50 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/aura/aura_switches.h"
#include "ui/aura/env.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/root_window.h"