OLD | NEW |
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/converters/geometry/geometry_type_converters.h" | 8 #include "mojo/converters/geometry/geometry_type_converters.h" |
9 #include "mojo/converters/input_events/input_events_type_converters.h" | 9 #include "mojo/converters/input_events/input_events_type_converters.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 view_->RemoveObserver(this); | 124 view_->RemoveObserver(this); |
125 } | 125 } |
126 | 126 |
127 void NativeWidgetViewManager::InitNativeWidget( | 127 void NativeWidgetViewManager::InitNativeWidget( |
128 const views::Widget::InitParams& in_params) { | 128 const views::Widget::InitParams& in_params) { |
129 views::Widget::InitParams params(in_params); | 129 views::Widget::InitParams params(in_params); |
130 params.parent = window_tree_host_->window(); | 130 params.parent = window_tree_host_->window(); |
131 NativeWidgetAura::InitNativeWidget(params); | 131 NativeWidgetAura::InitNativeWidget(params); |
132 } | 132 } |
133 | 133 |
| 134 void NativeWidgetViewManager::OnWindowVisibilityChanged(aura::Window* window, |
| 135 bool visible) { |
| 136 view_->SetVisible(visible); |
| 137 // NOTE: We could also update aura::Window's visibility when the View's |
| 138 // visibilty changes, but this code isn't going to be around for very long so |
| 139 // I'm not bothering. |
| 140 } |
| 141 |
134 void NativeWidgetViewManager::OnViewDestroyed(View* view) { | 142 void NativeWidgetViewManager::OnViewDestroyed(View* view) { |
135 DCHECK_EQ(view, view_); | 143 DCHECK_EQ(view, view_); |
136 view->RemoveObserver(this); | 144 view->RemoveObserver(this); |
137 view_ = NULL; | 145 view_ = NULL; |
138 // TODO(sky): WindowTreeHostMojo assumes the View outlives it. | 146 // TODO(sky): WindowTreeHostMojo assumes the View outlives it. |
139 // NativeWidgetViewManager needs to deal, likely by deleting this. | 147 // NativeWidgetViewManager needs to deal, likely by deleting this. |
140 } | 148 } |
141 | 149 |
142 void NativeWidgetViewManager::OnViewBoundsChanged(View* view, | 150 void NativeWidgetViewManager::OnViewBoundsChanged(View* view, |
143 const Rect& old_bounds, | 151 const Rect& old_bounds, |
144 const Rect& new_bounds) { | 152 const Rect& new_bounds) { |
145 gfx::Rect view_rect = view->bounds().To<gfx::Rect>(); | 153 gfx::Rect view_rect = view->bounds().To<gfx::Rect>(); |
146 GetWidget()->SetBounds(gfx::Rect(view_rect.size())); | 154 GetWidget()->SetBounds(gfx::Rect(view_rect.size())); |
147 } | 155 } |
148 | 156 |
149 void NativeWidgetViewManager::OnViewInputEvent(View* view, | 157 void NativeWidgetViewManager::OnViewInputEvent(View* view, |
150 const EventPtr& event) { | 158 const EventPtr& event) { |
151 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); | 159 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); |
152 if (ui_event) | 160 if (ui_event) |
153 window_tree_host_->SendEventToProcessor(ui_event.get()); | 161 window_tree_host_->SendEventToProcessor(ui_event.get()); |
154 } | 162 } |
155 | 163 |
156 } // namespace mojo | 164 } // namespace mojo |
OLD | NEW |