Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2012)

Unified Diff: sky/engine/core/app/ModuleLoader.h

Issue 720903002: Script-based imports should basically work (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/core/app/ModuleLoader.h
diff --git a/sky/engine/core/app/ModuleLoader.h b/sky/engine/core/app/ModuleLoader.h
new file mode 100644
index 0000000000000000000000000000000000000000..ac5a9dfeaf283033d224da25c9cc7121ddd0df6c
--- /dev/null
+++ b/sky/engine/core/app/ModuleLoader.h
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKY_ENGINE_CORE_APP_MODULE_LOADER_H_
+#define SKY_ENGINE_CORE_APP_MODULE_LOADER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "platform/fetcher/MojoFetcher.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+class Application;
+class Document;
+class Module;
+
+class ModuleLoader : public MojoFetcher::Client {
+ public:
+ class Client {
+ public:
+ virtual void OnModuleLoadComplete(ModuleLoader*, Module*) = 0;
+
+ protected:
+ virtual ~Client();
+ };
+
+ enum State {
+ LOADING,
+ COMPLETE,
+ };
+
+ ModuleLoader(Client*, Application*, const KURL&);
+ ~ModuleLoader();
+
+ State state() const { return state_; }
+ Module* module() const { return module_.get(); }
+
+ private:
+ // MojoFetcher::Client
+ void OnReceivedResponse(mojo::URLResponsePtr) override;
+
+ void OnParsingComplete();
+
+ State state_;
+ Client* client_;
+ Application* application_;
+ OwnPtr<MojoFetcher> fetcher_;
+ RefPtr<Module> module_;
+
+ base::WeakPtrFactory<ModuleLoader> weak_factory_;
+};
+
+} // namespace blink
+
+#endif // SKY_ENGINE_CORE_APP_MODULE_LOADER_H_

Powered by Google App Engine
This is Rietveld 408576698