diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-31 06:53:34 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-31 06:53:34 +0000 |
commit | 0249a653b7e5076f331848a11034059000b644da (patch) | |
tree | 2ede280ec1f2073530b6755aa484479e65763b59 | |
parent | bb42c93f4b66e155724d00d284bdc19bf2ec75eb (diff) | |
download | chromium_src-0249a653b7e5076f331848a11034059000b644da.zip chromium_src-0249a653b7e5076f331848a11034059000b644da.tar.gz chromium_src-0249a653b7e5076f331848a11034059000b644da.tar.bz2 |
Process --ash-host-window-bounds first
BUG=none
Review URL: https://codereview.chromium.org/49713003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232024 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/display/display_manager.cc | 15 | ||||
-rw-r--r-- | ash/display/display_manager.h | 9 | ||||
-rw-r--r-- | ash/shell.cc | 15 |
3 files changed, 26 insertions, 13 deletions
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 7724c85..72d777b 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -202,9 +202,11 @@ float DisplayManager::GetNextUIScale(const DisplayInfo& info, bool up) { return 1.0f; } -void DisplayManager::InitFromCommandLine() { +bool DisplayManager::InitFromCommandLine() { DisplayInfoList info_list; CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) + return false; const string size_str = command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); vector<string> parts; @@ -213,13 +215,20 @@ void DisplayManager::InitFromCommandLine() { iter != parts.end(); ++iter) { info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); } - if (info_list.size()) - MaybeInitInternalDisplay(info_list[0].id()); + MaybeInitInternalDisplay(info_list[0].id()); if (info_list.size() > 1 && command_line->HasSwitch(switches::kAshEnableSoftwareMirroring)) { SetSecondDisplayMode(MIRRORING); } OnNativeDisplaysChanged(info_list); + return true; +} + +void DisplayManager::InitDefaultDisplay() { + DisplayInfoList info_list; + info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); + MaybeInitInternalDisplay(info_list[0].id()); + OnNativeDisplaysChanged(info_list); } // static diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index eaedfe8..d79654b 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -108,9 +108,12 @@ class ASH_EXPORT DisplayManager // Returns the display id of the first display in the outupt list. int64 first_display_id() const { return first_display_id_; } - // Initializes displays using command line flag, or uses - // defualt if no options are specified. - void InitFromCommandLine(); + // Initializes displays using command line flag. Returns false + // if no command line flag was provided. + bool InitFromCommandLine(); + + // Initialize default display. + void InitDefaultDisplay(); // True if the given |display| is currently connected. bool IsActiveDisplay(const gfx::Display& display) const; diff --git a/ash/shell.cc b/ash/shell.cc index e97959e..02a84db 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -691,16 +691,17 @@ void Shell::Init() { CommandLine* command_line = CommandLine::ForCurrentProcess(); delegate_->PreInit(); - bool display_initialized = false; -#if defined(OS_CHROMEOS) && defined(USE_X11) - output_configurator_animation_.reset( - new internal::OutputConfiguratorAnimation()); - output_configurator_->AddObserver(output_configurator_animation_.get()); if (command_line->HasSwitch(keyboard::switches::kKeyboardUsabilityTest)) { display_manager_->SetSecondDisplayMode( internal::DisplayManager::VIRTUAL_KEYBOARD); } - if (base::SysInfo::IsRunningOnChromeOS()) { + bool display_initialized = display_manager_->InitFromCommandLine(); +#if defined(OS_CHROMEOS) && defined(USE_X11) + output_configurator_animation_.reset( + new internal::OutputConfiguratorAnimation()); + output_configurator_->AddObserver(output_configurator_animation_.get()); + + if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { display_change_observer_.reset(new internal::DisplayChangeObserver); // Register |display_change_observer_| first so that the rest of // observer gets invoked after the root windows are configured. @@ -715,7 +716,7 @@ void Shell::Init() { } #endif // defined(OS_CHROMEOS) && defined(USE_X11) if (!display_initialized) - display_manager_->InitFromCommandLine(); + display_manager_->InitDefaultDisplay(); // Install the custom factory first so that views::FocusManagers for Tray, // Launcher, and WallPaper could be created by the factory. |