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

Side by Side Diff: ash/mus/frame/detached_title_area_renderer.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: add overrides Created 4 years 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 | « ash/mus/frame/detached_title_area_renderer.h ('k') | ash/mus/layout_manager.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/frame/detached_title_area_renderer.h" 5 #include "ash/mus/frame/detached_title_area_renderer.h"
6 6
7 #include "ash/common/frame/header_view.h" 7 #include "ash/common/frame/header_view.h"
8 #include "ash/mus/bridge/wm_window_mus.h"
8 #include "ash/mus/frame/detached_title_area_renderer_host.h" 9 #include "ash/mus/frame/detached_title_area_renderer_host.h"
9 #include "services/ui/public/cpp/window.h" 10 #include "ui/aura/window.h"
10 #include "ui/views/mus/native_widget_mus.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 #include "ui/views/widget/native_widget_aura.h"
12 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
13 14
14 namespace ash { 15 namespace ash {
15 namespace mus { 16 namespace mus {
16 17
17 DetachedTitleAreaRenderer::DetachedTitleAreaRenderer( 18 DetachedTitleAreaRenderer::DetachedTitleAreaRenderer(
18 DetachedTitleAreaRendererHost* host, 19 DetachedTitleAreaRendererHost* host,
19 views::Widget* frame, 20 views::Widget* frame,
20 ui::Window* window, 21 const gfx::Rect& bounds,
21 Source source) 22 Source source)
22 : host_(host), frame_(frame), widget_(new views::Widget) { 23 : host_(host), frame_(frame), widget_(new views::Widget) {
23 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 24 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
24 params.delegate = this; 25 params.delegate = this;
25 params.name = "DetachedTitleAreaRenderer"; 26 params.name = "DetachedTitleAreaRenderer";
26 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; 27 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
27 params.native_widget = new views::NativeWidgetMus( 28 views::NativeWidgetAura* native_widget =
28 widget_, window, ui::mojom::CompositorFrameSinkType::UNDERLAY); 29 new views::NativeWidgetAura(widget_, true);
30 params.native_widget = native_widget;
31 // TODO: making the reveal window a sibling is likely problematic.
32 // http://crbug.com/640392, see also comment in GetVisibleBoundsInScreen().
33 params.parent = frame->GetNativeView()->parent();
34 params.bounds = bounds;
29 widget_->Init(params); 35 widget_->Init(params);
36 params.parent->StackChildAbove(widget_->GetNativeView(),
37 frame->GetNativeView());
30 HeaderView* header_view = new HeaderView(frame_); 38 HeaderView* header_view = new HeaderView(frame_);
31 if (source == Source::CLIENT) { 39 if (source == Source::CLIENT) {
32 // HeaderView behaves differently when the widget it is associated with is 40 // HeaderView behaves differently when the widget it is associated with is
33 // fullscreen (HeaderView is normally the 41 // fullscreen (HeaderView is normally the
34 // ImmersiveFullscreenControllerDelegate). Set this as when creating for 42 // ImmersiveFullscreenControllerDelegate). Set this as when creating for
35 // the client HeaderView is not the ImmersiveFullscreenControllerDelegate. 43 // the client HeaderView is not the ImmersiveFullscreenControllerDelegate.
36 header_view->set_is_immersive_delegate(false); 44 header_view->set_is_immersive_delegate(false);
37 } 45 }
38 widget_->SetContentsView(header_view); 46 widget_->SetContentsView(header_view);
39 widget_->GetRootView()->SetSize(window->bounds().size()); 47 widget_->GetRootView()->SetSize(bounds.size());
40 widget_->ShowInactive(); 48 widget_->ShowInactive();
41 } 49 }
42 50
43 void DetachedTitleAreaRenderer::Destroy() { 51 void DetachedTitleAreaRenderer::Destroy() {
44 host_ = nullptr; 52 host_ = nullptr;
45 if (widget_) 53 if (widget_)
46 widget_->CloseNow(); 54 widget_->CloseNow();
47 } 55 }
48 56
49 views::Widget* DetachedTitleAreaRenderer::GetWidget() { 57 views::Widget* DetachedTitleAreaRenderer::GetWidget() {
50 return widget_; 58 return widget_;
51 } 59 }
52 60
53 const views::Widget* DetachedTitleAreaRenderer::GetWidget() const { 61 const views::Widget* DetachedTitleAreaRenderer::GetWidget() const {
54 return widget_; 62 return widget_;
55 } 63 }
56 64
57 void DetachedTitleAreaRenderer::DeleteDelegate() { 65 void DetachedTitleAreaRenderer::DeleteDelegate() {
58 if (host_) 66 if (host_)
59 host_->OnDetachedTitleAreaRendererDestroyed(this); 67 host_->OnDetachedTitleAreaRendererDestroyed(this);
60 delete this; 68 delete this;
61 } 69 }
62 70
63 DetachedTitleAreaRenderer::~DetachedTitleAreaRenderer() {} 71 DetachedTitleAreaRenderer::~DetachedTitleAreaRenderer() {}
64 72
65 } // namespace mus 73 } // namespace mus
66 } // namespace ash 74 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/frame/detached_title_area_renderer.h ('k') | ash/mus/layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698