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_TEST_HTML_VIEWER_IMPL_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_TEST_HTML_VIEWER_IMPL_H_ |
6 #define COMPONENTS_HTML_VIEWER_TEST_HTML_VIEWER_IMPL_H_ | 6 #define COMPONENTS_HTML_VIEWER_TEST_HTML_VIEWER_IMPL_H_ |
7 | 7 |
| 8 #include <set> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" | 11 #include "components/html_viewer/public/interfaces/test_html_viewer.mojom.h" |
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
11 | 13 |
12 namespace blink { | 14 namespace blink { |
13 class WebFrame; | 15 class WebLocalFrame; |
14 } | 16 } |
15 | 17 |
16 namespace html_viewer { | 18 namespace html_viewer { |
17 | 19 |
18 // Caller must ensure that |web_frame| outlives TestHTMLViewerImpl. | 20 // Caller must ensure that |web_frame| outlives TestHTMLViewerImpl. |
19 class TestHTMLViewerImpl : public TestHTMLViewer { | 21 class TestHTMLViewerImpl : public TestHTMLViewer { |
20 public: | 22 public: |
21 TestHTMLViewerImpl(blink::WebFrame* web_frame, | 23 TestHTMLViewerImpl(blink::WebLocalFrame* web_frame, |
22 mojo::InterfaceRequest<TestHTMLViewer> request); | 24 mojo::InterfaceRequest<TestHTMLViewer> request); |
23 ~TestHTMLViewerImpl() override; | 25 ~TestHTMLViewerImpl() override; |
24 | 26 |
25 private: | 27 private: |
| 28 class ExecutionCallbackImpl; |
| 29 |
| 30 void CallbackCompleted(ExecutionCallbackImpl* callback_impl); |
| 31 |
26 // TestHTMLViewer: | 32 // TestHTMLViewer: |
27 void GetContentAsText(const GetContentAsTextCallback& callback) override; | 33 void GetContentAsText(const GetContentAsTextCallback& callback) override; |
| 34 void ExecuteScript(const mojo::String& script, |
| 35 const ExecuteScriptCallback& callback) override; |
28 | 36 |
29 blink::WebFrame* web_frame_; | 37 blink::WebLocalFrame* web_frame_; |
30 mojo::Binding<TestHTMLViewer> binding_; | 38 mojo::Binding<TestHTMLViewer> binding_; |
| 39 std::set<ExecutionCallbackImpl*> callbacks_; |
31 | 40 |
32 DISALLOW_COPY_AND_ASSIGN(TestHTMLViewerImpl); | 41 DISALLOW_COPY_AND_ASSIGN(TestHTMLViewerImpl); |
33 }; | 42 }; |
34 | 43 |
35 } // namespace html_viewer | 44 } // namespace html_viewer |
36 | 45 |
37 #endif // COMPONENTS_HTML_VIEWER_TEST_HTML_VIEWER_IMPL_H_ | 46 #endif // COMPONENTS_HTML_VIEWER_TEST_HTML_VIEWER_IMPL_H_ |
OLD | NEW |