James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 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 | |
Scott Violet | bc1184a | 2014-12-16 08:55:34 -0800 | [diff] [blame] | 5 | #ifndef SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ |
| 6 | #define SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "base/memory/scoped_ptr.h" |
Przemysław Pietrzkiewicz | 6384d09 | 2015-01-15 16:03:17 -0800 | [diff] [blame] | 10 | #include "shell/application_manager/application_loader.h" |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 11 | |
Scott Violet | bc1184a | 2014-12-16 08:55:34 -0800 | [diff] [blame] | 12 | namespace base { |
| 13 | class MessageLoop; |
| 14 | } |
| 15 | |
Viet-Trung Luu | 36faa4d | 2015-03-04 18:08:18 -0800 | [diff] [blame] | 16 | namespace shell { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 17 | |
| 18 | class ApplicationManager; |
| 19 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 20 | // ApplicationLoader implementation that creates a background thread and issues |
| 21 | // load |
| 22 | // requests there. |
| 23 | class UIApplicationLoader : public ApplicationLoader { |
| 24 | public: |
| 25 | UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, |
Scott Violet | bc1184a | 2014-12-16 08:55:34 -0800 | [diff] [blame] | 26 | base::MessageLoop* ui_message_loop); |
James Robinson | e1b30cf | 2014-10-21 12:25:40 -0700 | [diff] [blame] | 27 | ~UIApplicationLoader() override; |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 28 | |
| 29 | // ApplicationLoader overrides: |
Viet-Trung Luu | bd07e3a | 2015-04-09 12:43:29 -0700 | [diff] [blame] | 30 | void Load( |
| 31 | const GURL& url, |
| 32 | mojo::InterfaceRequest<mojo::Application> application_request) override; |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | class UILoader; |
| 36 | |
| 37 | // These functions are exected on the background thread. They call through |
Benjamin Lerman | bbc0e08 | 2016-05-23 11:28:48 +0200 | [diff] [blame] | 38 | // to |loader_| to do the actual loading. |
Viet-Trung Luu | bd07e3a | 2015-04-09 12:43:29 -0700 | [diff] [blame] | 39 | void LoadOnUIThread( |
| 40 | const GURL& url, |
| 41 | mojo::InterfaceRequest<mojo::Application> application_request); |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 42 | void ShutdownOnUIThread(); |
| 43 | |
| 44 | scoped_ptr<ApplicationLoader> loader_; |
Scott Violet | bc1184a | 2014-12-16 08:55:34 -0800 | [diff] [blame] | 45 | base::MessageLoop* ui_message_loop_; |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 46 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 47 | DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); |
| 48 | }; |
| 49 | |
Viet-Trung Luu | 36faa4d | 2015-03-04 18:08:18 -0800 | [diff] [blame] | 50 | } // namespace shell |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 51 | |
Scott Violet | bc1184a | 2014-12-16 08:55:34 -0800 | [diff] [blame] | 52 | #endif // SHELL_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ |