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

Side by Side Diff: shell/context.h

Issue 873253003: Resolve URLs passed on the command line relative to the CWD. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 10 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
« no previous file with comments | « shell/command_line_util_unittest.cc ('k') | shell/context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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"
(...skipping 17 matching lines...) Expand all
28 // Point to the directory containing installed services, such as the network 28 // Point to the directory containing installed services, such as the network
29 // service. By default this directory is used as the base URL for resolving 29 // service. By default this directory is used as the base URL for resolving
30 // unknown mojo: URLs. The network service will be loaded from this directory, 30 // unknown mojo: URLs. The network service will be loaded from this directory,
31 // even when the base URL for unknown mojo: URLs is overridden. 31 // even when the base URL for unknown mojo: URLs is overridden.
32 void SetShellFileRoot(const base::FilePath& path); 32 void SetShellFileRoot(const base::FilePath& path);
33 33
34 // Resolve an URL relative to the shell file root. This is a nop for 34 // Resolve an URL relative to the shell file root. This is a nop for
35 // everything but relative file URLs or URLs without a scheme. 35 // everything but relative file URLs or URLs without a scheme.
36 GURL ResolveShellFileURL(const std::string& path); 36 GURL ResolveShellFileURL(const std::string& path);
37 37
38 // Override the CWD, which is used for resolving file URLs passed in from the
39 // command line.
40 void SetCommandLineCWD(const base::FilePath& path);
41
42 // 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.
44 GURL ResolveCommandLineURL(const std::string& path);
45
38 static void EnsureEmbedderIsInitialized(); 46 static void EnsureEmbedderIsInitialized();
39 bool Init(); 47 bool Init();
40 48
41 void Run(const GURL& url); 49 void Run(const GURL& url);
42 ScopedMessagePipeHandle ConnectToServiceByName( 50 ScopedMessagePipeHandle ConnectToServiceByName(
43 const GURL& application_url, 51 const GURL& application_url,
44 const std::string& service_name); 52 const std::string& service_name);
45 53
46 TaskRunners* task_runners() { return task_runners_.get(); } 54 TaskRunners* task_runners() { return task_runners_.get(); }
47 ApplicationManager* application_manager() { return &application_manager_; } 55 ApplicationManager* application_manager() { return &application_manager_; }
48 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; } 56 MojoURLResolver* mojo_url_resolver() { return &mojo_url_resolver_; }
49 57
50 private: 58 private:
51 class NativeViewportApplicationLoader; 59 class NativeViewportApplicationLoader;
52 60
53 // ApplicationManager::Delegate override. 61 // ApplicationManager::Delegate override.
54 void OnApplicationError(const GURL& url) override; 62 void OnApplicationError(const GURL& url) override;
55 GURL ResolveURL(const GURL& url) override; 63 GURL ResolveURL(const GURL& url) override;
56 GURL ResolveMappings(const GURL& url) override; 64 GURL ResolveMappings(const GURL& url) override;
57 65
58 std::set<GURL> app_urls_; 66 std::set<GURL> app_urls_;
59 scoped_ptr<TaskRunners> task_runners_; 67 scoped_ptr<TaskRunners> task_runners_;
60 scoped_ptr<ExternalApplicationListener> listener_; 68 scoped_ptr<ExternalApplicationListener> listener_;
61 ApplicationManager application_manager_; 69 ApplicationManager application_manager_;
62 MojoURLResolver mojo_url_resolver_; 70 MojoURLResolver mojo_url_resolver_;
63 GURL shell_file_root_; 71 GURL shell_file_root_;
72 GURL command_line_cwd_;
64 73
65 DISALLOW_COPY_AND_ASSIGN(Context); 74 DISALLOW_COPY_AND_ASSIGN(Context);
66 }; 75 };
67 76
68 } // namespace shell 77 } // namespace shell
69 } // namespace mojo 78 } // namespace mojo
70 79
71 #endif // SHELL_CONTEXT_H_ 80 #endif // SHELL_CONTEXT_H_
OLDNEW
« no previous file with comments | « shell/command_line_util_unittest.cc ('k') | shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698