| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ | 5 #ifndef MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ |
| 6 #define MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ | 6 #define MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "mojo/application_manager/application_loader.h" | 10 #include "mojo/application_manager/application_loader.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // requests there. | 22 // requests there. |
| 23 class UIApplicationLoader : public ApplicationLoader { | 23 class UIApplicationLoader : public ApplicationLoader { |
| 24 public: | 24 public: |
| 25 UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, | 25 UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, |
| 26 shell::Context* context); | 26 shell::Context* context); |
| 27 ~UIApplicationLoader() override; | 27 ~UIApplicationLoader() override; |
| 28 | 28 |
| 29 // ApplicationLoader overrides: | 29 // ApplicationLoader overrides: |
| 30 void Load(ApplicationManager* manager, | 30 void Load(ApplicationManager* manager, |
| 31 const GURL& url, | 31 const GURL& url, |
| 32 ScopedMessagePipeHandle shell_handle, |
| 32 scoped_refptr<LoadCallbacks> callbacks) override; | 33 scoped_refptr<LoadCallbacks> callbacks) override; |
| 33 void OnApplicationError(ApplicationManager* manager, | 34 void OnApplicationError(ApplicationManager* manager, |
| 34 const GURL& url) override; | 35 const GURL& url) override; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 class UILoader; | 38 class UILoader; |
| 38 | 39 |
| 39 // These functions are exected on the background thread. They call through | 40 // These functions are exected on the background thread. They call through |
| 40 // to |background_loader_| to do the actual loading. | 41 // to |background_loader_| to do the actual loading. |
| 41 // TODO: having this code take a |manager| is fragile (as ApplicationManager | 42 // TODO: having this code take a |manager| is fragile (as ApplicationManager |
| 42 // isn't thread safe). | 43 // isn't thread safe). |
| 43 void LoadOnUIThread(ApplicationManager* manager, | 44 void LoadOnUIThread(ApplicationManager* manager, |
| 44 const GURL& url, | 45 const GURL& url, |
| 45 ScopedMessagePipeHandle* shell_handle); | 46 ScopedMessagePipeHandle shell_handle); |
| 46 void OnApplicationErrorOnUIThread(ApplicationManager* manager, | 47 void OnApplicationErrorOnUIThread(ApplicationManager* manager, |
| 47 const GURL& url); | 48 const GURL& url); |
| 48 void ShutdownOnUIThread(); | 49 void ShutdownOnUIThread(); |
| 49 | 50 |
| 50 scoped_ptr<ApplicationLoader> loader_; | 51 scoped_ptr<ApplicationLoader> loader_; |
| 51 shell::Context* context_; | 52 shell::Context* context_; |
| 52 | 53 |
| 53 // Lives on the UI thread. Trivial interface that calls through to |loader_|. | |
| 54 UILoader* ui_loader_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); | 54 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 } // namespace mojo | 57 } // namespace mojo |
| 60 | 58 |
| 61 #endif // MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ | 59 #endif // MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ |
| OLD | NEW |