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_SHELL_UI_APPLICATION_LOADER_ANDROID_H_
6 #define MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/application_manager/application_loader.h"
13 class ApplicationManager
;
19 // ApplicationLoader implementation that creates a background thread and issues
22 class UIApplicationLoader
: public ApplicationLoader
{
24 UIApplicationLoader(scoped_ptr
<ApplicationLoader
> real_loader
,
25 shell::Context
* context
);
26 virtual ~UIApplicationLoader();
28 // ApplicationLoader overrides:
29 virtual void Load(ApplicationManager
* manager
,
31 scoped_refptr
<LoadCallbacks
> callbacks
) OVERRIDE
;
32 virtual void OnApplicationError(ApplicationManager
* manager
,
33 const GURL
& url
) OVERRIDE
;
38 // These functions are exected on the background thread. They call through
39 // to |background_loader_| to do the actual loading.
40 // TODO: having this code take a |manager| is fragile (as ApplicationManager
41 // isn't thread safe).
42 void LoadOnUIThread(ApplicationManager
* manager
,
44 ScopedMessagePipeHandle
* shell_handle
);
45 void OnApplicationErrorOnUIThread(ApplicationManager
* manager
,
47 void ShutdownOnUIThread();
49 scoped_ptr
<ApplicationLoader
> loader_
;
50 shell::Context
* context_
;
52 // Lives on the UI thread. Trivial interface that calls through to |loader_|.
55 DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader
);
60 #endif // MOJO_SHELL_UI_APPLICATION_LOADER_ANDROID_H_