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

Unified Diff: mash/wm/window_manager_impl.cc

Issue 1639563003: Renames WindowManagerConfig to FrameDecorationValues and moves to Display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 11 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
Index: mash/wm/window_manager_impl.cc
diff --git a/mash/wm/window_manager_impl.cc b/mash/wm/window_manager_impl.cc
index dd649c5192d58eb512ae409f2f38d1c05aecb2db..ad225248af0599f232105f14c10e3a270bdfd8c2 100644
--- a/mash/wm/window_manager_impl.cc
+++ b/mash/wm/window_manager_impl.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "components/mus/common/types.h"
-#include "components/mus/public/cpp/property_type_converters.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"
@@ -22,22 +21,11 @@
#include "mojo/converters/geometry/geometry_type_converters.h"
#include "mojo/shell/public/cpp/application_impl.h"
-namespace mojo {
-
-template <>
-struct TypeConverter<const std::vector<uint8_t>, Array<uint8_t>> {
- static const std::vector<uint8_t> Convert(const Array<uint8_t>& input) {
- return input.storage();
- }
-};
-
-} // namespace mojo
-
namespace mash {
namespace wm {
WindowManagerImpl::WindowManagerImpl()
- : state_(nullptr) {}
+ : state_(nullptr), window_manager_client_(nullptr) {}
WindowManagerImpl::~WindowManagerImpl() {
if (!state_)
@@ -59,6 +47,22 @@ void WindowManagerImpl::Initialize(WindowManagerApplication* state) {
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));
}
gfx::Rect WindowManagerImpl::CalculateDefaultBounds(mus::Window* window) const {
@@ -137,34 +141,9 @@ void WindowManagerImpl::OpenWindow(
NewTopLevelWindow(&properties, std::move(client));
}
-void WindowManagerImpl::GetConfig(const GetConfigCallback& callback) {
- DCHECK(state_);
- mus::mojom::WindowManagerConfigPtr config(
- mus::mojom::WindowManagerConfig::New());
- config->displays = mojo::Array<mus::mojom::DisplayPtr>::New(1);
- config->displays[0] = mus::mojom::Display::New();
- config->displays[0]->id = 2001;
- config->displays[0]->bounds = mojo::Rect::New();
- config->displays[0]->bounds->y = 0;
- config->displays[0]->bounds->width = state_->root()->bounds().width();
- config->displays[0]->bounds->height = state_->root()->bounds().width();
- config->displays[0]->work_area = config->displays[0]->bounds.Clone();
- config->displays[0]->device_pixel_ratio =
- state_->root()->viewport_metrics().device_pixel_ratio;
-
- // 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.
- const gfx::Insets client_area_insets =
- NonClientFrameController::GetPreferredClientAreaInsets();
- config->normal_client_area_insets = mojo::Insets::From(client_area_insets);
-
- config->maximized_client_area_insets = mojo::Insets::From(client_area_insets);
-
- config->max_title_bar_button_width =
- NonClientFrameController::GetMaxTitleBarButtonWidth();
-
- callback.Run(std::move(config));
+void WindowManagerImpl::SetWindowManagerClient(
+ mus::WindowManagerClient* client) {
+ window_manager_client_ = client;
}
bool WindowManagerImpl::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {

Powered by Google App Engine
This is Rietveld 408576698