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_MODULE_LOADER_H_ |
| 6 #define SKY_ENGINE_CORE_APP_MODULE_LOADER_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "platform/fetcher/MojoFetcher.h" |
| 10 #include "wtf/OwnPtr.h" |
| 11 #include "wtf/RefCounted.h" |
| 12 #include "wtf/RefPtr.h" |
| 13 |
| 14 namespace blink { |
| 15 class Application; |
| 16 class Document; |
| 17 class Module; |
| 18 |
| 19 class ModuleLoader : public MojoFetcher::Client { |
| 20 public: |
| 21 class Client { |
| 22 public: |
| 23 virtual void OnModuleLoadComplete(ModuleLoader*, Module*) = 0; |
| 24 |
| 25 protected: |
| 26 virtual ~Client(); |
| 27 }; |
| 28 |
| 29 enum State { |
| 30 LOADING, |
| 31 COMPLETE, |
| 32 }; |
| 33 |
| 34 ModuleLoader(Client*, Application*, const KURL&); |
| 35 ~ModuleLoader(); |
| 36 |
| 37 State state() const { return state_; } |
| 38 Module* module() const { return module_.get(); } |
| 39 |
| 40 private: |
| 41 // MojoFetcher::Client |
| 42 void OnReceivedResponse(mojo::URLResponsePtr) override; |
| 43 |
| 44 void OnParsingComplete(); |
| 45 |
| 46 State state_; |
| 47 Client* client_; |
| 48 Application* application_; |
| 49 OwnPtr<MojoFetcher> fetcher_; |
| 50 RefPtr<Module> module_; |
| 51 |
| 52 base::WeakPtrFactory<ModuleLoader> weak_factory_; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // SKY_ENGINE_CORE_APP_MODULE_LOADER_H_ |
OLD | NEW |