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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 default: | 66 default: |
67 return mojo::TARGET_DEFAULT; | 67 return mojo::TARGET_DEFAULT; |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 static int s_next_debugger_id = 1; | 73 static int s_next_debugger_id = 1; |
74 | 74 |
75 DocumentView::DocumentView( | 75 DocumentView::DocumentView( |
76 mojo::ServiceProviderPtr provider, | 76 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 77 mojo::ServiceProviderPtr exported_services, |
77 mojo::URLResponsePtr response, | 78 mojo::URLResponsePtr response, |
78 mojo::Shell* shell) | 79 mojo::Shell* shell) |
79 : response_(response.Pass()), | 80 : response_(response.Pass()), |
80 shell_(shell), | 81 shell_(shell), |
81 web_view_(NULL), | 82 web_view_(NULL), |
82 root_(NULL), | 83 root_(NULL), |
83 view_manager_client_factory_(shell_, this), | 84 view_manager_client_factory_(shell_, this), |
84 inspector_service_factory_(this), | 85 inspector_service_factory_(this), |
85 weak_factory_(this), | 86 weak_factory_(this), |
86 debugger_id_(s_next_debugger_id++) { | 87 debugger_id_(s_next_debugger_id++) { |
| 88 // TODO(jamesr): Is this right? |
87 exported_services_.AddService(&view_manager_client_factory_); | 89 exported_services_.AddService(&view_manager_client_factory_); |
88 mojo::WeakBindToPipe(&exported_services_, provider.PassMessagePipe()); | 90 mojo::WeakBindToPipe(&exported_services_, services.PassMessagePipe()); |
89 } | 91 } |
90 | 92 |
91 DocumentView::~DocumentView() { | 93 DocumentView::~DocumentView() { |
92 if (web_view_) | 94 if (web_view_) |
93 web_view_->close(); | 95 web_view_->close(); |
94 if (root_) | 96 if (root_) |
95 root_->RemoveObserver(this); | 97 root_->RemoveObserver(this); |
96 } | 98 } |
97 | 99 |
98 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { | 100 base::WeakPtr<DocumentView> DocumentView::GetWeakPtr() { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 void DocumentView::StartDebuggerInspectorBackend() { | 301 void DocumentView::StartDebuggerInspectorBackend() { |
300 if (!inspector_backend_) { | 302 if (!inspector_backend_) { |
301 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); | 303 inspector_host_.reset(new InspectorHostImpl(web_view_, shell_)); |
302 inspector_backend_.reset( | 304 inspector_backend_.reset( |
303 new inspector::InspectorBackendMojo(inspector_host_.get())); | 305 new inspector::InspectorBackendMojo(inspector_host_.get())); |
304 } | 306 } |
305 inspector_backend_->Connect(); | 307 inspector_backend_->Connect(); |
306 } | 308 } |
307 | 309 |
308 } // namespace sky | 310 } // namespace sky |
OLD | NEW |