1 // Copyright 2013 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_CONTEXT_H_
6 #define MOJO_SHELL_CONTEXT_H_
10 #include "mojo/application_manager/application_manager.h"
11 #include "mojo/shell/mojo_url_resolver.h"
12 #include "mojo/shell/task_runners.h"
14 #if defined(OS_ANDROID)
15 #include "base/android/scoped_java_ref.h"
16 #endif // defined(OS_ANDROID)
24 class DynamicApplicationLoader
;
26 // The "global" context for the shell's main process.
27 class Context
: ApplicationManager::Delegate
{
34 // ApplicationManager::Delegate override.
35 virtual void OnApplicationError(const GURL
& gurl
) OVERRIDE
;
37 void Run(const GURL
& url
);
38 ScopedMessagePipeHandle
ConnectToServiceByName(
39 const GURL
& application_url
,
40 const std::string
& service_name
);
42 TaskRunners
* task_runners() { return task_runners_
.get(); }
43 ApplicationManager
* application_manager() { return &application_manager_
; }
44 MojoURLResolver
* mojo_url_resolver() { return &mojo_url_resolver_
; }
46 #if defined(OS_ANDROID)
47 base::MessageLoop
* ui_loop() const { return ui_loop_
; }
48 void set_ui_loop(base::MessageLoop
* ui_loop
) { ui_loop_
= ui_loop
; }
49 #endif // defined(OS_ANDROID)
52 class NativeViewportApplicationLoader
;
54 std::set
<GURL
> app_urls_
;
55 scoped_ptr
<TaskRunners
> task_runners_
;
56 ApplicationManager application_manager_
;
57 MojoURLResolver mojo_url_resolver_
;
59 #if defined(OS_ANDROID)
60 base::MessageLoop
* ui_loop_
;
61 #endif // defined(OS_ANDROID)
63 DISALLOW_COPY_AND_ASSIGN(Context
);
69 #endif // MOJO_SHELL_CONTEXT_H_