| 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/services/html_viewer/blink_platform_impl.h" | 9 #include "mojo/services/html_viewer/blink_platform_impl.h" |
| 10 #include "mojo/services/html_viewer/html_document_view.h" | 10 #include "mojo/services/html_viewer/html_document_view.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 GetServiceProvider(), view_manager); | 76 GetServiceProvider(), view_manager); |
| 77 document_view_->AttachToNode(root); | 77 document_view_->AttachToNode(root); |
| 78 MaybeLoad(); | 78 MaybeLoad(); |
| 79 } | 79 } |
| 80 virtual void OnViewManagerDisconnected( | 80 virtual void OnViewManagerDisconnected( |
| 81 view_manager::ViewManager* view_manager) OVERRIDE { | 81 view_manager::ViewManager* view_manager) OVERRIDE { |
| 82 base::MessageLoop::current()->Quit(); | 82 base::MessageLoop::current()->Quit(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void MaybeLoad() { | 85 void MaybeLoad() { |
| 86 if (document_view_ && response_.get()) | 86 if (document_view_ && response_) |
| 87 document_view_->Load(response_.Pass()); | 87 document_view_->Load(response_.Pass()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; | 90 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; |
| 91 ApplicationImpl* application_impl_; | 91 ApplicationImpl* application_impl_; |
| 92 | 92 |
| 93 // TODO(darin): Figure out proper ownership of this instance. | 93 // TODO(darin): Figure out proper ownership of this instance. |
| 94 HTMLDocumentView* document_view_; | 94 HTMLDocumentView* document_view_; |
| 95 URLResponsePtr response_; | 95 URLResponsePtr response_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 97 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 void NavigatorImpl::Navigate( | 100 void NavigatorImpl::Navigate( |
| 101 uint32_t node_id, | 101 uint32_t node_id, |
| 102 navigation::NavigationDetailsPtr navigation_details, | 102 navigation::NavigationDetailsPtr navigation_details, |
| 103 navigation::ResponseDetailsPtr response_details) { | 103 navigation::ResponseDetailsPtr response_details) { |
| 104 viewer_->Load(response_details->response.Pass()); | 104 viewer_->Load(response_details->response.Pass()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // static | 107 // static |
| 108 ApplicationDelegate* ApplicationDelegate::Create() { | 108 ApplicationDelegate* ApplicationDelegate::Create() { |
| 109 return new HTMLViewer; | 109 return new HTMLViewer; |
| 110 } | 110 } |
| 111 | 111 |
| 112 } | 112 } |
| OLD | NEW |