Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: mojo/shell/context.h

Issue 491443005: Get rid of KeepAlive. Quit shell when all urls run directly by Context are closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring back ConnectToServiceViaNetwork Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 MOJO_SHELL_CONTEXT_H_ 5 #ifndef MOJO_SHELL_CONTEXT_H_
6 #define MOJO_SHELL_CONTEXT_H_ 6 #define MOJO_SHELL_CONTEXT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "mojo/application_manager/application_manager.h" 10 #include "mojo/application_manager/application_manager.h"
11 #include "mojo/shell/keep_alive.h"
12 #include "mojo/shell/mojo_url_resolver.h" 11 #include "mojo/shell/mojo_url_resolver.h"
13 #include "mojo/shell/task_runners.h" 12 #include "mojo/shell/task_runners.h"
14 13
15 #if defined(OS_ANDROID) 14 #if defined(OS_ANDROID)
16 #include "base/android/scoped_java_ref.h" 15 #include "base/android/scoped_java_ref.h"
17 #endif // defined(OS_ANDROID) 16 #endif // defined(OS_ANDROID)
18 17
19 namespace mojo { 18 namespace mojo {
20 19
21 class Spy; 20 class Spy;
22 21
23 namespace shell { 22 namespace shell {
24 23
25 class DynamicApplicationLoader; 24 class DynamicApplicationLoader;
26 25
27 // The "global" context for the shell's main process. 26 // The "global" context for the shell's main process.
28 class Context { 27 class Context : ApplicationManager::Delegate {
29 public: 28 public:
30 Context(); 29 Context();
31 ~Context(); 30 virtual ~Context();
32 31
33 void Init(); 32 void Init();
34 33
34 // ApplicationManager::Delegate override.
35 virtual void OnServiceError(const GURL& gurl) OVERRIDE;
36
37 void Run(const GURL& url);
38 ScopedMessagePipeHandle ConnectToServiceByName(
39 const GURL& application_url,
tim (not reviewing) 2014/08/23 00:14:27 nit - indent two more spaces.
DaveMoore 2014/08/24 22:31:11 Done.
40 const std::string& service_name);
41
35 TaskRunners* task_runners() { return task_runners_.get(); } 42 TaskRunners* task_runners() { return task_runners_.get(); }
36 ApplicationManager* application_manager() { return &application_manager_; } 43 ApplicationManager* application_manager() { return &application_manager_; }
37 KeepAliveCounter* keep_alive_counter() { return &keep_alive_counter_; }
38 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } 44 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; }
39 45
40 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
41 base::MessageLoop* ui_loop() const { return ui_loop_; } 47 base::MessageLoop* ui_loop() const { return ui_loop_; }
42 void set_ui_loop(base::MessageLoop* ui_loop) { ui_loop_ = ui_loop; } 48 void set_ui_loop(base::MessageLoop* ui_loop) { ui_loop_ = ui_loop; }
43 #endif // defined(OS_ANDROID) 49 #endif // defined(OS_ANDROID)
44 50
45 private: 51 private:
46 class NativeViewportApplicationLoader; 52 class NativeViewportApplicationLoader;
47 53
54 std::set<GURL> app_urls_;
48 scoped_ptr<TaskRunners> task_runners_; 55 scoped_ptr<TaskRunners> task_runners_;
49 ApplicationManager application_manager_; 56 ApplicationManager application_manager_;
50 MojoURLResolver mojo_url_resolver_; 57 MojoURLResolver mojo_url_resolver_;
51 scoped_ptr<Spy> spy_; 58 scoped_ptr<Spy> spy_;
52 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
53 base::MessageLoop* ui_loop_; 60 base::MessageLoop* ui_loop_;
54 #endif // defined(OS_ANDROID) 61 #endif // defined(OS_ANDROID)
55 62
56 KeepAliveCounter keep_alive_counter_;
57
58 DISALLOW_COPY_AND_ASSIGN(Context); 63 DISALLOW_COPY_AND_ASSIGN(Context);
59 }; 64 };
60 65
61 } // namespace shell 66 } // namespace shell
62 } // namespace mojo 67 } // namespace mojo
63 68
64 #endif // MOJO_SHELL_CONTEXT_H_ 69 #endif // MOJO_SHELL_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698