| 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/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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 NativeWidgetAura::InitNativeWidget(params); | 125 NativeWidgetAura::InitNativeWidget(params); |
| 126 capture_client_.reset( | 126 capture_client_.reset( |
| 127 new wm::ScopedCaptureClient(window_tree_host_->window())); | 127 new wm::ScopedCaptureClient(window_tree_host_->window())); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void NativeWidgetViewManager::CompositorContentsChanged( | 130 void NativeWidgetViewManager::CompositorContentsChanged( |
| 131 const SkBitmap& bitmap) { | 131 const SkBitmap& bitmap) { |
| 132 node_->active_view()->SetContents(bitmap); | 132 node_->active_view()->SetContents(bitmap); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void NativeWidgetViewManager::OnNodeDestroying(view_manager::Node* node) { |
| 136 DCHECK_EQ(node, node_); |
| 137 node->RemoveObserver(this); |
| 138 } |
| 139 |
| 135 void NativeWidgetViewManager::OnNodeDestroyed(view_manager::Node* node) { | 140 void NativeWidgetViewManager::OnNodeDestroyed(view_manager::Node* node) { |
| 136 window_tree_host_.reset(); | 141 window_tree_host_.reset(); |
| 137 } | 142 } |
| 138 | 143 |
| 144 void NativeWidgetViewManager::OnNodeBoundsChanged(view_manager::Node* node, |
| 145 const gfx::Rect& old_bounds, |
| 146 const gfx::Rect& new_bounds) { |
| 147 GetWidget()->SetBounds(gfx::Rect(node->bounds().size())); |
| 148 } |
| 149 |
| 139 void NativeWidgetViewManager::OnNodeActiveViewChanged( | 150 void NativeWidgetViewManager::OnNodeActiveViewChanged( |
| 140 view_manager::Node* node, | 151 view_manager::Node* node, |
| 141 view_manager::View* old_view, | 152 view_manager::View* old_view, |
| 142 view_manager::View* new_view) { | 153 view_manager::View* new_view) { |
| 143 if (old_view) | 154 if (old_view) |
| 144 old_view->RemoveObserver(this); | 155 old_view->RemoveObserver(this); |
| 145 if (new_view) | 156 if (new_view) |
| 146 new_view->AddObserver(this); | 157 new_view->AddObserver(this); |
| 147 } | 158 } |
| 148 | 159 |
| 149 void NativeWidgetViewManager::OnViewInputEvent(view_manager::View* view, | 160 void NativeWidgetViewManager::OnViewInputEvent(view_manager::View* view, |
| 150 const EventPtr& event) { | 161 const EventPtr& event) { |
| 151 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); | 162 scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event> >()); |
| 152 if (ui_event.get()) | 163 if (ui_event.get()) |
| 153 window_tree_host_->SendEventToProcessor(ui_event.get()); | 164 window_tree_host_->SendEventToProcessor(ui_event.get()); |
| 154 } | 165 } |
| 155 | 166 |
| 156 } // namespace mojo | 167 } // namespace mojo |
| OLD | NEW |