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