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/edk/embedder/master_process_delegate.h" | 11 #include "mojo/edk/embedder/master_process_delegate.h" |
12 #include "shell/application_manager/application_manager.h" | 12 #include "shell/application_manager/application_manager.h" |
13 #include "shell/task_runners.h" | 13 #include "shell/task_runners.h" |
14 #include "shell/url_resolver.h" | 14 #include "shell/url_resolver.h" |
15 | 15 |
| 16 namespace mojo { |
| 17 class URLResponseDiskCacheDelegate; |
| 18 } |
| 19 |
16 namespace shell { | 20 namespace shell { |
17 class Tracer; | 21 class Tracer; |
18 | 22 |
19 // The "global" context for the shell's main process. | 23 // The "global" context for the shell's main process. |
20 class Context : public ApplicationManager::Delegate, | 24 class Context : public ApplicationManager::Delegate, |
21 public mojo::embedder::MasterProcessDelegate { | 25 public mojo::embedder::MasterProcessDelegate { |
22 public: | 26 public: |
23 explicit Context(Tracer* tracer = nullptr); | 27 explicit Context(Tracer* tracer = nullptr); |
24 ~Context() override; | 28 ~Context() override; |
25 | 29 |
(...skipping 15 matching lines...) Expand all Loading... |
41 | 45 |
42 // Resolve an URL relative to the CWD mojo_shell was invoked from. This is a | 46 // Resolve an URL relative to the CWD mojo_shell was invoked from. This is a |
43 // nop for everything but relative file URLs or URLs without a scheme. | 47 // nop for everything but relative file URLs or URLs without a scheme. |
44 GURL ResolveCommandLineURL(const std::string& path); | 48 GURL ResolveCommandLineURL(const std::string& path); |
45 | 49 |
46 // This must be called with a message loop set up for the current thread, | 50 // This must be called with a message loop set up for the current thread, |
47 // which must remain alive until after Shutdown() is called. Returns true on | 51 // which must remain alive until after Shutdown() is called. Returns true on |
48 // success. | 52 // success. |
49 bool Init(); | 53 bool Init(); |
50 | 54 |
51 // Like Init(), but specifies |mojo_shell_child_path()| explicitly. | 55 // Like Init(), but specifies |mojo_shell_child_path()| explicitly. Also |
52 bool InitWithPaths(const base::FilePath& shell_child_path); | 56 // allows to set a delegate for the application offline cache. |
| 57 bool InitWithPaths( |
| 58 const base::FilePath& shell_child_path, |
| 59 mojo::URLResponseDiskCacheDelegate* url_response_disk_cache_delegate); |
53 | 60 |
54 // If Init() was called and succeeded, this must be called before destruction. | 61 // If Init() was called and succeeded, this must be called before destruction. |
55 void Shutdown(); | 62 void Shutdown(); |
56 | 63 |
57 void Run(const GURL& url); | 64 void Run(const GURL& url); |
58 | 65 |
59 ApplicationManager* application_manager() { return &application_manager_; } | 66 ApplicationManager* application_manager() { return &application_manager_; } |
60 URLResolver* url_resolver() { return &url_resolver_; } | 67 URLResolver* url_resolver() { return &url_resolver_; } |
61 | 68 |
62 // Available after Init(): | 69 // Available after Init(): |
(...skipping 26 matching lines...) Expand all Loading... |
89 std::set<GURL> app_urls_; | 96 std::set<GURL> app_urls_; |
90 GURL shell_file_root_; | 97 GURL shell_file_root_; |
91 GURL command_line_cwd_; | 98 GURL command_line_cwd_; |
92 | 99 |
93 DISALLOW_COPY_AND_ASSIGN(Context); | 100 DISALLOW_COPY_AND_ASSIGN(Context); |
94 }; | 101 }; |
95 | 102 |
96 } // namespace shell | 103 } // namespace shell |
97 | 104 |
98 #endif // SHELL_CONTEXT_H_ | 105 #endif // SHELL_CONTEXT_H_ |
OLD | NEW |