| 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 SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ | |
| 6 #define SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "mojo/shell/application_manager/application_loader.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class MessageLoop; | |
| 14 } | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace shell { | |
| 18 | |
| 19 class ApplicationManager; | |
| 20 | |
| 21 // ApplicationLoader implementation that creates a background thread and issues | |
| 22 // load | |
| 23 // requests there. | |
| 24 class UIApplicationLoader : public ApplicationLoader { | |
| 25 public: | |
| 26 UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, | |
| 27 base::MessageLoop* ui_message_loop); | |
| 28 ~UIApplicationLoader() override; | |
| 29 | |
| 30 // ApplicationLoader overrides: | |
| 31 void Load(const GURL& url, | |
| 32 InterfaceRequest<Application> application_request) override; | |
| 33 | |
| 34 private: | |
| 35 class UILoader; | |
| 36 | |
| 37 // These functions are exected on the background thread. They call through | |
| 38 // to |background_loader_| to do the actual loading. | |
| 39 // TODO: having this code take a |manager| is fragile (as ApplicationManager | |
| 40 // isn't thread safe). | |
| 41 void LoadOnUIThread(const GURL& url, | |
| 42 InterfaceRequest<Application> application_request); | |
| 43 void ShutdownOnUIThread(); | |
| 44 | |
| 45 scoped_ptr<ApplicationLoader> loader_; | |
| 46 base::MessageLoop* ui_message_loop_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); | |
| 49 }; | |
| 50 | |
| 51 } // namespace shell | |
| 52 } // namespace mojo | |
| 53 | |
| 54 #endif // SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ | |
| OLD | NEW |