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 #ifndef SKY_VIEWER_INTERNALS_H_ | 5 #ifndef SKY_VIEWER_INTERNALS_H_ |
6 #define SKY_VIEWER_INTERNALS_H_ | 6 #define SKY_VIEWER_INTERNALS_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "gin/handle.h" | 9 #include "base/supports_user_data.h" |
10 #include "gin/object_template_builder.h" | 10 #include "dart/runtime/include/dart_api.h" |
11 #include "gin/wrappable.h" | |
12 #include "mojo/public/interfaces/application/shell.mojom.h" | 11 #include "mojo/public/interfaces/application/shell.mojom.h" |
13 #include "sky/services/testing/test_harness.mojom.h" | 12 #include "sky/services/testing/test_harness.mojom.h" |
14 | 13 |
15 namespace sky { | 14 namespace sky { |
16 class DocumentView; | 15 class DocumentView; |
17 | 16 |
18 class Internals : public gin::Wrappable<Internals>, | 17 class Internals : public base::SupportsUserData::Data, |
19 public mojo::Shell { | 18 public mojo::Shell { |
20 public: | 19 public: |
21 static gin::WrapperInfo kWrapperInfo; | |
22 static gin::Handle<Internals> Create(v8::Isolate*, DocumentView*); | |
23 | |
24 virtual ~Internals(); | 20 virtual ~Internals(); |
25 | 21 |
26 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 22 static void Create(Dart_Isolate isolate, DocumentView* document_view); |
27 v8::Isolate* isolate) override; | |
28 | |
29 private: | |
30 explicit Internals(DocumentView* document_view); | |
31 | 23 |
32 // mojo::Shell method: | 24 // mojo::Shell method: |
33 void ConnectToApplication( | 25 void ConnectToApplication( |
34 const mojo::String& application_url, | 26 const mojo::String& application_url, |
35 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 27 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
36 mojo::ServiceProviderPtr exposed_services) override; | 28 mojo::ServiceProviderPtr exposed_services) override; |
37 | 29 |
38 mojo::Handle PassShellProxyHandle(); | 30 mojo::Handle PassShellProxyHandle(); |
39 std::string RenderTreeAsText(); | 31 std::string RenderTreeAsText(); |
40 std::string ContentAsText(); | 32 std::string ContentAsText(); |
41 void NotifyTestComplete(const std::string& test_result); | 33 void NotifyTestComplete(const std::string& test_result); |
42 | 34 |
43 mojo::Handle ConnectToEmbedderService(const std::string& interface_name); | 35 mojo::Handle ConnectToEmbedderService(const std::string& interface_name); |
44 | 36 |
45 mojo::Handle ConnectToService( | 37 mojo::Handle ConnectToService( |
46 const std::string& application_url, const std::string& interface_name); | 38 const std::string& application_url, const std::string& interface_name); |
47 | 39 |
48 void pauseAnimations(double pauseTime); | 40 void pauseAnimations(double pauseTime); |
49 | 41 |
| 42 private: |
| 43 explicit Internals(DocumentView* document_view); |
| 44 |
50 base::WeakPtr<DocumentView> document_view_; | 45 base::WeakPtr<DocumentView> document_view_; |
51 mojo::Binding<mojo::Shell> shell_binding_; | 46 mojo::Binding<mojo::Shell> shell_binding_; |
52 TestHarnessPtr test_harness_; | 47 TestHarnessPtr test_harness_; |
53 | 48 |
54 MOJO_DISALLOW_COPY_AND_ASSIGN(Internals); | 49 MOJO_DISALLOW_COPY_AND_ASSIGN(Internals); |
55 }; | 50 }; |
56 | 51 |
57 } // namespace sky | 52 } // namespace sky |
58 | 53 |
59 #endif // SKY_VIEWER_INTERNALS_H_ | 54 #endif // SKY_VIEWER_INTERNALS_H_ |
OLD | NEW |