| 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 SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ | 5 #ifndef SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ |
| 6 #define SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ | 6 #define SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "dart/runtime/include/dart_api.h" | 11 #include "dart/runtime/include/dart_api.h" |
| 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 12 #include "sky/engine/wtf/OwnPtr.h" | 13 #include "sky/engine/wtf/OwnPtr.h" |
| 13 #include "sky/engine/wtf/text/AtomicString.h" | 14 #include "sky/engine/wtf/text/AtomicString.h" |
| 14 #include "sky/engine/wtf/text/TextPosition.h" | 15 #include "sky/engine/wtf/text/TextPosition.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 class AbstractModule; | 18 class AbstractModule; |
| 18 class BuiltinSky; | 19 class BuiltinSky; |
| 19 class DOMDartState; | 20 class DOMDartState; |
| 20 class DartValue; | 21 class DartValue; |
| 21 class HTMLScriptElement; | 22 class HTMLScriptElement; |
| 22 class KURL; | 23 class KURL; |
| 23 class View; | 24 class View; |
| 24 | 25 |
| 25 class DartController { | 26 class DartController { |
| 26 public: | 27 public: |
| 27 DartController(); | 28 DartController(); |
| 28 ~DartController(); | 29 ~DartController(); |
| 29 | 30 |
| 30 static void InitVM(); | 31 static void InitVM(); |
| 31 | 32 |
| 32 typedef base::Callback<void(RefPtr<AbstractModule>, RefPtr<DartValue>)> | 33 typedef base::Callback<void(RefPtr<AbstractModule>, RefPtr<DartValue>)> |
| 33 LoadFinishedCallback; | 34 LoadFinishedCallback; |
| 34 | 35 |
| 35 void LoadMainLibrary(const KURL& url); | 36 // Can either issue the url load ourselves or take an existing response: |
| 37 void LoadMainLibrary(const KURL& url, mojo::URLResponsePtr response = nullptr)
; |
| 36 | 38 |
| 37 void LoadScriptInModule(AbstractModule* module, | 39 void LoadScriptInModule(AbstractModule* module, |
| 38 const String& source, | 40 const String& source, |
| 39 const TextPosition& textPosition, | 41 const TextPosition& textPosition, |
| 40 const LoadFinishedCallback& load_finished_callback); | 42 const LoadFinishedCallback& load_finished_callback); |
| 41 void ExecuteLibraryInModule(AbstractModule* module, | 43 void ExecuteLibraryInModule(AbstractModule* module, |
| 42 Dart_Handle library, | 44 Dart_Handle library, |
| 43 HTMLScriptElement* script); | 45 HTMLScriptElement* script); |
| 44 | 46 |
| 45 void ClearForClose(); | 47 void ClearForClose(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 OwnPtr<BuiltinSky> builtin_sky_; | 63 OwnPtr<BuiltinSky> builtin_sky_; |
| 62 | 64 |
| 63 base::WeakPtrFactory<DartController> weak_factory_; | 65 base::WeakPtrFactory<DartController> weak_factory_; |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(DartController); | 67 DISALLOW_COPY_AND_ASSIGN(DartController); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 } | 70 } |
| 69 | 71 |
| 70 #endif // SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ | 72 #endif // SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ |
| OLD | NEW |