| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SHELL_CONTEXT_H_ | 5 #ifndef SHELL_CONTEXT_H_ |
| 6 #define SHELL_CONTEXT_H_ | 6 #define SHELL_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mojo/application_manager/application_manager.h" | 11 #include "mojo/application_manager/application_manager.h" |
| 12 #include "shell/mojo_url_resolver.h" | 12 #include "shell/mojo_url_resolver.h" |
| 13 #include "shell/task_runners.h" | 13 #include "shell/task_runners.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | |
| 16 #include "base/android/scoped_java_ref.h" | |
| 17 #endif // defined(OS_ANDROID) | |
| 18 | |
| 19 namespace mojo { | 15 namespace mojo { |
| 20 | 16 |
| 21 class Spy; | 17 class Spy; |
| 22 | 18 |
| 23 namespace shell { | 19 namespace shell { |
| 24 | 20 |
| 25 class DynamicApplicationLoader; | 21 class DynamicApplicationLoader; |
| 26 class ExternalApplicationListener; | 22 class ExternalApplicationListener; |
| 27 | 23 |
| 28 // The "global" context for the shell's main process. | 24 // The "global" context for the shell's main process. |
| 29 class Context : ApplicationManager::Delegate { | 25 class Context : ApplicationManager::Delegate { |
| 30 public: | 26 public: |
| 31 Context(); | 27 Context(); |
| 32 ~Context() override; | 28 ~Context() override; |
| 33 | 29 |
| 34 static void EnsureEmbedderIsInitialized(); | 30 static void EnsureEmbedderIsInitialized(); |
| 35 bool Init(); | 31 bool Init(); |
| 36 | 32 |
| 37 void Run(const GURL& url); | 33 void Run(const GURL& url); |
| 38 ScopedMessagePipeHandle ConnectToServiceByName( | 34 ScopedMessagePipeHandle ConnectToServiceByName( |
| 39 const GURL& application_url, | 35 const GURL& application_url, |
| 40 const std::string& service_name); | 36 const std::string& service_name); |
| 41 | 37 |
| 42 TaskRunners* task_runners() { return task_runners_.get(); } | 38 TaskRunners* task_runners() { return task_runners_.get(); } |
| 43 ApplicationManager* application_manager() { return &application_manager_; } | 39 ApplicationManager* application_manager() { return &application_manager_; } |
| 44 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } | 40 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } |
| 45 | 41 |
| 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) | |
| 50 | |
| 51 private: | 42 private: |
| 52 class NativeViewportApplicationLoader; | 43 class NativeViewportApplicationLoader; |
| 53 | 44 |
| 54 // ApplicationManager::Delegate override. | 45 // ApplicationManager::Delegate override. |
| 55 void OnApplicationError(const GURL& url) override; | 46 void OnApplicationError(const GURL& url) override; |
| 56 GURL ResolveURL(const GURL& url) override; | 47 GURL ResolveURL(const GURL& url) override; |
| 57 | 48 |
| 58 std::set<GURL> app_urls_; | 49 std::set<GURL> app_urls_; |
| 59 scoped_ptr<TaskRunners> task_runners_; | 50 scoped_ptr<TaskRunners> task_runners_; |
| 60 scoped_ptr<ExternalApplicationListener> listener_; | 51 scoped_ptr<ExternalApplicationListener> listener_; |
| 61 ApplicationManager application_manager_; | 52 ApplicationManager application_manager_; |
| 62 MojoURLResolver mojo_url_resolver_; | 53 MojoURLResolver mojo_url_resolver_; |
| 63 scoped_ptr<Spy> spy_; | 54 scoped_ptr<Spy> spy_; |
| 64 #if defined(OS_ANDROID) | |
| 65 base::MessageLoop* ui_loop_; | |
| 66 #endif // defined(OS_ANDROID) | |
| 67 | 55 |
| 68 DISALLOW_COPY_AND_ASSIGN(Context); | 56 DISALLOW_COPY_AND_ASSIGN(Context); |
| 69 }; | 57 }; |
| 70 | 58 |
| 71 } // namespace shell | 59 } // namespace shell |
| 72 } // namespace mojo | 60 } // namespace mojo |
| 73 | 61 |
| 74 #endif // SHELL_CONTEXT_H_ | 62 #endif // SHELL_CONTEXT_H_ |
| OLD | NEW |