| Index: components/mus/public/cpp/lib/window_tree_client.cc
|
| diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client.cc
|
| similarity index 81%
|
| rename from components/mus/public/cpp/lib/window_tree_client_impl.cc
|
| rename to components/mus/public/cpp/lib/window_tree_client.cc
|
| index 77a86e1604028cbc58cb1a7c0e9720add1373cd0..f646727ffd79167b40a2f216c508d45fcf665f2b 100644
|
| --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc
|
| +++ b/components/mus/public/cpp/lib/window_tree_client.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/mus/public/cpp/lib/window_tree_client_impl.h"
|
| +#include "components/mus/public/cpp/window_tree_client.h"
|
|
|
| #include <stddef.h>
|
|
|
| @@ -19,9 +19,8 @@
|
| #include "components/mus/public/cpp/window_manager_delegate.h"
|
| #include "components/mus/public/cpp/window_observer.h"
|
| #include "components/mus/public/cpp/window_tracker.h"
|
| -#include "components/mus/public/cpp/window_tree_connection.h"
|
| -#include "components/mus/public/cpp/window_tree_connection_observer.h"
|
| -#include "components/mus/public/cpp/window_tree_delegate.h"
|
| +#include "components/mus/public/cpp/window_tree_client_delegate.h"
|
| +#include "components/mus/public/cpp/window_tree_client_observer.h"
|
| #include "services/shell/public/cpp/connector.h"
|
| #include "ui/events/event.h"
|
| #include "ui/events/mojo/input_events_type_converters.h"
|
| @@ -40,14 +39,14 @@ Id server_id(Window* window) {
|
| }
|
|
|
| // Helper called to construct a local window object from transport data.
|
| -Window* AddWindowToClient(WindowTreeClientImpl* client,
|
| +Window* AddWindowToClient(WindowTreeClient* client,
|
| Window* parent,
|
| const mojom::WindowDataPtr& window_data) {
|
| - // We don't use the ctor that takes a WindowTreeConnection here, since it
|
| - // will call back to the service and attempt to create a new window.
|
| + // We don't use the ctor that takes a WindowTreeClient here, since it will
|
| + // call back to the service and attempt to create a new window.
|
| Window* window = WindowPrivate::LocalCreate();
|
| WindowPrivate private_window(window);
|
| - private_window.set_connection(client);
|
| + private_window.set_client(client);
|
| private_window.set_server_id(window_data->window_id);
|
| private_window.set_visible(window_data->visible);
|
| private_window.LocalSetDisplay(window_data->display_id);
|
| @@ -62,7 +61,7 @@ Window* AddWindowToClient(WindowTreeClientImpl* client,
|
| return window;
|
| }
|
|
|
| -Window* BuildWindowTree(WindowTreeClientImpl* client,
|
| +Window* BuildWindowTree(WindowTreeClient* client,
|
| const mojo::Array<mojom::WindowDataPtr>& windows,
|
| Window* initial_parent) {
|
| std::vector<Window*> parents;
|
| @@ -86,40 +85,8 @@ Window* BuildWindowTree(WindowTreeClientImpl* client,
|
| return root;
|
| }
|
|
|
| -WindowTreeConnection* WindowTreeConnection::Create(
|
| - WindowTreeDelegate* delegate,
|
| - shell::Connector* connector) {
|
| - WindowTreeClientImpl* client =
|
| - new WindowTreeClientImpl(delegate, nullptr, nullptr);
|
| - client->ConnectViaWindowTreeFactory(connector);
|
| - return client;
|
| -}
|
| -
|
| -WindowTreeConnection* WindowTreeConnection::Create(
|
| - WindowTreeDelegate* delegate,
|
| - mojo::InterfaceRequest<mojom::WindowTreeClient> request,
|
| - CreateType create_type) {
|
| - WindowTreeClientImpl* client =
|
| - new WindowTreeClientImpl(delegate, nullptr, std::move(request));
|
| - if (create_type == CreateType::WAIT_FOR_EMBED)
|
| - client->WaitForEmbed();
|
| - return client;
|
| -}
|
| -
|
| -WindowTreeConnection* WindowTreeConnection::CreateForWindowManager(
|
| - WindowTreeDelegate* delegate,
|
| - mojo::InterfaceRequest<mojom::WindowTreeClient> request,
|
| - CreateType create_type,
|
| - WindowManagerDelegate* window_manager_delegate) {
|
| - WindowTreeClientImpl* client = new WindowTreeClientImpl(
|
| - delegate, window_manager_delegate, std::move(request));
|
| - if (create_type == CreateType::WAIT_FOR_EMBED)
|
| - client->WaitForEmbed();
|
| - return client;
|
| -}
|
| -
|
| -WindowTreeClientImpl::WindowTreeClientImpl(
|
| - WindowTreeDelegate* delegate,
|
| +WindowTreeClient::WindowTreeClient(
|
| + WindowTreeClientDelegate* delegate,
|
| WindowManagerDelegate* window_manager_delegate,
|
| mojo::InterfaceRequest<mojom::WindowTreeClient> request)
|
| : client_id_(0),
|
| @@ -142,7 +109,7 @@ WindowTreeClientImpl::WindowTreeClientImpl(
|
| window_manager_delegate->SetWindowManagerClient(this);
|
| }
|
|
|
| -WindowTreeClientImpl::~WindowTreeClientImpl() {
|
| +WindowTreeClient::~WindowTreeClient() {
|
| in_destructor_ = true;
|
|
|
| std::vector<Window*> non_owned;
|
| @@ -164,13 +131,13 @@ WindowTreeClientImpl::~WindowTreeClientImpl() {
|
| while (!tracker.windows().empty())
|
| delete tracker.windows().front();
|
|
|
| - FOR_EACH_OBSERVER(WindowTreeConnectionObserver, observers_,
|
| - OnWillDestroyConnection(this));
|
| + FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
|
| + OnWillDestroyClient(this));
|
|
|
| - delegate_->OnConnectionLost(this);
|
| + delegate_->OnWindowTreeClientDestroyed(this);
|
| }
|
|
|
| -void WindowTreeClientImpl::ConnectViaWindowTreeFactory(
|
| +void WindowTreeClient::ConnectViaWindowTreeFactory(
|
| shell::Connector* connector) {
|
| // Clients created with no root shouldn't delete automatically.
|
| delete_on_no_roots_ = false;
|
| @@ -185,39 +152,39 @@ void WindowTreeClientImpl::ConnectViaWindowTreeFactory(
|
| tree_ = tree_ptr_.get();
|
|
|
| tree_ptr_->GetCursorLocationMemory(
|
| - base::Bind(&WindowTreeClientImpl::OnReceivedCursorLocationMemory,
|
| + base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory,
|
| weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void WindowTreeClientImpl::WaitForEmbed() {
|
| +void WindowTreeClient::WaitForEmbed() {
|
| DCHECK(roots_.empty());
|
| // OnEmbed() is the first function called.
|
| binding_.WaitForIncomingMethodCall();
|
| // TODO(sky): deal with pipe being closed before we get OnEmbed().
|
| }
|
|
|
| -void WindowTreeClientImpl::DestroyWindow(Window* window) {
|
| +void WindowTreeClient::DestroyWindow(Window* window) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
|
| new CrashInFlightChange(window, ChangeType::DELETE_WINDOW)));
|
| tree_->DeleteWindow(change_id, server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::AddChild(Window* parent, Id child_id) {
|
| +void WindowTreeClient::AddChild(Window* parent, Id child_id) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(
|
| base::WrapUnique(new CrashInFlightChange(parent, ChangeType::ADD_CHILD)));
|
| tree_->AddWindow(change_id, parent->server_id(), child_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::RemoveChild(Window* parent, Id child_id) {
|
| +void WindowTreeClient::RemoveChild(Window* parent, Id child_id) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
|
| new CrashInFlightChange(parent, ChangeType::REMOVE_CHILD)));
|
| tree_->RemoveWindowFromParent(change_id, child_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::AddTransientWindow(Window* window,
|
| +void WindowTreeClient::AddTransientWindow(Window* window,
|
| Id transient_window_id) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
|
| @@ -225,7 +192,7 @@ void WindowTreeClientImpl::AddTransientWindow(Window* window,
|
| tree_->AddTransientWindow(change_id, server_id(window), transient_window_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::RemoveTransientWindowFromParent(Window* window) {
|
| +void WindowTreeClient::RemoveTransientWindowFromParent(Window* window) {
|
| DCHECK(tree_);
|
| const uint32_t change_id =
|
| ScheduleInFlightChange(base::WrapUnique(new CrashInFlightChange(
|
| @@ -233,14 +200,14 @@ void WindowTreeClientImpl::RemoveTransientWindowFromParent(Window* window) {
|
| tree_->RemoveTransientWindowFromParent(change_id, server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetModal(Window* window) {
|
| +void WindowTreeClient::SetModal(Window* window) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(
|
| base::WrapUnique(new InFlightSetModalChange(window)));
|
| tree_->SetModal(change_id, server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::Reorder(Window* window,
|
| +void WindowTreeClient::Reorder(Window* window,
|
| Id relative_window_id,
|
| mojom::OrderDirection direction) {
|
| DCHECK(tree_);
|
| @@ -250,14 +217,14 @@ void WindowTreeClientImpl::Reorder(Window* window,
|
| direction);
|
| }
|
|
|
| -bool WindowTreeClientImpl::OwnsWindow(Window* window) const {
|
| +bool WindowTreeClient::OwnsWindow(Window* window) const {
|
| // Windows created via CreateTopLevelWindow() are not owned by us, but have
|
| // our client id.
|
| return HiWord(server_id(window)) == client_id_ &&
|
| roots_.count(window) == 0;
|
| }
|
|
|
| -void WindowTreeClientImpl::SetBounds(Window* window,
|
| +void WindowTreeClient::SetBounds(Window* window,
|
| const gfx::Rect& old_bounds,
|
| const gfx::Rect& bounds) {
|
| DCHECK(tree_);
|
| @@ -267,7 +234,7 @@ void WindowTreeClientImpl::SetBounds(Window* window,
|
| mojo::Rect::From(bounds));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetCapture(Window* window) {
|
| +void WindowTreeClient::SetCapture(Window* window) {
|
| // In order for us to get here we had to have exposed a window, which implies
|
| // we got a client.
|
| DCHECK(tree_);
|
| @@ -279,7 +246,7 @@ void WindowTreeClientImpl::SetCapture(Window* window) {
|
| LocalSetCapture(window);
|
| }
|
|
|
| -void WindowTreeClientImpl::ReleaseCapture(Window* window) {
|
| +void WindowTreeClient::ReleaseCapture(Window* window) {
|
| // In order for us to get here we had to have exposed a window, which implies
|
| // we got a client.
|
| DCHECK(tree_);
|
| @@ -291,7 +258,7 @@ void WindowTreeClientImpl::ReleaseCapture(Window* window) {
|
| LocalSetCapture(nullptr);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetClientArea(
|
| +void WindowTreeClient::SetClientArea(
|
| Id window_id,
|
| const gfx::Insets& client_area,
|
| const std::vector<gfx::Rect>& additional_client_areas) {
|
| @@ -301,17 +268,17 @@ void WindowTreeClientImpl::SetClientArea(
|
| mojo::Array<mojo::RectPtr>::From(additional_client_areas));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetHitTestMask(Id window_id, const gfx::Rect& mask) {
|
| +void WindowTreeClient::SetHitTestMask(Id window_id, const gfx::Rect& mask) {
|
| DCHECK(tree_);
|
| tree_->SetHitTestMask(window_id, mojo::Rect::From(mask));
|
| }
|
|
|
| -void WindowTreeClientImpl::ClearHitTestMask(Id window_id) {
|
| +void WindowTreeClient::ClearHitTestMask(Id window_id) {
|
| DCHECK(tree_);
|
| tree_->SetHitTestMask(window_id, nullptr);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetFocus(Window* window) {
|
| +void WindowTreeClient::SetFocus(Window* window) {
|
| // In order for us to get here we had to have exposed a window, which implies
|
| // we got a client.
|
| DCHECK(tree_);
|
| @@ -321,12 +288,12 @@ void WindowTreeClientImpl::SetFocus(Window* window) {
|
| LocalSetFocus(window);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) {
|
| +void WindowTreeClient::SetCanFocus(Id window_id, bool can_focus) {
|
| DCHECK(tree_);
|
| tree_->SetCanFocus(window_id, can_focus);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetPredefinedCursor(Id window_id,
|
| +void WindowTreeClient::SetPredefinedCursor(Id window_id,
|
| mus::mojom::Cursor cursor_id) {
|
| DCHECK(tree_);
|
|
|
| @@ -340,21 +307,21 @@ void WindowTreeClientImpl::SetPredefinedCursor(Id window_id,
|
| tree_->SetPredefinedCursor(change_id, window_id, cursor_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetVisible(Window* window, bool visible) {
|
| +void WindowTreeClient::SetVisible(Window* window, bool visible) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(
|
| base::WrapUnique(new InFlightVisibleChange(window, !visible)));
|
| tree_->SetWindowVisibility(change_id, server_id(window), visible);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetOpacity(Window* window, float opacity) {
|
| +void WindowTreeClient::SetOpacity(Window* window, float opacity) {
|
| DCHECK(tree_);
|
| const uint32_t change_id = ScheduleInFlightChange(
|
| base::WrapUnique(new InFlightOpacityChange(window, window->opacity())));
|
| tree_->SetWindowOpacity(change_id, server_id(window), opacity);
|
| }
|
|
|
| -void WindowTreeClientImpl::SetProperty(Window* window,
|
| +void WindowTreeClient::SetProperty(Window* window,
|
| const std::string& name,
|
| mojo::Array<uint8_t> data) {
|
| DCHECK(tree_);
|
| @@ -369,21 +336,21 @@ void WindowTreeClientImpl::SetProperty(Window* window,
|
| std::move(data));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetWindowTextInputState(
|
| +void WindowTreeClient::SetWindowTextInputState(
|
| Id window_id,
|
| mojo::TextInputStatePtr state) {
|
| DCHECK(tree_);
|
| tree_->SetWindowTextInputState(window_id, std::move(state));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetImeVisibility(Id window_id,
|
| +void WindowTreeClient::SetImeVisibility(Id window_id,
|
| bool visible,
|
| mojo::TextInputStatePtr state) {
|
| DCHECK(tree_);
|
| tree_->SetImeVisibility(window_id, visible, std::move(state));
|
| }
|
|
|
| -void WindowTreeClientImpl::Embed(
|
| +void WindowTreeClient::Embed(
|
| Id window_id,
|
| mojom::WindowTreeClientPtr client,
|
| const mojom::WindowTree::EmbedCallback& callback) {
|
| @@ -391,12 +358,12 @@ void WindowTreeClientImpl::Embed(
|
| tree_->Embed(window_id, std::move(client), callback);
|
| }
|
|
|
| -void WindowTreeClientImpl::RequestClose(Window* window) {
|
| +void WindowTreeClient::RequestClose(Window* window) {
|
| if (window_manager_internal_client_)
|
| window_manager_internal_client_->WmRequestClose(server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::AttachSurface(
|
| +void WindowTreeClient::AttachSurface(
|
| Id window_id,
|
| mojom::SurfaceType type,
|
| mojo::InterfaceRequest<mojom::Surface> surface,
|
| @@ -405,7 +372,7 @@ void WindowTreeClientImpl::AttachSurface(
|
| tree_->AttachSurface(window_id, type, std::move(surface), std::move(client));
|
| }
|
|
|
| -void WindowTreeClientImpl::LocalSetCapture(Window* window) {
|
| +void WindowTreeClient::LocalSetCapture(Window* window) {
|
| if (capture_window_ == window)
|
| return;
|
| Window* lost_capture = capture_window_;
|
| @@ -416,11 +383,11 @@ void WindowTreeClientImpl::LocalSetCapture(Window* window) {
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::LocalSetFocus(Window* focused) {
|
| +void WindowTreeClient::LocalSetFocus(Window* focused) {
|
| Window* blurred = focused_window_;
|
| // Update |focused_window_| before calling any of the observers, so that the
|
| // observers get the correct result from calling |Window::HasFocus()|,
|
| - // |WindowTreeConnection::GetFocusedWindow()| etc.
|
| + // |WindowTreeClient::GetFocusedWindow()| etc.
|
| focused_window_ = focused;
|
| if (blurred) {
|
| FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(),
|
| @@ -430,16 +397,16 @@ void WindowTreeClientImpl::LocalSetFocus(Window* focused) {
|
| FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(),
|
| OnWindowFocusChanged(focused, blurred));
|
| }
|
| - FOR_EACH_OBSERVER(WindowTreeConnectionObserver, observers_,
|
| + FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
|
| OnWindowTreeFocusChanged(focused, blurred));
|
| }
|
|
|
| -void WindowTreeClientImpl::AddWindow(Window* window) {
|
| +void WindowTreeClient::AddWindow(Window* window) {
|
| DCHECK(windows_.find(server_id(window)) == windows_.end());
|
| windows_[server_id(window)] = window;
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowDestroying(Window* window) {
|
| +void WindowTreeClient::OnWindowDestroying(Window* window) {
|
| // TODO(jonross): Also clear the focused window (crbug.com/611983)
|
| if (window == capture_window_) {
|
| InFlightCaptureChange reset_change(this, nullptr);
|
| @@ -451,7 +418,7 @@ void WindowTreeClientImpl::OnWindowDestroying(Window* window) {
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowDestroyed(Window* window) {
|
| +void WindowTreeClient::OnWindowDestroyed(Window* window) {
|
| windows_.erase(server_id(window));
|
|
|
| for (auto& entry : embedded_windows_) {
|
| @@ -477,12 +444,12 @@ void WindowTreeClientImpl::OnWindowDestroyed(Window* window) {
|
| }
|
| }
|
|
|
| -Window* WindowTreeClientImpl::GetWindowByServerId(Id id) {
|
| +Window* WindowTreeClient::GetWindowByServerId(Id id) {
|
| IdToWindowMap::const_iterator it = windows_.find(id);
|
| return it != windows_.end() ? it->second : NULL;
|
| }
|
|
|
| -InFlightChange* WindowTreeClientImpl::GetOldestInFlightChangeMatching(
|
| +InFlightChange* WindowTreeClient::GetOldestInFlightChangeMatching(
|
| const InFlightChange& change) {
|
| for (const auto& pair : in_flight_map_) {
|
| if (pair.second->window() == change.window() &&
|
| @@ -494,7 +461,7 @@ InFlightChange* WindowTreeClientImpl::GetOldestInFlightChangeMatching(
|
| return nullptr;
|
| }
|
|
|
| -uint32_t WindowTreeClientImpl::ScheduleInFlightChange(
|
| +uint32_t WindowTreeClient::ScheduleInFlightChange(
|
| std::unique_ptr<InFlightChange> change) {
|
| DCHECK(!change->window() ||
|
| windows_.count(change->window()->server_id()) > 0);
|
| @@ -503,7 +470,7 @@ uint32_t WindowTreeClientImpl::ScheduleInFlightChange(
|
| return change_id;
|
| }
|
|
|
| -bool WindowTreeClientImpl::ApplyServerChangeToExistingInFlightChange(
|
| +bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange(
|
| const InFlightChange& change) {
|
| InFlightChange* existing_change = GetOldestInFlightChangeMatching(change);
|
| if (!existing_change)
|
| @@ -513,7 +480,7 @@ bool WindowTreeClientImpl::ApplyServerChangeToExistingInFlightChange(
|
| return true;
|
| }
|
|
|
| -Window* WindowTreeClientImpl::NewWindowImpl(
|
| +Window* WindowTreeClient::NewWindowImpl(
|
| NewWindowType type,
|
| const Window::SharedProperties* properties) {
|
| DCHECK(tree_);
|
| @@ -543,12 +510,12 @@ Window* WindowTreeClientImpl::NewWindowImpl(
|
| return window;
|
| }
|
|
|
| -void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree,
|
| +void WindowTreeClient::OnEmbedImpl(mojom::WindowTree* window_tree,
|
| ClientSpecificId client_id,
|
| mojom::WindowDataPtr root_data,
|
| Id focused_window_id,
|
| bool drawn) {
|
| - // WARNING: this is only called if WindowTreeClientImpl was created as the
|
| + // WARNING: this is only called if WindowTreeClient was created as the
|
| // result of an embedding.
|
| tree_ = window_tree;
|
| client_id_ = client_id;
|
| @@ -564,12 +531,12 @@ void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree,
|
| delegate_->OnEmbed(root);
|
|
|
| if (focused_window_) {
|
| - FOR_EACH_OBSERVER(WindowTreeConnectionObserver, observers_,
|
| + FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
|
| OnWindowTreeFocusChanged(focused_window_, nullptr));
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnReceivedCursorLocationMemory(
|
| +void WindowTreeClient::OnReceivedCursorLocationMemory(
|
| mojo::ScopedSharedBufferHandle handle) {
|
| cursor_location_handle_ = std::move(handle);
|
| MojoResult result = mojo::MapBuffer(
|
| @@ -585,28 +552,28 @@ void WindowTreeClientImpl::OnReceivedCursorLocationMemory(
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// WindowTreeClientImpl, WindowTreeConnection implementation:
|
| +// WindowTreeClient, WindowTreeClient implementation:
|
|
|
| -void WindowTreeClientImpl::SetDeleteOnNoRoots(bool value) {
|
| +void WindowTreeClient::SetDeleteOnNoRoots(bool value) {
|
| delete_on_no_roots_ = value;
|
| }
|
|
|
| -const std::set<Window*>& WindowTreeClientImpl::GetRoots() {
|
| +const std::set<Window*>& WindowTreeClient::GetRoots() {
|
| return roots_;
|
| }
|
|
|
| -Window* WindowTreeClientImpl::GetFocusedWindow() {
|
| +Window* WindowTreeClient::GetFocusedWindow() {
|
| return focused_window_;
|
| }
|
|
|
| -void WindowTreeClientImpl::ClearFocus() {
|
| +void WindowTreeClient::ClearFocus() {
|
| if (!focused_window_)
|
| return;
|
|
|
| SetFocus(nullptr);
|
| }
|
|
|
| -gfx::Point WindowTreeClientImpl::GetCursorScreenPoint() {
|
| +gfx::Point WindowTreeClient::GetCursorScreenPoint() {
|
| // We raced initialization. Return (0, 0).
|
| if (!cursor_location_memory_)
|
| return gfx::Point();
|
| @@ -617,7 +584,7 @@ gfx::Point WindowTreeClientImpl::GetCursorScreenPoint() {
|
| static_cast<int16_t>(location & 0xFFFF));
|
| }
|
|
|
| -void WindowTreeClientImpl::SetEventObserver(mojom::EventMatcherPtr matcher) {
|
| +void WindowTreeClient::SetEventObserver(mojom::EventMatcherPtr matcher) {
|
| if (matcher.is_null()) {
|
| has_event_observer_ = false;
|
| tree_->SetEventObserver(nullptr, 0u);
|
| @@ -628,12 +595,12 @@ void WindowTreeClientImpl::SetEventObserver(mojom::EventMatcherPtr matcher) {
|
| }
|
| }
|
|
|
| -Window* WindowTreeClientImpl::NewWindow(
|
| +Window* WindowTreeClient::NewWindow(
|
| const Window::SharedProperties* properties) {
|
| return NewWindowImpl(NewWindowType::CHILD, properties);
|
| }
|
|
|
| -Window* WindowTreeClientImpl::NewTopLevelWindow(
|
| +Window* WindowTreeClient::NewTopLevelWindow(
|
| const Window::SharedProperties* properties) {
|
| Window* window = NewWindowImpl(NewWindowType::TOP_LEVEL, properties);
|
| // Assume newly created top level windows are drawn by default, otherwise
|
| @@ -644,18 +611,17 @@ Window* WindowTreeClientImpl::NewTopLevelWindow(
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// WindowTreeClientImpl, WindowTreeClient implementation:
|
| +// WindowTreeClient, WindowTreeClient implementation:
|
|
|
| -void WindowTreeClientImpl::AddObserver(WindowTreeConnectionObserver* observer) {
|
| +void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
|
|
| -void WindowTreeClientImpl::RemoveObserver(
|
| - WindowTreeConnectionObserver* observer) {
|
| +void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnEmbed(ClientSpecificId client_id,
|
| +void WindowTreeClient::OnEmbed(ClientSpecificId client_id,
|
| mojom::WindowDataPtr root_data,
|
| mojom::WindowTreePtr tree,
|
| Id focused_window_id,
|
| @@ -673,7 +639,7 @@ void WindowTreeClientImpl::OnEmbed(ClientSpecificId client_id,
|
| focused_window_id, drawn);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnEmbeddedAppDisconnected(Id window_id) {
|
| +void WindowTreeClient::OnEmbeddedAppDisconnected(Id window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (window) {
|
| FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
|
| @@ -681,7 +647,7 @@ void WindowTreeClientImpl::OnEmbeddedAppDisconnected(Id window_id) {
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnUnembed(Id window_id) {
|
| +void WindowTreeClient::OnUnembed(Id window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (!window)
|
| return;
|
| @@ -690,7 +656,7 @@ void WindowTreeClientImpl::OnUnembed(Id window_id) {
|
| WindowPrivate(window).LocalDestroy();
|
| }
|
|
|
| -void WindowTreeClientImpl::OnLostCapture(Id window_id) {
|
| +void WindowTreeClient::OnLostCapture(Id window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (!window)
|
| return;
|
| @@ -702,7 +668,7 @@ void WindowTreeClientImpl::OnLostCapture(Id window_id) {
|
| LocalSetCapture(nullptr);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id,
|
| +void WindowTreeClient::OnTopLevelCreated(uint32_t change_id,
|
| mojom::WindowDataPtr data,
|
| bool drawn) {
|
| // The server ack'd the top level window we created and supplied the state
|
| @@ -769,7 +735,7 @@ void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id,
|
| DCHECK_EQ(0u, data->parent_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowBoundsChanged(Id window_id,
|
| +void WindowTreeClient::OnWindowBoundsChanged(Id window_id,
|
| mojo::RectPtr old_bounds,
|
| mojo::RectPtr new_bounds) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -784,7 +750,7 @@ void WindowTreeClientImpl::OnWindowBoundsChanged(Id window_id,
|
| .LocalSetBounds(old_bounds.To<gfx::Rect>(), new_bounds.To<gfx::Rect>());
|
| }
|
|
|
| -void WindowTreeClientImpl::OnClientAreaChanged(
|
| +void WindowTreeClient::OnClientAreaChanged(
|
| uint32_t window_id,
|
| mojo::InsetsPtr new_client_area,
|
| mojo::Array<mojo::RectPtr> new_additional_client_areas) {
|
| @@ -796,7 +762,7 @@ void WindowTreeClientImpl::OnClientAreaChanged(
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnTransientWindowAdded(
|
| +void WindowTreeClient::OnTransientWindowAdded(
|
| uint32_t window_id,
|
| uint32_t transient_window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -807,7 +773,7 @@ void WindowTreeClientImpl::OnTransientWindowAdded(
|
| WindowPrivate(window).LocalAddTransientWindow(transient_window);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnTransientWindowRemoved(
|
| +void WindowTreeClient::OnTransientWindowRemoved(
|
| uint32_t window_id,
|
| uint32_t transient_window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -818,7 +784,7 @@ void WindowTreeClientImpl::OnTransientWindowRemoved(
|
| WindowPrivate(window).LocalRemoveTransientWindow(transient_window);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowHierarchyChanged(
|
| +void WindowTreeClient::OnWindowHierarchyChanged(
|
| Id window_id,
|
| Id old_parent_id,
|
| Id new_parent_id,
|
| @@ -844,7 +810,7 @@ void WindowTreeClientImpl::OnWindowHierarchyChanged(
|
| WindowPrivate(old_parent).LocalRemoveChild(window);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowReordered(Id window_id,
|
| +void WindowTreeClient::OnWindowReordered(Id window_id,
|
| Id relative_window_id,
|
| mojom::OrderDirection direction) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -853,17 +819,17 @@ void WindowTreeClientImpl::OnWindowReordered(Id window_id,
|
| WindowPrivate(window).LocalReorder(relative_window, direction);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowDeleted(Id window_id) {
|
| +void WindowTreeClient::OnWindowDeleted(Id window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (window)
|
| WindowPrivate(window).LocalDestroy();
|
| }
|
|
|
| -Window* WindowTreeClientImpl::GetCaptureWindow() {
|
| +Window* WindowTreeClient::GetCaptureWindow() {
|
| return capture_window_;
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowVisibilityChanged(Id window_id,
|
| +void WindowTreeClient::OnWindowVisibilityChanged(Id window_id,
|
| bool visible) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (!window)
|
| @@ -876,7 +842,7 @@ void WindowTreeClientImpl::OnWindowVisibilityChanged(Id window_id,
|
| WindowPrivate(window).LocalSetVisible(visible);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowOpacityChanged(Id window_id,
|
| +void WindowTreeClient::OnWindowOpacityChanged(Id window_id,
|
| float old_opacity,
|
| float new_opacity) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -890,14 +856,14 @@ void WindowTreeClientImpl::OnWindowOpacityChanged(Id window_id,
|
| WindowPrivate(window).LocalSetOpacity(new_opacity);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowParentDrawnStateChanged(Id window_id,
|
| +void WindowTreeClient::OnWindowParentDrawnStateChanged(Id window_id,
|
| bool drawn) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (window)
|
| WindowPrivate(window).LocalSetParentDrawn(drawn);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowSharedPropertyChanged(
|
| +void WindowTreeClient::OnWindowSharedPropertyChanged(
|
| Id window_id,
|
| const mojo::String& name,
|
| mojo::Array<uint8_t> new_data) {
|
| @@ -912,7 +878,7 @@ void WindowTreeClientImpl::OnWindowSharedPropertyChanged(
|
| WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data));
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id,
|
| +void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
|
| Id window_id,
|
| mojom::EventPtr event,
|
| uint32_t event_observer_id) {
|
| @@ -943,7 +909,7 @@ void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id,
|
| ack_callback->Run(mojom::EventResult::UNHANDLED);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnEventObserved(mojom::EventPtr event,
|
| +void WindowTreeClient::OnEventObserved(mojom::EventPtr event,
|
| uint32_t event_observer_id) {
|
| if (has_event_observer_ && event_observer_id == event_observer_id_) {
|
| std::unique_ptr<ui::Event> ui_event =
|
| @@ -952,7 +918,7 @@ void WindowTreeClientImpl::OnEventObserved(mojom::EventPtr event,
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
|
| +void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
|
| Window* focused_window = GetWindowByServerId(focused_window_id);
|
| InFlightFocusChange new_change(this, focused_window);
|
| if (ApplyServerChangeToExistingInFlightChange(new_change))
|
| @@ -961,7 +927,7 @@ void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
|
| LocalSetFocus(focused_window);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
|
| +void WindowTreeClient::OnWindowPredefinedCursorChanged(
|
| Id window_id,
|
| mojom::Cursor cursor) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -975,7 +941,7 @@ void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
|
| WindowPrivate(window).LocalSetPredefinedCursor(cursor);
|
| }
|
|
|
| -void WindowTreeClientImpl::OnChangeCompleted(uint32_t change_id, bool success) {
|
| +void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) {
|
| std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
|
| in_flight_map_.erase(change_id);
|
| if (!change)
|
| @@ -993,14 +959,14 @@ void WindowTreeClientImpl::OnChangeCompleted(uint32_t change_id, bool success) {
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::GetWindowManager(
|
| +void WindowTreeClient::GetWindowManager(
|
| mojo::AssociatedInterfaceRequest<WindowManager> internal) {
|
| window_manager_internal_.reset(
|
| new mojo::AssociatedBinding<mojom::WindowManager>(this,
|
| std::move(internal)));
|
| }
|
|
|
| -void WindowTreeClientImpl::RequestClose(uint32_t window_id) {
|
| +void WindowTreeClient::RequestClose(uint32_t window_id) {
|
| Window* window = GetWindowByServerId(window_id);
|
| if (!window || !IsRoot(window))
|
| return;
|
| @@ -1009,7 +975,7 @@ void WindowTreeClientImpl::RequestClose(uint32_t window_id) {
|
| OnRequestClose(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::WmSetBounds(uint32_t change_id,
|
| +void WindowTreeClient::WmSetBounds(uint32_t change_id,
|
| Id window_id,
|
| mojo::RectPtr transit_bounds) {
|
| Window* window = GetWindowByServerId(window_id);
|
| @@ -1029,7 +995,7 @@ void WindowTreeClientImpl::WmSetBounds(uint32_t change_id,
|
| window_manager_internal_client_->WmResponse(change_id, result);
|
| }
|
|
|
| -void WindowTreeClientImpl::WmSetProperty(uint32_t change_id,
|
| +void WindowTreeClient::WmSetProperty(uint32_t change_id,
|
| Id window_id,
|
| const mojo::String& name,
|
| mojo::Array<uint8_t> transit_data) {
|
| @@ -1053,7 +1019,7 @@ void WindowTreeClientImpl::WmSetProperty(uint32_t change_id,
|
| window_manager_internal_client_->WmResponse(change_id, result);
|
| }
|
|
|
| -void WindowTreeClientImpl::WmCreateTopLevelWindow(
|
| +void WindowTreeClient::WmCreateTopLevelWindow(
|
| uint32_t change_id,
|
| ClientSpecificId requesting_client_id,
|
| mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
|
| @@ -1068,7 +1034,7 @@ void WindowTreeClientImpl::WmCreateTopLevelWindow(
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::WmClientJankinessChanged(ClientSpecificId client_id,
|
| +void WindowTreeClient::WmClientJankinessChanged(ClientSpecificId client_id,
|
| bool janky) {
|
| if (window_manager_delegate_) {
|
| auto it = embedded_windows_.find(client_id);
|
| @@ -1078,12 +1044,12 @@ void WindowTreeClientImpl::WmClientJankinessChanged(ClientSpecificId client_id,
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::OnAccelerator(uint32_t id, mojom::EventPtr event) {
|
| +void WindowTreeClient::OnAccelerator(uint32_t id, mojom::EventPtr event) {
|
| window_manager_delegate_->OnAccelerator(
|
| id, *event.To<std::unique_ptr<ui::Event>>().get());
|
| }
|
|
|
| -void WindowTreeClientImpl::SetFrameDecorationValues(
|
| +void WindowTreeClient::SetFrameDecorationValues(
|
| mojom::FrameDecorationValuesPtr values) {
|
| if (window_manager_internal_client_) {
|
| window_manager_internal_client_->WmSetFrameDecorationValues(
|
| @@ -1091,13 +1057,13 @@ void WindowTreeClientImpl::SetFrameDecorationValues(
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::SetNonClientCursor(Window* window,
|
| +void WindowTreeClient::SetNonClientCursor(Window* window,
|
| mus::mojom::Cursor cursor_id) {
|
| window_manager_internal_client_->WmSetNonClientCursor(server_id(window),
|
| cursor_id);
|
| }
|
|
|
| -void WindowTreeClientImpl::AddAccelerator(
|
| +void WindowTreeClient::AddAccelerator(
|
| uint32_t id,
|
| mojom::EventMatcherPtr event_matcher,
|
| const base::Callback<void(bool)>& callback) {
|
| @@ -1107,28 +1073,28 @@ void WindowTreeClientImpl::AddAccelerator(
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::RemoveAccelerator(uint32_t id) {
|
| +void WindowTreeClient::RemoveAccelerator(uint32_t id) {
|
| if (window_manager_internal_client_) {
|
| window_manager_internal_client_->RemoveAccelerator(id);
|
| }
|
| }
|
|
|
| -void WindowTreeClientImpl::AddActivationParent(Window* window) {
|
| +void WindowTreeClient::AddActivationParent(Window* window) {
|
| if (window_manager_internal_client_)
|
| window_manager_internal_client_->AddActivationParent(server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::RemoveActivationParent(Window* window) {
|
| +void WindowTreeClient::RemoveActivationParent(Window* window) {
|
| if (window_manager_internal_client_)
|
| window_manager_internal_client_->RemoveActivationParent(server_id(window));
|
| }
|
|
|
| -void WindowTreeClientImpl::ActivateNextWindow() {
|
| +void WindowTreeClient::ActivateNextWindow() {
|
| if (window_manager_internal_client_)
|
| window_manager_internal_client_->ActivateNextWindow();
|
| }
|
|
|
| -void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
|
| +void WindowTreeClient::SetUnderlaySurfaceOffsetAndExtendedHitArea(
|
| Window* window,
|
| const gfx::Vector2d& offset,
|
| const gfx::Insets& hit_area) {
|
|
|