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 "services/window_manager/basic_focus_rules.h" | 7 #include "services/window_manager/basic_focus_rules.h" |
8 | 8 |
9 namespace sky { | 9 namespace sky { |
10 namespace debugger { | 10 namespace debugger { |
11 | 11 |
12 SkyDebugger::SkyDebugger() | 12 SkyDebugger::SkyDebugger() |
13 : window_manager_app_(new window_manager::WindowManagerApp(this, nullptr)), | 13 : window_manager_app_(new window_manager::WindowManagerApp(this, nullptr)), |
14 view_manager_(nullptr), | |
15 root_(nullptr), | 14 root_(nullptr), |
16 content_(nullptr), | 15 content_(nullptr), |
17 navigator_host_factory_(this), | 16 navigator_host_factory_(this), |
18 weak_factory_(this) { | 17 weak_factory_(this) { |
19 } | 18 } |
20 | 19 |
21 SkyDebugger::~SkyDebugger() { | 20 SkyDebugger::~SkyDebugger() { |
22 } | 21 } |
23 | 22 |
24 base::WeakPtr<SkyDebugger> SkyDebugger::GetWeakPtr() { | 23 base::WeakPtr<SkyDebugger> SkyDebugger::GetWeakPtr() { |
(...skipping 13 matching lines...) Expand all Loading... |
38 } | 37 } |
39 | 38 |
40 bool SkyDebugger::ConfigureOutgoingConnection( | 39 bool SkyDebugger::ConfigureOutgoingConnection( |
41 mojo::ApplicationConnection* connection) { | 40 mojo::ApplicationConnection* connection) { |
42 window_manager_app_->ConfigureOutgoingConnection(connection); | 41 window_manager_app_->ConfigureOutgoingConnection(connection); |
43 connection->AddService(this); | 42 connection->AddService(this); |
44 return true; | 43 return true; |
45 } | 44 } |
46 | 45 |
47 void SkyDebugger::OnEmbed( | 46 void SkyDebugger::OnEmbed( |
48 mojo::ViewManager* view_manager, | |
49 mojo::View* root, | 47 mojo::View* root, |
50 mojo::ServiceProviderImpl* exported_services, | 48 mojo::ServiceProviderImpl* exported_services, |
51 scoped_ptr<mojo::ServiceProvider> imported_services) { | 49 scoped_ptr<mojo::ServiceProvider> imported_services) { |
52 view_manager_ = view_manager; | |
53 | |
54 root_ = root; | 50 root_ = root; |
55 root_->AddObserver(this); | 51 root_->AddObserver(this); |
56 | 52 |
57 window_manager_app_->SetViewportSize(gfx::Size(320, 640)); | 53 window_manager_app_->SetViewportSize(gfx::Size(320, 640)); |
58 | 54 |
59 content_ = mojo::View::Create(view_manager_); | 55 content_ = mojo::View::Create(root->view_manager()); |
60 content_->SetBounds(root_->bounds()); | 56 content_->SetBounds(root_->bounds()); |
61 root_->AddChild(content_); | 57 root_->AddChild(content_); |
62 content_->SetVisible(true); | 58 content_->SetVisible(true); |
63 | 59 |
64 window_manager_app_->InitFocus( | 60 window_manager_app_->InitFocus( |
65 make_scoped_ptr(new window_manager::BasicFocusRules(content_))); | 61 make_scoped_ptr(new window_manager::BasicFocusRules(content_))); |
66 | 62 |
67 if (!pending_url_.empty()) | 63 if (!pending_url_.empty()) |
68 NavigateToURL(pending_url_); | 64 NavigateToURL(pending_url_); |
69 } | 65 } |
70 | 66 |
71 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { | 67 void SkyDebugger::OnViewManagerDisconnected(mojo::ViewManager* view_manager) { |
72 view_manager_ = nullptr; | |
73 root_ = nullptr; | 68 root_ = nullptr; |
74 } | 69 } |
75 | 70 |
76 void SkyDebugger::OnViewDestroyed(mojo::View* view) { | 71 void SkyDebugger::OnViewDestroyed(mojo::View* view) { |
77 view->RemoveObserver(this); | 72 view->RemoveObserver(this); |
78 } | 73 } |
79 | 74 |
80 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, | 75 void SkyDebugger::OnViewBoundsChanged(mojo::View* view, |
81 const mojo::Rect& old_bounds, | 76 const mojo::Rect& old_bounds, |
82 const mojo::Rect& new_bounds) { | 77 const mojo::Rect& new_bounds) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 111 } |
117 | 112 |
118 void SkyDebugger::InjectInspector() { | 113 void SkyDebugger::InjectInspector() { |
119 InspectorServicePtr inspector_service; | 114 InspectorServicePtr inspector_service; |
120 mojo::ConnectToService(viewer_services_.get(), &inspector_service); | 115 mojo::ConnectToService(viewer_services_.get(), &inspector_service); |
121 inspector_service->Inject(); | 116 inspector_service->Inject(); |
122 } | 117 } |
123 | 118 |
124 } // namespace debugger | 119 } // namespace debugger |
125 } // namespace sky | 120 } // namespace sky |
OLD | NEW |