| 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_delegate.h" | 16 #include "mojo/shell/public/cpp/application_delegate.h" |
| 17 #include "mojo/shell/public/cpp/application_impl.h" | 17 #include "mojo/shell/public/cpp/application_impl.h" |
| 18 #include "mojo/shell/public/cpp/shell.h" |
| 18 | 19 |
| 19 namespace html_viewer { | 20 namespace html_viewer { |
| 20 | 21 |
| 21 class GlobalState; | 22 class GlobalState; |
| 22 class HTMLDocument; | 23 class HTMLDocument; |
| 23 | 24 |
| 24 // ApplicationDelegate created by the content handler for a specific url. | 25 // ApplicationDelegate created by the content handler for a specific url. |
| 25 class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate, | 26 class HTMLDocumentApplicationDelegate : public mojo::ApplicationDelegate, |
| 26 public HTMLFactory { | 27 public HTMLFactory { |
| 27 public: | 28 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 | 41 |
| 41 ~HTMLDocumentApplicationDelegate() override; | 42 ~HTMLDocumentApplicationDelegate() override; |
| 42 | 43 |
| 43 // Callback from the quit closure. We key off this rather than | 44 // Callback from the quit closure. We key off this rather than |
| 44 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop | 45 // ApplicationDelegate::Quit() as we don't want to shut down the messageloop |
| 45 // when we quit (the messageloop is shared among multiple | 46 // when we quit (the messageloop is shared among multiple |
| 46 // HTMLDocumentApplicationDelegates). | 47 // HTMLDocumentApplicationDelegates). |
| 47 void OnTerminate(); | 48 void OnTerminate(); |
| 48 | 49 |
| 49 // ApplicationDelegate: | 50 // ApplicationDelegate: |
| 50 void Initialize(mojo::ApplicationImpl* app) override; | 51 void Initialize(mojo::Shell* shell, const std::string& url, |
| 52 uint32_t id) override; |
| 51 bool AcceptConnection( | 53 bool AcceptConnection( |
| 52 mojo::ApplicationConnection* connection) override; | 54 mojo::ApplicationConnection* connection) override; |
| 53 | 55 |
| 54 void OnHTMLDocumentDeleted2(HTMLDocument* document); | 56 void OnHTMLDocumentDeleted2(HTMLDocument* document); |
| 55 void OnResponseReceived(scoped_ptr<mojo::AppRefCount> app_refcount, | 57 void OnResponseReceived(scoped_ptr<mojo::AppRefCount> app_refcount, |
| 56 mojo::URLLoaderPtr loader, | 58 mojo::URLLoaderPtr loader, |
| 57 mojo::ApplicationConnection* connection, | 59 mojo::ApplicationConnection* connection, |
| 58 scoped_ptr<ServiceConnectorQueue> connector_queue, | 60 scoped_ptr<ServiceConnectorQueue> connector_queue, |
| 59 mojo::URLResponsePtr response); | 61 mojo::URLResponsePtr response); |
| 60 | 62 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 80 mojo::Callback<void()> destruct_callback_; | 82 mojo::Callback<void()> destruct_callback_; |
| 81 | 83 |
| 82 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; | 84 base::WeakPtrFactory<HTMLDocumentApplicationDelegate> weak_factory_; |
| 83 | 85 |
| 84 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); | 86 DISALLOW_COPY_AND_ASSIGN(HTMLDocumentApplicationDelegate); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } // namespace html_viewer | 89 } // namespace html_viewer |
| 88 | 90 |
| 89 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ | 91 #endif // COMPONENTS_HTML_VIEWER_HTML_DOCUMENT_APPLICATION_DELEGATE_H_ |
| OLD | NEW |