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_VIEWER_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_HTML_VIEWER_H_ |
6 #define COMPONENTS_HTML_VIEWER_HTML_VIEWER_H_ | 6 #define COMPONENTS_HTML_VIEWER_HTML_VIEWER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "mojo/shell/public/cpp/application_delegate.h" | |
11 #include "mojo/shell/public/cpp/interface_factory.h" | 10 #include "mojo/shell/public/cpp/interface_factory.h" |
| 11 #include "mojo/shell/public/cpp/shell_client.h" |
12 #include "mojo/shell/public/interfaces/content_handler.mojom.h" | 12 #include "mojo/shell/public/interfaces/content_handler.mojom.h" |
13 | 13 |
14 namespace html_viewer { | 14 namespace html_viewer { |
15 | 15 |
16 class GlobalState; | 16 class GlobalState; |
17 | 17 |
18 class HTMLViewer | 18 class HTMLViewer |
19 : public mojo::ApplicationDelegate, | 19 : public mojo::ShellClient, |
20 public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler> { | 20 public mojo::InterfaceFactory<mojo::shell::mojom::ContentHandler> { |
21 public: | 21 public: |
22 HTMLViewer(); | 22 HTMLViewer(); |
23 ~HTMLViewer() override; | 23 ~HTMLViewer() override; |
24 | 24 |
25 protected: | 25 protected: |
26 GlobalState* global_state() const { return global_state_.get(); } | 26 GlobalState* global_state() const { return global_state_.get(); } |
27 mojo::Shell* shell() const { return shell_; } | 27 mojo::Shell* shell() const { return shell_; } |
28 | 28 |
29 // Overridden from ApplicationDelegate: | 29 // Overridden from mojo::ShellClient: |
30 void Initialize(mojo::Shell* shell, const std::string& url, | 30 void Initialize(mojo::Shell* shell, const std::string& url, |
31 uint32_t id) override; | 31 uint32_t id) override; |
32 | 32 |
33 private: | 33 private: |
34 // Overridden from ApplicationDelegate: | 34 // Overridden from mojo::ShellClient: |
35 bool AcceptConnection( | 35 bool AcceptConnection( |
36 mojo::ApplicationConnection* connection) override; | 36 mojo::Connection* connection) override; |
37 | 37 |
38 // Overridden from InterfaceFactory<shell::mojom::ContentHandler> | 38 // Overridden from InterfaceFactory<shell::mojom::ContentHandler> |
39 void Create(mojo::ApplicationConnection* connection, | 39 void Create(mojo::Connection* connection, |
40 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> | 40 mojo::InterfaceRequest<mojo::shell::mojom::ContentHandler> |
41 request) override; | 41 request) override; |
42 | 42 |
43 scoped_ptr<GlobalState> global_state_; | 43 scoped_ptr<GlobalState> global_state_; |
44 mojo::Shell* shell_; | 44 mojo::Shell* shell_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); | 46 DISALLOW_COPY_AND_ASSIGN(HTMLViewer); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace html_viewer | 49 } // namespace html_viewer |
50 | 50 |
51 #endif // COMPONENTS_HTML_VIEWER_HTML_VIEWER_H_ | 51 #endif // COMPONENTS_HTML_VIEWER_HTML_VIEWER_H_ |
OLD | NEW |