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/viewer/document_view.h" | 5 #include "sky/viewer/document_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 default: | 65 default: |
66 return mojo::TARGET_DEFAULT; | 66 return mojo::TARGET_DEFAULT; |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 } // namespace | 70 } // namespace |
71 | 71 |
72 static int s_next_debugger_id = 1; | 72 static int s_next_debugger_id = 1; |
73 | 73 |
74 DocumentView::DocumentView( | 74 DocumentView::DocumentView( |
75 mojo::ServiceProviderPtr provider, | 75 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 76 mojo::ServiceProviderPtr exported_services, |
76 mojo::URLResponsePtr response, | 77 mojo::URLResponsePtr response, |
77 mojo::Shell* shell) | 78 mojo::Shell* shell) |
78 : response_(response.Pass()), | 79 : response_(response.Pass()), |
79 shell_(shell), | 80 shell_(shell), |
80 web_view_(NULL), | 81 web_view_(NULL), |
81 root_(NULL), | 82 root_(NULL), |
82 view_manager_client_factory_(shell_, this), | 83 view_manager_client_factory_(shell_, this), |
83 inspector_service_factory_(this), | 84 inspector_service_factory_(this), |
84 weak_factory_(this), | 85 weak_factory_(this), |
85 debugger_id_(s_next_debugger_id++) { | 86 debugger_id_(s_next_debugger_id++) { |
| 87 // TODO(jamesr): Is this right? |
86 exported_services_.AddService(&view_manager_client_factory_); | 88 exported_services_.AddService(&view_manager_client_factory_); |
87 mojo::WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); | 89 mojo::WeakBindToPipe(&exported_services_, services.PassMessagePipe()); |
88 } | 90 } |
89 | 91 |
90 DocumentView::~DocumentView() { | 92 DocumentView::~DocumentView() { |
91 if (web_view_) | 93 if (web_view_) |
92 web_view_->close(); | 94 web_view_->close(); |
93 if (root_) | 95 if (root_) |
94 root_->RemoveObserver(this); | 96 root_->RemoveObserver(this); |
95 } | 97 } |
96 | 98 |
97 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { | 99 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 void DocumentView::StartDebuggerInspectorBackend() { | 279 void DocumentView::StartDebuggerInspectorBackend() { |
278 if (!inspector_backend_) { | 280 if (!inspector_backend_) { |
279 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 281 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
280 inspector_backend_.reset( | 282 inspector_backend_.reset( |
281 new inspector::InspectorBackendMojo(inspector_host_.get())); | 283 new inspector::InspectorBackendMojo(inspector_host_.get())); |
282 } | 284 } |
283 inspector_backend_->Connect(); | 285 inspector_backend_->Connect(); |
284 } | 286 } |
285 | 287 |
286 } // namespace sky | 288 } // namespace sky |
OLD | NEW |