| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/html_viewer/html_factory.h" | 13 #include "components/html_viewer/html_factory.h" |
| 14 #include "mojo/public/cpp/bindings/interface_request.h" | 14 #include "mojo/public/cpp/bindings/interface_request.h" |
| 15 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" | 15 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" |
| 16 #include "mojo/shell/public/cpp/application_impl.h" | |
| 17 #include "mojo/shell/public/cpp/shell.h" | 16 #include "mojo/shell/public/cpp/shell.h" |
| 18 #include "mojo/shell/public/cpp/shell_client.h" | 17 #include "mojo/shell/public/cpp/shell_client.h" |
| 18 #include "mojo/shell/public/cpp/shell_connection.h" |
| 19 | 19 |
| 20 namespace html_viewer { | 20 namespace html_viewer { |
| 21 | 21 |
| 22 class GlobalState; | 22 class GlobalState; |
| 23 class HTMLDocument; | 23 class HTMLDocument; |
| 24 | 24 |
| 25 // mojo::ShellClient created by the content handler for a specific url. | 25 // mojo::ShellClient created by the content handler for a specific url. |
| 26 class HTMLDocumentApplicationDelegate : public mojo::ShellClient, | 26 class HTMLDocumentApplicationDelegate : public mojo::ShellClient, |
| 27 public HTMLFactory { | 27 public HTMLFactory { |
| 28 public: | 28 public: |
| 29 HTMLDocumentApplicationDelegate( | 29 HTMLDocumentApplicationDelegate( |
| 30 mojo::ApplicationRequest request, | 30 mojo::ShellClientRequest request, |
| 31 mojo::URLResponsePtr response, | 31 mojo::URLResponsePtr response, |
| 32 GlobalState* global_state, | 32 GlobalState* global_state, |
| 33 scoped_ptr<mojo::AppRefCount> parent_app_refcount, | 33 scoped_ptr<mojo::AppRefCount> parent_app_refcount, |
| 34 const mojo::Callback<void()>& destruct_callback); | 34 const mojo::Callback<void()>& destruct_callback); |
| 35 | 35 |
| 36 void set_html_factory(HTMLFactory* factory) { html_factory_ = factory; } | 36 void set_html_factory(HTMLFactory* factory) { html_factory_ = factory; } |
| 37 HTMLFactory* html_factory() { return html_factory_; } | 37 HTMLFactory* html_factory() { return html_factory_; } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 class ServiceConnectorQueue; | 40 class ServiceConnectorQueue; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 mojo::URLLoaderPtr loader, | 57 mojo::URLLoaderPtr loader, |
| 58 mojo::Connection* connection, | 58 mojo::Connection* connection, |
| 59 scoped_ptr<ServiceConnectorQueue> connector_queue, | 59 scoped_ptr<ServiceConnectorQueue> connector_queue, |
| 60 mojo::URLResponsePtr response); | 60 mojo::URLResponsePtr response); |
| 61 | 61 |
| 62 // HTMLFactory: | 62 // HTMLFactory: |
| 63 HTMLFrame* CreateHTMLFrame(HTMLFrame::CreateParams* params) override; | 63 HTMLFrame* CreateHTMLFrame(HTMLFrame::CreateParams* params) override; |
| 64 HTMLWidgetRootLocal* CreateHTMLWidgetRootLocal( | 64 HTMLWidgetRootLocal* CreateHTMLWidgetRootLocal( |
| 65 HTMLWidgetRootLocal::CreateParams* params) override; | 65 HTMLWidgetRootLocal::CreateParams* params) override; |
| 66 | 66 |
| 67 mojo::ApplicationImpl app_; | 67 mojo::ShellConnection app_; |
| 68 // AppRefCount of the parent (HTMLViewer). | 68 // AppRefCount of the parent (HTMLViewer). |
| 69 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; | 69 scoped_ptr<mojo::AppRefCount> parent_app_refcount_; |
| 70 const mojo::String url_; | 70 const mojo::String url_; |
| 71 mojo::URLLoaderFactoryPtr url_loader_factory_; | 71 mojo::URLLoaderFactoryPtr url_loader_factory_; |
| 72 mojo::URLResponsePtr initial_response_; | 72 mojo::URLResponsePtr initial_response_; |
| 73 GlobalState* global_state_; | 73 GlobalState* global_state_; |
| 74 | 74 |
| 75 // As we create HTMLDocuments they are added here. They are removed when the | 75 // As we create HTMLDocuments they are added here. They are removed when the |
| 76 // HTMLDocument is deleted. | 76 // HTMLDocument is deleted. |
| 77 std::set<HTMLDocument*> documents2_; | 77 std::set<HTMLDocument*> documents2_; |
| 78 | 78 |
| 79 HTMLFactory* html_factory_; | 79 HTMLFactory* html_factory_; |
| 80 | 80 |
| 81 mojo::Callback<void()> destruct_callback_; | 81 mojo::Callback<void()> destruct_callback_; |
| 82 | 82 |
| 83 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; | 83 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); | 85 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace html_viewer | 88 } // namespace html_viewer |
| 89 | 89 |
| 90 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 90 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
| OLD | NEW |