| 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_with_context.h" | 9 #include "mojo/public/cpp/application/interface_factory_with_context.h" |
| 10 #include "mojo/services/html_viewer/blink_platform_impl.h" | 10 #include "mojo/services/html_viewer/blink_platform_impl.h" |
| 11 #include "mojo/services/html_viewer/html_document_view.h" | 11 #include "mojo/services/html_viewer/html_document_view.h" |
| 12 #include "mojo/services/public/cpp/view_manager/node.h" | 12 #include "mojo/services/public/cpp/view_manager/node.h" |
| 13 #include "mojo/services/public/cpp/view_manager/types.h" | 13 #include "mojo/services/public/cpp/view_manager/types.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view.h" | 14 #include "mojo/services/public/cpp/view_manager/view.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 16 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" | 16 #include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h" |
| 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" | 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" |
| 18 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" | 18 #include "mojo/services/public/interfaces/navigation/navigation.mojom.h" |
| 19 #include "third_party/WebKit/public/web/WebKit.h" | 19 #include "third_party/WebKit/public/web/WebKit.h" |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 | 22 |
| 23 class HTMLViewer; | 23 class HTMLViewer; |
| 24 | 24 |
| 25 class NavigatorImpl : public InterfaceImpl<navigation::Navigator> { | 25 class NavigatorImpl : public InterfaceImpl<Navigator> { |
| 26 public: | 26 public: |
| 27 explicit NavigatorImpl(HTMLViewer* viewer) : viewer_(viewer) {} | 27 explicit NavigatorImpl(HTMLViewer* viewer) : viewer_(viewer) {} |
| 28 virtual ~NavigatorImpl() {} | 28 virtual ~NavigatorImpl() {} |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // Overridden from navigation::Navigator: | 31 // Overridden from Navigator: |
| 32 virtual void Navigate( | 32 virtual void Navigate( |
| 33 uint32_t node_id, | 33 uint32_t node_id, |
| 34 navigation::NavigationDetailsPtr navigation_details, | 34 NavigationDetailsPtr navigation_details, |
| 35 navigation::ResponseDetailsPtr response_details) OVERRIDE; | 35 ResponseDetailsPtr response_details) OVERRIDE; |
| 36 | 36 |
| 37 HTMLViewer* viewer_; | 37 HTMLViewer* viewer_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); | 39 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class HTMLViewer | 42 class HTMLViewer |
| 43 : public ApplicationDelegate, | 43 : public ApplicationDelegate, |
| 44 public ViewManagerDelegate, | 44 public ViewManagerDelegate, |
| 45 public InterfaceFactoryWithContext<NavigatorImpl, HTMLViewer> { | 45 public InterfaceFactoryWithContext<NavigatorImpl, HTMLViewer> { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // TODO(darin): Figure out proper ownership of this instance. | 98 // TODO(darin): Figure out proper ownership of this instance. |
| 99 HTMLDocumentView* document_view_; | 99 HTMLDocumentView* document_view_; |
| 100 URLResponsePtr response_; | 100 URLResponsePtr response_; |
| 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 node_id, | 107 uint32_t node_id, |
| 108 navigation::NavigationDetailsPtr navigation_details, | 108 NavigationDetailsPtr navigation_details, |
| 109 navigation::ResponseDetailsPtr response_details) { | 109 ResponseDetailsPtr response_details) { |
| 110 viewer_->Load(response_details->response.Pass()); | 110 viewer_->Load(response_details->response.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 |