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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "mojo/public/cpp/application/application_connection.h" | 6 #include "mojo/public/cpp/application/application_connection.h" |
7 #include "mojo/public/cpp/application/application_delegate.h" | 7 #include "mojo/public/cpp/application/application_delegate.h" |
8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
9 #include "mojo/public/cpp/application/interface_factory_impl.h" | 9 #include "mojo/public/cpp/application/interface_factory_impl.h" |
10 #include "mojo/services/html_viewer/blink_platform_impl.h" | 10 #include "mojo/services/html_viewer/blink_platform_impl.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 GetServiceProvider(), | 80 GetServiceProvider(), |
81 view_manager); | 81 view_manager); |
82 document_view_->AttachToView(root); | 82 document_view_->AttachToView(root); |
83 MaybeLoad(); | 83 MaybeLoad(); |
84 } | 84 } |
85 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE { | 85 virtual void OnViewManagerDisconnected(ViewManager* view_manager) OVERRIDE { |
86 base::MessageLoop::current()->Quit(); | 86 base::MessageLoop::current()->Quit(); |
87 } | 87 } |
88 | 88 |
89 void MaybeLoad() { | 89 void MaybeLoad() { |
90 if (document_view_ && response_details_) | 90 if (document_view_ && response_details_ && response_details_->response) |
91 document_view_->Load(response_details_->response.Pass()); | 91 document_view_->Load(response_details_->response.Pass()); |
92 } | 92 } |
93 | 93 |
94 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; | 94 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; |
95 ApplicationImpl* application_impl_; | 95 ApplicationImpl* application_impl_; |
96 | 96 |
97 // TODO(darin): Figure out proper ownership of this instance. | 97 // TODO(darin): Figure out proper ownership of this instance. |
98 HTMLDocumentView* document_view_; | 98 HTMLDocumentView* document_view_; |
99 ResponseDetailsPtr response_details_; | 99 ResponseDetailsPtr response_details_; |
100 InterfaceFactoryImplWithContext<NavigatorImpl, HTMLViewer> navigator_factory_; | 100 InterfaceFactoryImplWithContext<NavigatorImpl, HTMLViewer> navigator_factory_; |
101 ViewManagerClientFactory view_manager_client_factory_; | 101 ViewManagerClientFactory view_manager_client_factory_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 103 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
104 }; | 104 }; |
105 | 105 |
106 void NavigatorImpl::Navigate( | 106 void NavigatorImpl::Navigate( |
107 uint32_t view_id, | 107 uint32_t view_id, |
108 NavigationDetailsPtr navigation_details, | 108 NavigationDetailsPtr navigation_details, |
109 ResponseDetailsPtr response_details) { | 109 ResponseDetailsPtr response_details) { |
110 viewer_->Load(response_details.Pass()); | 110 viewer_->Load(response_details.Pass()); |
111 } | 111 } |
112 | 112 |
113 // static | 113 // static |
114 ApplicationDelegate* ApplicationDelegate::Create() { | 114 ApplicationDelegate* ApplicationDelegate::Create() { |
115 return new HTMLViewer; | 115 return new HTMLViewer; |
116 } | 116 } |
117 | 117 |
118 } | 118 } |
OLD | NEW |