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

Side by Side Diff: ash/mus/non_client_frame_controller.cc

Issue 2904273002: [mus+ash] Removes WmWindow from RootWindowcontroller implementation (Closed)
Patch Set: [mus+ash] Removes WmWindow from RootWindowcontroller implementation (rebased) Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/root_window_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/mus/non_client_frame_controller.h" 5 #include "ash/mus/non_client_frame_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/ash_constants.h" 13 #include "ash/ash_constants.h"
14 #include "ash/ash_layout_constants.h" 14 #include "ash/ash_layout_constants.h"
15 #include "ash/frame/custom_frame_view_ash.h" 15 #include "ash/frame/custom_frame_view_ash.h"
16 #include "ash/mus/frame/detached_title_area_renderer.h" 16 #include "ash/mus/frame/detached_title_area_renderer.h"
17 #include "ash/mus/move_event_handler.h" 17 #include "ash/mus/move_event_handler.h"
18 #include "ash/mus/property_util.h" 18 #include "ash/mus/property_util.h"
19 #include "ash/mus/window_manager.h" 19 #include "ash/mus/window_manager.h"
20 #include "ash/mus/window_properties.h" 20 #include "ash/mus/window_properties.h"
21 #include "ash/shared/immersive_fullscreen_controller_delegate.h" 21 #include "ash/shared/immersive_fullscreen_controller_delegate.h"
22 #include "ash/wm/panels/panel_frame_view.h" 22 #include "ash/wm/panels/panel_frame_view.h"
23 #include "ash/wm/window_properties.h" 23 #include "ash/wm/window_properties.h"
24 #include "ash/wm/window_util.h" 24 #include "ash/wm/window_util.h"
25 #include "ash/wm_window.h"
26 #include "base/macros.h" 25 #include "base/macros.h"
27 #include "base/memory/ptr_util.h" 26 #include "base/memory/ptr_util.h"
28 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
29 #include "services/ui/public/interfaces/window_manager.mojom.h" 28 #include "services/ui/public/interfaces/window_manager.mojom.h"
30 #include "ui/aura/client/aura_constants.h" 29 #include "ui/aura/client/aura_constants.h"
31 #include "ui/aura/client/transient_window_client.h" 30 #include "ui/aura/client/transient_window_client.h"
32 #include "ui/aura/mus/property_converter.h" 31 #include "ui/aura/mus/property_converter.h"
33 #include "ui/aura/mus/property_utils.h" 32 #include "ui/aura/mus/property_utils.h"
34 #include "ui/aura/mus/window_manager_delegate.h" 33 #include "ui/aura/mus/window_manager_delegate.h"
35 #include "ui/aura/mus/window_port_mus.h" 34 #include "ui/aura/mus/window_port_mus.h"
36 #include "ui/aura/window.h" 35 #include "ui/aura/window.h"
37 #include "ui/base/class_property.h" 36 #include "ui/base/class_property.h"
38 #include "ui/base/hit_test.h" 37 #include "ui/base/hit_test.h"
39 #include "ui/compositor/layer.h" 38 #include "ui/compositor/layer.h"
40 #include "ui/gfx/geometry/vector2d.h" 39 #include "ui/gfx/geometry/vector2d.h"
41 #include "ui/views/widget/native_widget_aura.h" 40 #include "ui/views/widget/native_widget_aura.h"
42 #include "ui/views/widget/widget.h" 41 #include "ui/views/widget/widget.h"
42 #include "ui/wm/core/coordinate_conversion.h"
43 43
44 DECLARE_UI_CLASS_PROPERTY_TYPE(ash::mus::NonClientFrameController*); 44 DECLARE_UI_CLASS_PROPERTY_TYPE(ash::mus::NonClientFrameController*);
45 45
46 namespace ash { 46 namespace ash {
47 namespace mus { 47 namespace mus {
48 namespace { 48 namespace {
49 49
50 DEFINE_UI_CLASS_PROPERTY_KEY(NonClientFrameController*, 50 DEFINE_UI_CLASS_PROPERTY_KEY(NonClientFrameController*,
51 kNonClientFrameControllerKey, 51 kNonClientFrameControllerKey,
52 nullptr); 52 nullptr);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Clip the bounds of the title area to that of the |frame_window_|. 113 // Clip the bounds of the title area to that of the |frame_window_|.
114 gfx::Rect visible_bounds = title_area_window->bounds(); 114 gfx::Rect visible_bounds = title_area_window->bounds();
115 visible_bounds.Intersect(frame_window_->bounds()); 115 visible_bounds.Intersect(frame_window_->bounds());
116 // The intersection is in the coordinates of |title_area_window|'s parent, 116 // The intersection is in the coordinates of |title_area_window|'s parent,
117 // convert to be in |title_area_window| and then to screen. 117 // convert to be in |title_area_window| and then to screen.
118 visible_bounds -= title_area_window->bounds().origin().OffsetFromOrigin(); 118 visible_bounds -= title_area_window->bounds().origin().OffsetFromOrigin();
119 // TODO: this needs updating when parent of |title_area_window| is changed, 119 // TODO: this needs updating when parent of |title_area_window| is changed,
120 // DCHECK is to ensure when parent changes this code is updated. 120 // DCHECK is to ensure when parent changes this code is updated.
121 // http://crbug.com/640392. 121 // http://crbug.com/640392.
122 DCHECK_EQ(frame_window_->parent(), title_area_window->parent()); 122 DCHECK_EQ(frame_window_->parent(), title_area_window->parent());
123 result.push_back( 123 ::wm::ConvertRectToScreen(title_area_window, &visible_bounds);
124 WmWindow::Get(title_area_window)->ConvertRectToScreen(visible_bounds)); 124 result.push_back(visible_bounds);
125 return result; 125 return result;
126 } 126 }
127 127
128 private: 128 private:
129 void CreateTitleAreaWindow() { 129 void CreateTitleAreaWindow() {
130 if (GetTitleAreaWindow()) 130 if (GetTitleAreaWindow())
131 return; 131 return;
132 132
133 // TODO(sky): bounds aren't right here. Need to convert to display. 133 // TODO(sky): bounds aren't right here. Need to convert to display.
134 gfx::Rect bounds = frame_window_->bounds(); 134 gfx::Rect bounds = frame_window_->bounds();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 frame_controller_->window()); 256 frame_controller_->window());
257 return false; 257 return false;
258 } 258 }
259 259
260 private: 260 private:
261 NonClientFrameController* frame_controller_; 261 NonClientFrameController* frame_controller_;
262 262
263 DISALLOW_COPY_AND_ASSIGN(ClientViewMus); 263 DISALLOW_COPY_AND_ASSIGN(ClientViewMus);
264 }; 264 };
265 265
266 // Returns the frame insets to use when ShouldUseExtendedHitRegion() returns 266 // Returns the frame insets to use when ShouldUseExtendedHitRegionForWindow()
267 // true. 267 // returns true.
268 gfx::Insets GetExtendedHitRegion() { 268 gfx::Insets GetExtendedHitRegion() {
269 return gfx::Insets(kResizeOutsideBoundsSize, kResizeOutsideBoundsSize, 269 return gfx::Insets(kResizeOutsideBoundsSize, kResizeOutsideBoundsSize,
270 kResizeOutsideBoundsSize, kResizeOutsideBoundsSize); 270 kResizeOutsideBoundsSize, kResizeOutsideBoundsSize);
271 } 271 }
272 272
273 } // namespace 273 } // namespace
274 274
275 NonClientFrameController::NonClientFrameController( 275 NonClientFrameController::NonClientFrameController(
276 aura::Window* parent, 276 aura::Window* parent,
277 aura::Window* context, 277 aura::Window* context,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 326
327 // Only the caption draws any content. So the caption has its own layer (see 327 // Only the caption draws any content. So the caption has its own layer (see
328 // above in WmNativeWidgetAura::CreateNonClientFrameView()). The rest of the 328 // above in WmNativeWidgetAura::CreateNonClientFrameView()). The rest of the
329 // region needs to take part in occlusion in the compositor, but not generate 329 // region needs to take part in occlusion in the compositor, but not generate
330 // any content to draw. So the layer is marked as opaque and to draw 330 // any content to draw. So the layer is marked as opaque and to draw
331 // solid-color (but the color is transparent, so nothing is actually drawn). 331 // solid-color (but the color is transparent, so nothing is actually drawn).
332 ui::Layer* layer = widget_->GetNativeWindow()->layer(); 332 ui::Layer* layer = widget_->GetNativeWindow()->layer();
333 layer->SetColor(SK_ColorTRANSPARENT); 333 layer->SetColor(SK_ColorTRANSPARENT);
334 layer->SetFillsBoundsOpaquely(true); 334 layer->SetFillsBoundsOpaquely(true);
335 335
336 WmWindow* wm_window = WmWindow::Get(window_);
337 const gfx::Insets extended_hit_region = 336 const gfx::Insets extended_hit_region =
338 wm_window->ShouldUseExtendedHitRegion() ? GetExtendedHitRegion() 337 wm::ShouldUseExtendedHitRegionForWindow(window_) ? GetExtendedHitRegion()
339 : gfx::Insets(); 338 : gfx::Insets();
340 window_manager_client_->SetExtendedHitArea(window_, extended_hit_region); 339 window_manager_client_->SetExtendedHitArea(window_, extended_hit_region);
341 340
342 aura::client::GetTransientWindowClient()->AddObserver(this); 341 aura::client::GetTransientWindowClient()->AddObserver(this);
343 } 342 }
344 343
345 // static 344 // static
346 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) { 345 NonClientFrameController* NonClientFrameController::Get(aura::Window* window) {
347 return window->GetProperty(kNonClientFrameControllerKey); 346 return window->GetProperty(kNonClientFrameControllerKey);
348 } 347 }
349 348
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 void NonClientFrameController::OnWillRestackTransientChildAbove( 467 void NonClientFrameController::OnWillRestackTransientChildAbove(
469 aura::Window* parent, 468 aura::Window* parent,
470 aura::Window* transient_child) {} 469 aura::Window* transient_child) {}
471 470
472 void NonClientFrameController::OnDidRestackTransientChildAbove( 471 void NonClientFrameController::OnDidRestackTransientChildAbove(
473 aura::Window* parent, 472 aura::Window* parent,
474 aura::Window* transient_child) {} 473 aura::Window* transient_child) {}
475 474
476 } // namespace mus 475 } // namespace mus
477 } // namespace ash 476 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/root_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698