| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SKY_ENGINE_CORE_APP_ABSTRACTMODULE_H_ | |
| 6 #define SKY_ENGINE_CORE_APP_ABSTRACTMODULE_H_ | |
| 7 | |
| 8 #include "sky/engine/core/dom/ContextLifecycleObserver.h" | |
| 9 #include "sky/engine/core/dom/Document.h" | |
| 10 #include "sky/engine/core/events/EventTarget.h" | |
| 11 #include "sky/engine/wtf/RefCounted.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 class Application; | |
| 15 | |
| 16 class LibraryEntry { | |
| 17 public: | |
| 18 LibraryEntry(PassRefPtr<DartValue> library, TextPosition position) | |
| 19 : dart_library_(library), text_position_(position) {} | |
| 20 | |
| 21 DartValue* library() const { return dart_library_.get(); } | |
| 22 const TextPosition& position() const { return text_position_; } | |
| 23 | |
| 24 private: | |
| 25 RefPtr<DartValue> dart_library_; | |
| 26 TextPosition text_position_; | |
| 27 }; | |
| 28 | |
| 29 class AbstractModule : public RefCounted<AbstractModule>, | |
| 30 public EventTargetWithInlineData, | |
| 31 public ContextLifecycleObserver { | |
| 32 REFCOUNTED_EVENT_TARGET(AbstractModule); | |
| 33 public: | |
| 34 virtual ~AbstractModule(); | |
| 35 | |
| 36 Document* document() const { return document_.get(); } | |
| 37 const String& url() const { return url_; } | |
| 38 | |
| 39 virtual bool isApplication() const { return false; } | |
| 40 | |
| 41 String UrlForLibraryAt(TextPosition); | |
| 42 | |
| 43 void AddLibrary(RefPtr<DartValue> library, TextPosition position); | |
| 44 const Vector<LibraryEntry>& libraries() const { return libraries_; } | |
| 45 | |
| 46 protected: | |
| 47 AbstractModule(ExecutionContext*, PassRefPtr<Document>, const String& url); | |
| 48 | |
| 49 virtual Application* GetApplication() = 0; | |
| 50 | |
| 51 private: | |
| 52 ExecutionContext* executionContext() const override; | |
| 53 | |
| 54 RefPtr<Document> document_; | |
| 55 String url_; | |
| 56 Vector<LibraryEntry> libraries_; | |
| 57 }; | |
| 58 | |
| 59 } // namespace blink | |
| 60 | |
| 61 #endif // SKY_ENGINE_CORE_APP_ABSTRACTMODULE_H_ | |
| OLD | NEW |