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

Unified Diff: ash/mus/window_manager.cc

Issue 2833093002: WIP: simplified display management in ash (Closed)
Patch Set: x Created 3 years, 8 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 | « ash/mus/window_manager.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager.cc
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index 4372ddf6dd5e413c437144bcaf66f482961fcb28..858cac11a74be877936ca252b76f36b1f8267b93 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -76,11 +76,14 @@ struct WindowManager::DragState {
// TODO: need to register OSExchangeDataProviderMus. http://crbug.com/665077.
WindowManager::WindowManager(service_manager::Connector* connector,
- Config config)
+ Config config,
+ bool show_primary_host_on_connect)
: connector_(connector),
config_(config),
+ show_primary_host_on_connect_(show_primary_host_on_connect),
wm_state_(base::MakeUnique<::wm::WMState>()),
property_converter_(base::MakeUnique<aura::PropertyConverter>()) {
+ LOG(WARNING) << "WindowManager!";
property_converter_->RegisterProperty(
kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property,
aura::PropertyConverter::CreateAcceptAnyValueCallback());
@@ -123,12 +126,16 @@ void WindowManager::Init(
DCHECK_EQ(nullptr, ash::Shell::window_tree_client());
ash::Shell::set_window_tree_client(window_tree_client_.get());
- // |connector_| will be null in some tests.
- if (connector_)
- connector_->BindInterface(ui::mojom::kServiceName, &display_controller_);
+ LOG(WARNING) << "config is mash? " << (config_ == Config::MASH);
- screen_ = base::MakeUnique<ScreenMus>(display_controller_.get());
- display::Screen::SetScreenInstance(screen_.get());
+ // TODO(sky): remove and use MUS code.
+ if (config_ == Config::MASH) {
+ // |connector_| will be null in some tests.
+ if (connector_)
+ connector_->BindInterface(ui::mojom::kServiceName, &display_controller_);
+ screen_ = base::MakeUnique<ScreenMus>(display_controller_.get());
+ display::Screen::SetScreenInstance(screen_.get());
+ }
pointer_watcher_event_router_ =
base::MakeUnique<views::PointerWatcherEventRouter>(
@@ -226,10 +233,10 @@ void WindowManager::CreateShell(
DCHECK(!created_shell_);
created_shell_ = true;
ShellInitParams init_params;
- ShellPortMash* shell_port =
- new ShellPortMash(WmWindow::Get(window_tree_host->window()), this,
- pointer_watcher_event_router_.get(),
- create_session_state_delegate_stub_for_test_);
+ ShellPortMash* shell_port = new ShellPortMash(
+ window_tree_host ? WmWindow::Get(window_tree_host->window()) : nullptr,
+ this, pointer_watcher_event_router_.get(),
+ create_session_state_delegate_stub_for_test_);
// Shell::CreateInstance() takes ownership of ShellDelegate.
init_params.delegate = shell_delegate_ ? shell_delegate_.release()
: new ShellDelegateMus(connector_);
@@ -336,7 +343,13 @@ void WindowManager::SetWindowManagerClient(aura::WindowManagerClient* client) {
ash::Shell::set_window_manager_client(client);
}
-void WindowManager::OnWmConnected() {}
+void WindowManager::OnWmConnected() {
+ if (config_ == Config::MUS) {
+ CreateShell(nullptr);
+ if (show_primary_host_on_connect_)
+ Shell::GetPrimaryRootWindow()->GetHost()->Show();
+ }
+}
void WindowManager::OnWmSetBounds(aura::Window* window,
const gfx::Rect& bounds) {
@@ -498,6 +511,7 @@ void WindowManager::OnWmDisplayRemoved(
void WindowManager::OnWmDisplayModified(const display::Display& display) {
// Ash relies on the Display being updated, then the WindowTreeHost's window,
// and finally DisplayObservers.
+ // XXX make sure this isn't called for manually_created.
display::DisplayList& display_list = screen_->display_list();
std::unique_ptr<display::DisplayListObserverLock> display_lock =
display_list.SuspendObserverUpdates();
« no previous file with comments | « ash/mus/window_manager.h ('k') | ash/mus/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698