| 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 "sky/tools/debugger/debugger.h" | 5 #include "sky/tools/debugger/debugger.h" |
| 6 | 6 |
| 7 #include "mojo/services/window_manager/basic_focus_rules.h" | 7 #include "mojo/services/window_manager/basic_focus_rules.h" |
| 8 | 8 |
| 9 namespace sky { | 9 namespace sky { |
| 10 namespace debugger { | 10 namespace debugger { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void SkyDebugger::OnViewDestroyed(mojo::View* view) { | 75 void SkyDebugger::OnViewDestroyed(mojo::View* view) { |
| 76 view->RemoveObserver(this); | 76 view->RemoveObserver(this); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, | 79 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, |
| 80 const mojo::Rect& old_bounds, | 80 const mojo::Rect& old_bounds, |
| 81 const mojo::Rect& new_bounds) { | 81 const mojo::Rect& new_bounds) { |
| 82 content_->SetBounds(new_bounds); | 82 content_->SetBounds(new_bounds); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SkyDebugger::OnViewInputEvent( |
| 86 mojo::View* view, const mojo::EventPtr& event) { |
| 87 if (view != root_) |
| 88 return; |
| 89 // Currently, the event targeting system is broken for mojo::Views, so we |
| 90 // blindly forward events from the root to the content view. Once event |
| 91 // targeting works, we should be able to rip out this code. |
| 92 window_manager_app_->DispatchInputEventToView(content_, event.Clone()); |
| 93 } |
| 94 |
| 85 void SkyDebugger::Create(mojo::ApplicationConnection* connection, | 95 void SkyDebugger::Create(mojo::ApplicationConnection* connection, |
| 86 mojo::InterfaceRequest<Debugger> request) { | 96 mojo::InterfaceRequest<Debugger> request) { |
| 87 mojo::WeakBindToRequest(this, &request); | 97 mojo::WeakBindToRequest(this, &request); |
| 88 } | 98 } |
| 89 | 99 |
| 90 void SkyDebugger::NavigateToURL(const mojo::String& url) { | 100 void SkyDebugger::NavigateToURL(const mojo::String& url) { |
| 91 // We can get Navigate commands before we've actually been | 101 // We can get Navigate commands before we've actually been |
| 92 // embedded into the view and content_ created. | 102 // embedded into the view and content_ created. |
| 93 // Just save the last one. | 103 // Just save the last one. |
| 94 if (content_) { | 104 if (content_) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 115 } | 125 } |
| 116 | 126 |
| 117 void SkyDebugger::InjectInspector() { | 127 void SkyDebugger::InjectInspector() { |
| 118 InspectorServicePtr inspector_service; | 128 InspectorServicePtr inspector_service; |
| 119 mojo::ConnectToService(viewer_services_.get(), &inspector_service); | 129 mojo::ConnectToService(viewer_services_.get(), &inspector_service); |
| 120 inspector_service->Inject(); | 130 inspector_service->Inject(); |
| 121 } | 131 } |
| 122 | 132 |
| 123 } // namespace debugger | 133 } // namespace debugger |
| 124 } // namespace sky | 134 } // namespace sky |
| OLD | NEW |