OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 5 #ifndef MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
6 #define MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 6 #define MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
12 #include "mojo/service_manager/service_loader.h" | 12 #include "mojo/service_manager/service_loader.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 // TODO(tim): Eventually this should be Android-only to support services | 16 // TODO(tim): Eventually this should be Android-only to support services |
17 // that we need to bundle with the shell (such as NetworkService). Perhaps | 17 // that we need to bundle with the shell (such as NetworkService). Perhaps |
18 // we should move it to shell/ as well. | 18 // we should move it to shell/ as well. |
19 class MOJO_SERVICE_MANAGER_EXPORT BackgroundShellServiceLoader : | 19 class MOJO_SERVICE_MANAGER_EXPORT BackgroundShellServiceLoader : |
20 public ServiceLoader, | 20 public ServiceLoader, |
21 public base::DelegateSimpleThread::Delegate { | 21 public base::DelegateSimpleThread::Delegate { |
22 public: | 22 public: |
23 BackgroundShellServiceLoader(scoped_ptr<ServiceLoader> real_loader, | 23 BackgroundShellServiceLoader(scoped_ptr<ServiceLoader> real_loader, |
24 const std::string& thread_name, | 24 const std::string& thread_name, |
25 base::MessageLoop::Type message_loop_type); | 25 base::MessageLoop::Type message_loop_type); |
26 virtual ~BackgroundShellServiceLoader(); | 26 virtual ~BackgroundShellServiceLoader(); |
27 | 27 |
28 // ServiceLoader overrides: | 28 // ServiceLoader overrides: |
29 virtual void LoadService(ServiceManager* manager, | 29 virtual void LoadService( |
30 const GURL& url, | 30 ServiceManager* manager, |
31 ScopedMessagePipeHandle shell_handle) OVERRIDE; | 31 const GURL& url, |
| 32 scoped_refptr<LoadServiceCallbacks> callbacks) OVERRIDE; |
32 virtual void OnServiceError(ServiceManager* manager, | 33 virtual void OnServiceError(ServiceManager* manager, |
33 const GURL& url) OVERRIDE; | 34 const GURL& url) OVERRIDE; |
34 | 35 |
35 // Post a task to quit the MessageLoop we are running for the app when we | 36 // Post a task to quit the MessageLoop we are running for the app when we |
36 // are destroyed. Most apps should quit themselves and not need this. | 37 // are destroyed. Most apps should quit themselves and not need this. |
37 // TODO(tim): Remove this method once applications are smart enough | 38 // TODO(tim): Remove this method once applications are smart enough |
38 // to quit themselves. Bug 394477. | 39 // to quit themselves. Bug 394477. |
39 void set_quit_on_shutdown() { quit_on_shutdown_ = true; } | 40 void set_quit_on_shutdown() { quit_on_shutdown_ = true; } |
40 | 41 |
41 private: | 42 private: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 // Lives on |thread_|. Trivial interface that calls through to |loader_|. | 76 // Lives on |thread_|. Trivial interface that calls through to |loader_|. |
76 BackgroundLoader* background_loader_; | 77 BackgroundLoader* background_loader_; |
77 | 78 |
78 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); | 79 DISALLOW_COPY_AND_ASSIGN(BackgroundShellServiceLoader); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace mojo | 82 } // namespace mojo |
82 | 83 |
83 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ | 84 #endif // MOJO_SERVICE_MANAGER_BACKGROUND_SHELL_SERVICE_LOADER_H_ |
OLD | NEW |