summaryrefslogtreecommitdiffstats
path: root/mash
diff options
context:
space:
mode:
authormoshayedi <moshayedi@chromium.org>2016-03-08 10:59:37 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-08 19:01:53 +0000
commite42d1d51b3b3722c7974917191bb868f5d740826 (patch)
tree3322ff3be7c281d11ad01ca1b0a85c3221899a20 /mash
parent93adaa5cc3714782f8f1c4281ba5cc445439d422 (diff)
downloadchromium_src-e42d1d51b3b3722c7974917191bb868f5d740826.zip
chromium_src-e42d1d51b3b3722c7974917191bb868f5d740826.tar.gz
chromium_src-e42d1d51b3b3722c7974917191bb868f5d740826.tar.bz2
Remove mash::wm::WindowManagerImpl.
This class doesn't compile anymore. It was removed in https://codereview.chromium.org/1657873002. BUG=NONE Review URL: https://codereview.chromium.org/1773143002 Cr-Commit-Position: refs/heads/master@{#379875}
Diffstat (limited to 'mash')
-rw-r--r--mash/wm/window_manager_impl.cc181
-rw-r--r--mash/wm/window_manager_impl.h77
2 files changed, 0 insertions, 258 deletions
diff --git a/mash/wm/window_manager_impl.cc b/mash/wm/window_manager_impl.cc
deleted file mode 100644
index 9d46e6b..0000000
--- a/mash/wm/window_manager_impl.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2015 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 "mash/wm/window_manager_impl.h"
-
-#include <stdint.h>
-#include <utility>
-
-#include "components/mus/common/types.h"
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_property.h"
-#include "components/mus/public/cpp/window_tree_connection.h"
-#include "components/mus/public/interfaces/input_events.mojom.h"
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "mash/wm/non_client_frame_controller.h"
-#include "mash/wm/property_util.h"
-#include "mash/wm/public/interfaces/container.mojom.h"
-#include "mash/wm/window_manager_application.h"
-#include "mojo/converters/geometry/geometry_type_converters.h"
-
-namespace mash {
-namespace wm {
-
-WindowManagerImpl::WindowManagerImpl()
- : state_(nullptr), window_manager_client_(nullptr), binding_(this) {}
-
-WindowManagerImpl::~WindowManagerImpl() {
- if (!state_)
- return;
- for (auto container : state_->root()->children()) {
- container->RemoveObserver(this);
- for (auto child : container->children())
- child->RemoveObserver(this);
- }
-}
-
-void WindowManagerImpl::Initialize(WindowManagerApplication* state,
- mash::shell::mojom::ShellPtr shell) {
- DCHECK(state);
- DCHECK(!state_);
- state_ = state;
- // The children of the root are considered containers.
- for (auto container : state_->root()->children()) {
- container->AddObserver(this);
- for (auto child : container->children())
- child->AddObserver(this);
- }
-
- // The insets are roughly what is needed by CustomFrameView. The expectation
- // is at some point we'll write our own NonClientFrameView and get the insets
- // from it.
- mus::mojom::FrameDecorationValuesPtr frame_decoration_values =
- mus::mojom::FrameDecorationValues::New();
- const gfx::Insets client_area_insets =
- NonClientFrameController::GetPreferredClientAreaInsets();
- frame_decoration_values->normal_client_area_insets =
- mojo::Insets::From(client_area_insets);
- frame_decoration_values->maximized_client_area_insets =
- mojo::Insets::From(client_area_insets);
- frame_decoration_values->max_title_bar_button_width =
- NonClientFrameController::GetMaxTitleBarButtonWidth();
- window_manager_client_->SetFrameDecorationValues(
- std::move(frame_decoration_values));
-
- shell->AddScreenlockStateListener(binding_.CreateInterfacePtrAndBind());
-}
-
-gfx::Rect WindowManagerImpl::CalculateDefaultBounds(mus::Window* window) const {
- DCHECK(state_);
- int width, height;
- const gfx::Size pref = GetWindowPreferredSize(window);
- const mus::Window* root = state_->root();
- if (pref.IsEmpty()) {
- width = root->bounds().width() - 240;
- height = root->bounds().height() - 240;
- } else {
- // TODO(sky): likely want to constrain more than root size.
- const gfx::Size max_size = GetMaximizedWindowBounds().size();
- width = std::max(0, std::min(max_size.width(), pref.width()));
- height = std::max(0, std::min(max_size.height(), pref.height()));
- }
- return gfx::Rect(40 + (state_->window_count() % 4) * 40,
- 40 + (state_->window_count() % 4) * 40, width, height);
-}
-
-gfx::Rect WindowManagerImpl::GetMaximizedWindowBounds() const {
- DCHECK(state_);
- return gfx::Rect(state_->root()->bounds().size());
-}
-
-mus::Window* WindowManagerImpl::NewTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties,
- mus::mojom::WindowTreeClientPtr client) {
- DCHECK(state_);
- mus::Window* root = state_->root();
- DCHECK(root);
-
- const bool provide_non_client_frame =
- GetWindowType(*properties) == mus::mojom::WindowType::WINDOW;
- if (provide_non_client_frame)
- (*properties)[mus::mojom::kWaitForUnderlay_Property].clear();
-
- // TODO(sky): constrain and validate properties before passing to server.
- mus::Window* window = root->connection()->NewWindow(properties);
- window->SetBounds(CalculateDefaultBounds(window));
-
- mojom::Container container = GetRequestedContainer(window);
- state_->GetWindowForContainer(container)->AddChild(window);
-
- if (client)
- window->Embed(std::move(client));
-
- if (provide_non_client_frame) {
- // NonClientFrameController deletes itself when |window| is destroyed.
- new NonClientFrameController(state_->app()->shell(), window,
- state_->window_tree_host());
- }
-
- state_->IncrementWindowCount();
-
- return window;
-}
-
-void WindowManagerImpl::OnTreeChanging(const TreeChangeParams& params) {
- DCHECK(state_);
- if (state_->WindowIsContainer(params.old_parent))
- params.target->RemoveObserver(this);
- else if (state_->WindowIsContainer(params.new_parent))
- params.target->AddObserver(this);
-}
-
-void WindowManagerImpl::OnWindowEmbeddedAppDisconnected(mus::Window* window) {
- window->Destroy();
-}
-
-void WindowManagerImpl::OpenWindow(
- mus::mojom::WindowTreeClientPtr client,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
- mus::Window::SharedProperties properties =
- transport_properties.To<mus::Window::SharedProperties>();
- NewTopLevelWindow(&properties, std::move(client));
-}
-
-void WindowManagerImpl::SetWindowManagerClient(
- mus::WindowManagerClient* client) {
- window_manager_client_ = client;
-}
-
-bool WindowManagerImpl::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {
- // By returning true the bounds of |window| is updated.
- return true;
-}
-
-bool WindowManagerImpl::OnWmSetProperty(
- mus::Window* window,
- const std::string& name,
- scoped_ptr<std::vector<uint8_t>>* new_data) {
- // TODO(sky): constrain this to set of keys we know about, and allowed
- // values.
- return name == mus::mojom::WindowManager::kShowState_Property ||
- name == mus::mojom::WindowManager::kPreferredSize_Property ||
- name == mus::mojom::WindowManager::kResizeBehavior_Property ||
- name == mus::mojom::WindowManager::kWindowTitle_Property;
-}
-
-mus::Window* WindowManagerImpl::OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) {
- return NewTopLevelWindow(properties, nullptr);
-}
-
-void WindowManagerImpl::ScreenlockStateChanged(bool locked) {
- // Hide USER_PRIVATE windows when the screen is locked.
- mus::Window* window =
- state_->GetWindowForContainer(mash::wm::mojom::Container::USER_PRIVATE);
- window->SetVisible(!locked);
-}
-
-} // namespace wm
-} // namespace mash
diff --git a/mash/wm/window_manager_impl.h b/mash/wm/window_manager_impl.h
deleted file mode 100644
index fd1c4c6..0000000
--- a/mash/wm/window_manager_impl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2015 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 MASH_WM_WINDOW_MANAGER_IMPL_H_
-#define MASH_WM_WINDOW_MANAGER_IMPL_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/cpp/window_manager_delegate.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "mash/shell/public/interfaces/shell.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mash {
-namespace wm {
-
-class WindowManagerApplication;
-
-using WindowManagerErrorCodeCallback =
- const mojo::Callback<void(mus::mojom::WindowManagerErrorCode)>;
-
-class WindowManagerImpl : public mus::mojom::WindowManagerDeprecated,
- public mus::WindowObserver,
- public mus::WindowManagerDelegate,
- public mash::shell::mojom::ScreenlockStateListener {
- public:
- WindowManagerImpl();
- ~WindowManagerImpl() override;
-
- void Initialize(WindowManagerApplication* state,
- mash::shell::mojom::ShellPtr shell);
-
- private:
- gfx::Rect CalculateDefaultBounds(mus::Window* window) const;
- gfx::Rect GetMaximizedWindowBounds() const;
-
- mus::Window* NewTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties,
- mus::mojom::WindowTreeClientPtr client);
-
- // mus::WindowObserver:
- void OnTreeChanging(const TreeChangeParams& params) override;
- void OnWindowEmbeddedAppDisconnected(mus::Window* window) override;
-
- // mus::mojom::WindowManager:
- void OpenWindow(mus::mojom::WindowTreeClientPtr client,
- mojo::Map<mojo::String, mojo::Array<uint8_t>>
- transport_properties) override;
-
- // WindowManagerDelegate:
- void SetWindowManagerClient(mus::WindowManagerClient* client) override;
- bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override;
- bool OnWmSetProperty(mus::Window* window,
- const std::string& name,
- scoped_ptr<std::vector<uint8_t>>* new_data) override;
- mus::Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) override;
-
- // mash::shell::mojom::ScreenlockStateListener:
- void ScreenlockStateChanged(bool locked) override;
-
- WindowManagerApplication* state_;
- mus::WindowManagerClient* window_manager_client_;
-
- mojo::Binding<mash::shell::mojom::ScreenlockStateListener> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl);
-};
-
-} // namespace wm
-} // namespace mash
-
-#endif // MASH_WM_WINDOW_MANAGER_IMPL_H_