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.
5 #ifndef MOJO_RUNNER_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_
6 #define MOJO_RUNNER_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/shell/application_loader.h"
19 class ApplicationManager
;
21 // ApplicationLoader implementation that creates a background thread and issues
24 class UIApplicationLoader
: public shell::ApplicationLoader
{
26 UIApplicationLoader(scoped_ptr
<ApplicationLoader
> real_loader
,
27 base::MessageLoop
* ui_message_loop
);
28 ~UIApplicationLoader() override
;
30 // ApplicationLoader overrides:
31 void Load(const GURL
& url
,
32 InterfaceRequest
<Application
> application_request
) override
;
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();
45 scoped_ptr
<ApplicationLoader
> loader_
;
46 base::MessageLoop
* ui_message_loop_
;
48 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader
);
54 #endif // MOJO_RUNNER_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_