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

Unified Diff: content/shell/browser/shell_views.cc

Issue 1185173003: Add support for DisplayConfigurator for content_shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-ozone-platform-flags
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/browser/shell.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell_views.cc
diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc
index 4ce0fa6806ffb5a87c9390f0a4659a804a9e6db1..effdbb84bb83657cdacc57fc04faf9dee241a564 100644
--- a/content/shell/browser/shell_views.cc
+++ b/content/shell/browser/shell_views.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/sys_info.h"
#include "content/public/browser/context_factory.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
@@ -39,6 +40,8 @@
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
#include "ui/aura/test/test_screen.h"
+#include "ui/display/chromeos/display_configurator.h"
+#include "ui/display/types/display_snapshot.h"
#include "ui/wm/test/wm_test_helper.h"
#else // !defined(OS_CHROMEOS)
#include "ui/views/widget/desktop_aura/desktop_screen.h"
@@ -147,7 +150,8 @@ class ShellWindowDelegateView : public views::WidgetDelegateView,
// Resizing a widget on chromeos doesn't automatically resize the root, need
// to explicitly do that.
#if defined(OS_CHROMEOS)
- GetWidget()->GetNativeWindow()->GetHost()->SetBounds(bounds);
+ if (!base::SysInfo::IsRunningOnChromeOS())
+ GetWidget()->GetNativeWindow()->GetHost()->SetBounds(bounds);
#endif
}
@@ -400,6 +404,7 @@ class ShellWindowDelegateView : public views::WidgetDelegateView,
#if defined(OS_CHROMEOS)
wm::WMTestHelper* Shell::wm_test_helper_ = NULL;
+ui::DisplayConfigurator* Shell::display_configurator_ = nullptr;
gfx::Screen* Shell::test_screen_ = NULL;
#endif
views::ViewsDelegate* Shell::views_delegate_ = NULL;
@@ -412,9 +417,21 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
#endif
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Initialize();
+
+ gfx::Size display_size = default_window_size;
+ if (base::SysInfo::IsRunningOnChromeOS()) {
+ display_configurator_ = new ui::DisplayConfigurator();
+ display_configurator_->Init(false);
+ display_configurator_->ForceInitialConfigure(0);
+
+ const auto& displays = display_configurator_->cached_displays();
+ if (!displays.empty())
+ display_size = displays[0]->current_mode()->size();
+ }
+
test_screen_ = aura::TestScreen::Create(gfx::Size());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_);
- wm_test_helper_ = new wm::WMTestHelper(default_window_size,
+ wm_test_helper_ = new wm::WMTestHelper(display_size,
GetContextFactory());
#else
gfx::Screen::SetScreenInstance(
@@ -425,6 +442,11 @@ void Shell::PlatformInitialize(const gfx::Size& default_window_size) {
void Shell::PlatformExit() {
#if defined(OS_CHROMEOS)
+ if (display_configurator_) {
+ delete display_configurator_;
+ display_configurator_ = nullptr;
+ }
+
delete wm_test_helper_;
wm_test_helper_ = NULL;
« no previous file with comments | « content/shell/browser/shell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698