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 "sky/engine/wtf/OwnPtr.h" | 12 #include "sky/engine/wtf/OwnPtr.h" |
13 #include "sky/engine/wtf/text/AtomicString.h" | 13 #include "sky/engine/wtf/text/AtomicString.h" |
14 #include "sky/engine/wtf/text/TextPosition.h" | 14 #include "sky/engine/wtf/text/TextPosition.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 class AbstractModule; | 17 class AbstractModule; |
18 class BuiltinSky; | 18 class BuiltinSky; |
19 class DOMDartState; | 19 class DOMDartState; |
20 class DartValue; | 20 class DartValue; |
21 class HTMLScriptElement; | 21 class HTMLScriptElement; |
22 class KURL; | 22 class KURL; |
| 23 class View; |
23 | 24 |
24 class DartController { | 25 class DartController { |
25 public: | 26 public: |
26 DartController(); | 27 DartController(); |
27 ~DartController(); | 28 ~DartController(); |
28 | 29 |
29 static void InitVM(); | 30 static void InitVM(); |
30 | 31 |
31 typedef base::Callback<void(RefPtr<AbstractModule>, RefPtr<DartValue>)> | 32 typedef base::Callback<void(RefPtr<AbstractModule>, RefPtr<DartValue>)> |
32 LoadFinishedCallback; | 33 LoadFinishedCallback; |
33 | 34 |
34 void LoadMainLibrary(const KURL& url); | 35 void LoadMainLibrary(const KURL& url); |
35 | 36 |
36 void LoadScriptInModule(AbstractModule* module, | 37 void LoadScriptInModule(AbstractModule* module, |
37 const String& source, | 38 const String& source, |
38 const TextPosition& textPosition, | 39 const TextPosition& textPosition, |
39 const LoadFinishedCallback& load_finished_callback); | 40 const LoadFinishedCallback& load_finished_callback); |
40 void ExecuteLibraryInModule(AbstractModule* module, | 41 void ExecuteLibraryInModule(AbstractModule* module, |
41 Dart_Handle library, | 42 Dart_Handle library, |
42 HTMLScriptElement* script); | 43 HTMLScriptElement* script); |
43 | 44 |
44 void ClearForClose(); | 45 void ClearForClose(); |
45 void CreateIsolateFor(PassOwnPtr<DOMDartState> dom_dart_state, | 46 void CreateIsolateFor(PassOwnPtr<DOMDartState> dom_dart_state, |
46 const KURL& url); | 47 const KURL& url); |
| 48 void InstallView(View* view); |
47 | 49 |
48 DOMDartState* dart_state() const { return dom_dart_state_.get(); } | 50 DOMDartState* dart_state() const { return dom_dart_state_.get(); } |
49 | 51 |
50 private: | 52 private: |
51 bool ImportChildLibraries(AbstractModule* module, Dart_Handle library); | 53 bool ImportChildLibraries(AbstractModule* module, Dart_Handle library); |
52 Dart_Handle CreateLibrary(AbstractModule* module, | 54 Dart_Handle CreateLibrary(AbstractModule* module, |
53 const String& source, | 55 const String& source, |
54 const TextPosition& position); | 56 const TextPosition& position); |
55 | 57 |
56 void DidLoadMainLibrary(KURL url); | 58 void DidLoadMainLibrary(KURL url); |
57 | 59 |
58 OwnPtr<DOMDartState> dom_dart_state_; | 60 OwnPtr<DOMDartState> dom_dart_state_; |
59 OwnPtr<BuiltinSky> builtin_sky_; | 61 OwnPtr<BuiltinSky> builtin_sky_; |
60 | 62 |
61 base::WeakPtrFactory<DartController> weak_factory_; | 63 base::WeakPtrFactory<DartController> weak_factory_; |
62 | 64 |
63 DISALLOW_COPY_AND_ASSIGN(DartController); | 65 DISALLOW_COPY_AND_ASSIGN(DartController); |
64 }; | 66 }; |
65 | 67 |
66 } | 68 } |
67 | 69 |
68 #endif // SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ | 70 #endif // SKY_ENGINE_CORE_SCRIPT_DART_CONTROLLER_H_ |
OLD | NEW |