| 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 "mojo/examples/html_viewer/blink_platform_impl.h" | 6 #include "mojo/examples/html_viewer/blink_platform_impl.h" |
| 6 #include "mojo/examples/html_viewer/html_document_view.h" | 7 #include "mojo/examples/html_viewer/html_document_view.h" |
| 7 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
| 8 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
| 9 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 10 #include "mojo/services/public/cpp/view_manager/node.h" | 11 #include "mojo/services/public/cpp/view_manager/node.h" |
| 11 #include "mojo/services/public/cpp/view_manager/types.h" | 12 #include "mojo/services/public/cpp/view_manager/types.h" |
| 12 #include "mojo/services/public/cpp/view_manager/view.h" | 13 #include "mojo/services/public/cpp/view_manager/view.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 14 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 73 |
| 73 // Overridden from view_manager::ViewManagerDelegate: | 74 // Overridden from view_manager::ViewManagerDelegate: |
| 74 virtual void OnRootAdded(view_manager::ViewManager* view_manager, | 75 virtual void OnRootAdded(view_manager::ViewManager* view_manager, |
| 75 view_manager::Node* root) OVERRIDE { | 76 view_manager::Node* root) OVERRIDE { |
| 76 document_view_ = new HTMLDocumentView( | 77 document_view_ = new HTMLDocumentView( |
| 77 application_impl_->ConnectToApplication("mojo://mojo_window_manager/")-> | 78 application_impl_->ConnectToApplication("mojo://mojo_window_manager/")-> |
| 78 GetServiceProvider(), view_manager); | 79 GetServiceProvider(), view_manager); |
| 79 document_view_->AttachToNode(root); | 80 document_view_->AttachToNode(root); |
| 80 MaybeLoad(); | 81 MaybeLoad(); |
| 81 } | 82 } |
| 83 virtual void OnViewManagerDisconnected( |
| 84 view_manager::ViewManager* view_manager) OVERRIDE { |
| 85 base::MessageLoop::current()->Quit(); |
| 86 } |
| 82 | 87 |
| 83 void MaybeLoad() { | 88 void MaybeLoad() { |
| 84 if (document_view_ && response_.get()) | 89 if (document_view_ && response_.get()) |
| 85 document_view_->Load(response_.Pass(), response_body_stream_.Pass()); | 90 document_view_->Load(response_.Pass(), response_body_stream_.Pass()); |
| 86 } | 91 } |
| 87 | 92 |
| 88 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; | 93 scoped_ptr<BlinkPlatformImpl> blink_platform_impl_; |
| 89 ApplicationImpl* application_impl_; | 94 ApplicationImpl* application_impl_; |
| 90 | 95 |
| 91 // TODO(darin): Figure out proper ownership of this instance. | 96 // TODO(darin): Figure out proper ownership of this instance. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 } | 112 } |
| 108 | 113 |
| 109 } | 114 } |
| 110 | 115 |
| 111 // static | 116 // static |
| 112 ApplicationDelegate* ApplicationDelegate::Create() { | 117 ApplicationDelegate* ApplicationDelegate::Create() { |
| 113 return new examples::HTMLViewer; | 118 return new examples::HTMLViewer; |
| 114 } | 119 } |
| 115 | 120 |
| 116 } | 121 } |
| OLD | NEW |