Standardize usage of virtual/override/final in mojo/
[chromium-blink-merge.git] / mojo / shell / context.h
blob5b559101c662bbd2efa8c5061be4d12c57d60f23
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_
8 #include <string>
10 #include "base/macros.h"
11 #include "mojo/application_manager/application_manager.h"
12 #include "mojo/shell/mojo_url_resolver.h"
13 #include "mojo/shell/task_runners.h"
15 #if defined(OS_ANDROID)
16 #include "base/android/scoped_java_ref.h"
17 #endif // defined(OS_ANDROID)
19 namespace mojo {
21 class Spy;
23 namespace shell {
25 class DynamicApplicationLoader;
26 class ExternalApplicationListener;
28 // The "global" context for the shell's main process.
29 class Context : ApplicationManager::Delegate {
30 public:
31 Context();
32 ~Context() override;
34 void Init();
36 // ApplicationManager::Delegate override.
37 void OnApplicationError(const GURL& gurl) override;
39 void Run(const GURL& url);
40 ScopedMessagePipeHandle ConnectToServiceByName(
41 const GURL& application_url,
42 const std::string& service_name);
44 TaskRunners* task_runners() { return task_runners_.get(); }
45 ApplicationManager* application_manager() { return &application_manager_; }
46 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; }
48 #if defined(OS_ANDROID)
49 base::MessageLoop* ui_loop() const { return ui_loop_; }
50 void set_ui_loop(base::MessageLoop* ui_loop) { ui_loop_ = ui_loop; }
51 #endif // defined(OS_ANDROID)
53 private:
54 class NativeViewportApplicationLoader;
56 std::set<GURL> app_urls_;
57 scoped_ptr<TaskRunners> task_runners_;
58 scoped_ptr<ExternalApplicationListener> listener_;
59 ApplicationManager application_manager_;
60 MojoURLResolver mojo_url_resolver_;
61 scoped_ptr<Spy> spy_;
62 #if defined(OS_ANDROID)
63 base::MessageLoop* ui_loop_;
64 #endif // defined(OS_ANDROID)
66 DISALLOW_COPY_AND_ASSIGN(Context);
69 } // namespace shell
70 } // namespace mojo
72 #endif // MOJO_SHELL_CONTEXT_H_