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

Side by Side Diff: mojo/views/native_widget_view_manager.cc

Issue 341953002: Clean up WTH creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/views/native_widget_view_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/views/native_widget_view_manager.h" 5 #include "mojo/views/native_widget_view_manager.h"
6 6
7 #include "mojo/aura/window_tree_host_mojo.h" 7 #include "mojo/aura/window_tree_host_mojo.h"
8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h" 8 #include "mojo/services/public/cpp/input_events/input_events_type_converters.h"
9 #include "mojo/services/public/cpp/view_manager/view.h" 9 #include "mojo/services/public/cpp/view_manager/view.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 aura::Window* root_; 80 aura::Window* root_;
81 scoped_ptr<ui::InputMethod> input_method_; 81 scoped_ptr<ui::InputMethod> input_method_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(MinimalInputEventFilter); 83 DISALLOW_COPY_AND_ASSIGN(MinimalInputEventFilter);
84 }; 84 };
85 85
86 } // namespace 86 } // namespace
87 87
88 NativeWidgetViewManager::NativeWidgetViewManager( 88 NativeWidgetViewManager::NativeWidgetViewManager(
89 views::internal::NativeWidgetDelegate* delegate, view_manager::View* view) 89 views::internal::NativeWidgetDelegate* delegate, view_manager::Node* node)
90 : NativeWidgetAura(delegate), 90 : NativeWidgetAura(delegate),
91 view_(view) { 91 node_(node) {
92 view_->AddObserver(this); 92 node_->active_view()->AddObserver(this);
93 window_tree_host_.reset(new WindowTreeHostMojo(gfx::Rect(800, 600), this)); 93 window_tree_host_.reset(new WindowTreeHostMojo(node_, this));
94 window_tree_host_->InitHost(); 94 window_tree_host_->InitHost();
95 95
96 ime_filter_.reset( 96 ime_filter_.reset(
97 new MinimalInputEventFilter(window_tree_host_->window())); 97 new MinimalInputEventFilter(window_tree_host_->window()));
98 98
99 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); 99 focus_client_.reset(new wm::FocusController(new FocusRulesImpl));
100 100
101 aura::client::SetFocusClient(window_tree_host_->window(), 101 aura::client::SetFocusClient(window_tree_host_->window(),
102 focus_client_.get()); 102 focus_client_.get());
103 aura::client::SetActivationClient(window_tree_host_->window(), 103 aura::client::SetActivationClient(window_tree_host_->window(),
104 focus_client_.get()); 104 focus_client_.get());
105 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); 105 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get());
106 } 106 }
107 107
108 NativeWidgetViewManager::~NativeWidgetViewManager() { 108 NativeWidgetViewManager::~NativeWidgetViewManager() {
109 view_->RemoveObserver(this); 109 node_->active_view()->RemoveObserver(this);
110 } 110 }
111 111
112 void NativeWidgetViewManager::InitNativeWidget( 112 void NativeWidgetViewManager::InitNativeWidget(
113 const views::Widget::InitParams& in_params) { 113 const views::Widget::InitParams& in_params) {
114 views::Widget::InitParams params(in_params); 114 views::Widget::InitParams params(in_params);
115 params.parent = window_tree_host_->window(); 115 params.parent = window_tree_host_->window();
116 NativeWidgetAura::InitNativeWidget(params); 116 NativeWidgetAura::InitNativeWidget(params);
117 } 117 }
118 118
119 void NativeWidgetViewManager::CompositorContentsChanged( 119 void NativeWidgetViewManager::CompositorContentsChanged(
120 const SkBitmap& bitmap) { 120 const SkBitmap& bitmap) {
121 view_->SetContents(bitmap); 121 node_->active_view()->SetContents(bitmap);
122 } 122 }
123 123
124 void NativeWidgetViewManager::OnViewInputEvent(view_manager::View* view, 124 void NativeWidgetViewManager::OnViewInputEvent(view_manager::View* view,
125 const EventPtr& event) { 125 const EventPtr& event) {
126 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); 126 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >());
127 if (ui_event.get()) 127 if (ui_event.get())
128 window_tree_host_->SendEventToProcessor(ui_event.get()); 128 window_tree_host_->SendEventToProcessor(ui_event.get());
129 } 129 }
130 130
131 } // namespace mojo 131 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/views/native_widget_view_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698