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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "mojo/application_manager/application_loader.h" | 10 #include "mojo/application_manager/application_loader.h" |
10 | 11 |
11 namespace mojo { | 12 namespace mojo { |
12 | 13 |
13 class ApplicationManager; | 14 class ApplicationManager; |
14 | 15 |
15 namespace shell { | 16 namespace shell { |
16 class Context; | 17 class Context; |
17 } | 18 } |
18 | 19 |
19 // ApplicationLoader implementation that creates a background thread and issues | 20 // ApplicationLoader implementation that creates a background thread and issues |
20 // load | 21 // load |
21 // requests there. | 22 // requests there. |
22 class UIApplicationLoader : public ApplicationLoader { | 23 class UIApplicationLoader : public ApplicationLoader { |
23 public: | 24 public: |
24 UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, | 25 UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, |
25 shell::Context* context); | 26 shell::Context* context); |
26 virtual ~UIApplicationLoader(); | 27 virtual ~UIApplicationLoader(); |
27 | 28 |
28 // ApplicationLoader overrides: | 29 // ApplicationLoader overrides: |
29 virtual void Load(ApplicationManager* manager, | 30 virtual void Load(ApplicationManager* manager, |
30 const GURL& url, | 31 const GURL& url, |
31 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE; | 32 scoped_refptr<LoadCallbacks> callbacks) override; |
32 virtual void OnApplicationError(ApplicationManager* manager, | 33 virtual void OnApplicationError(ApplicationManager* manager, |
33 const GURL& url) OVERRIDE; | 34 const GURL& url) override; |
34 | 35 |
35 private: | 36 private: |
36 class UILoader; | 37 class UILoader; |
37 | 38 |
38 // These functions are exected on the background thread. They call through | 39 // These functions are exected on the background thread. They call through |
39 // to |background_loader_| to do the actual loading. | 40 // to |background_loader_| to do the actual loading. |
40 // TODO: having this code take a |manager| is fragile (as ApplicationManager | 41 // TODO: having this code take a |manager| is fragile (as ApplicationManager |
41 // isn't thread safe). | 42 // isn't thread safe). |
42 void LoadOnUIThread(ApplicationManager* manager, | 43 void LoadOnUIThread(ApplicationManager* manager, |
43 const GURL& url, | 44 const GURL& url, |
44 ScopedMessagePipeHandle* shell_handle); | 45 ScopedMessagePipeHandle* shell_handle); |
45 void OnApplicationErrorOnUIThread(ApplicationManager* manager, | 46 void OnApplicationErrorOnUIThread(ApplicationManager* manager, |
46 const GURL& url); | 47 const GURL& url); |
47 void ShutdownOnUIThread(); | 48 void ShutdownOnUIThread(); |
48 | 49 |
49 scoped_ptr<ApplicationLoader> loader_; | 50 scoped_ptr<ApplicationLoader> loader_; |
50 shell::Context* context_; | 51 shell::Context* context_; |
51 | 52 |
52 // Lives on the UI thread. Trivial interface that calls through to |loader_|. | 53 // Lives on the UI thread. Trivial interface that calls through to |loader_|. |
53 UILoader* ui_loader_; | 54 UILoader* ui_loader_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); | 56 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); |
56 }; | 57 }; |
57 | 58 |
58 } // namespace mojo | 59 } // namespace mojo |
59 | 60 |
60 #endif // MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ | 61 #endif // MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_ |
OLD | NEW |