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

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

Issue 541013002: Fix the buttons in the mojo demo window manager debug panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « 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 "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 new MinimalInputEventFilter(window_tree_host_->window())); 106 new MinimalInputEventFilter(window_tree_host_->window()));
107 107
108 focus_client_.reset(new wm::FocusController(new FocusRulesImpl)); 108 focus_client_.reset(new wm::FocusController(new FocusRulesImpl));
109 109
110 aura::client::SetFocusClient(window_tree_host_->window(), 110 aura::client::SetFocusClient(window_tree_host_->window(),
111 focus_client_.get()); 111 focus_client_.get());
112 aura::client::SetActivationClient(window_tree_host_->window(), 112 aura::client::SetActivationClient(window_tree_host_->window(),
113 focus_client_.get()); 113 focus_client_.get());
114 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get()); 114 window_tree_host_->window()->AddPreTargetHandler(focus_client_.get());
115 115
116 aura::client::SetCaptureClient( 116 capture_client_.reset(
117 window_tree_host_->window(),
118 new aura::client::DefaultCaptureClient(window_tree_host_->window())); 117 new aura::client::DefaultCaptureClient(window_tree_host_->window()));
119 } 118 }
120 119
121 NativeWidgetViewManager::~NativeWidgetViewManager() { 120 NativeWidgetViewManager::~NativeWidgetViewManager() {
122 if (view_) 121 if (view_)
123 view_->RemoveObserver(this); 122 view_->RemoveObserver(this);
124 } 123 }
125 124
126 void NativeWidgetViewManager::InitNativeWidget( 125 void NativeWidgetViewManager::InitNativeWidget(
127 const views::Widget::InitParams& in_params) { 126 const views::Widget::InitParams& in_params) {
128 views::Widget::InitParams params(in_params); 127 views::Widget::InitParams params(in_params);
129 params.parent = window_tree_host_->window(); 128 params.parent = window_tree_host_->window();
130 NativeWidgetAura::InitNativeWidget(params); 129 NativeWidgetAura::InitNativeWidget(params);
131 capture_client_.reset(
132 new wm::ScopedCaptureClient(window_tree_host_->window()));
133 } 130 }
134 131
135 void NativeWidgetViewManager::CompositorContentsChanged( 132 void NativeWidgetViewManager::CompositorContentsChanged(
136 const SkBitmap& bitmap) { 133 const SkBitmap& bitmap) {
137 if (view_) 134 if (view_)
138 view_->SetContents(bitmap); 135 view_->SetContents(bitmap);
139 } 136 }
140 137
141 void NativeWidgetViewManager::OnViewDestroyed(View* view) { 138 void NativeWidgetViewManager::OnViewDestroyed(View* view) {
142 DCHECK_EQ(view, view_); 139 DCHECK_EQ(view, view_);
143 view->RemoveObserver(this); 140 view->RemoveObserver(this);
144 view_ = NULL; 141 view_ = NULL;
145 window_tree_host_.reset(); 142 window_tree_host_.reset();
146 } 143 }
147 144
148 void NativeWidgetViewManager::OnViewBoundsChanged(View* view, 145 void NativeWidgetViewManager::OnViewBoundsChanged(View* view,
149 const gfx::Rect& old_bounds, 146 const gfx::Rect& old_bounds,
150 const gfx::Rect& new_bounds) { 147 const gfx::Rect& new_bounds) {
151 GetWidget()->SetBounds(gfx::Rect(view->bounds().size())); 148 GetWidget()->SetBounds(gfx::Rect(view->bounds().size()));
152 } 149 }
153 150
154 void NativeWidgetViewManager::OnViewInputEvent(View* view, 151 void NativeWidgetViewManager::OnViewInputEvent(View* view,
155 const EventPtr& event) { 152 const EventPtr& event) {
156 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); 153 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >());
157 if (ui_event) 154 if (ui_event)
158 window_tree_host_->SendEventToProcessor(ui_event.get()); 155 window_tree_host_->SendEventToProcessor(ui_event.get());
159 } 156 }
160 157
161 } // namespace mojo 158 } // 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