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

Side by Side Diff: shell/mojo_url_resolver.h

Issue 868963002: Simplify resolution of mojo: URLs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
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 SHELL_MOJO_URL_RESOLVER_H_ 5 #ifndef SHELL_MOJO_URL_RESOLVER_H_
6 #define SHELL_MOJO_URL_RESOLVER_H_ 6 #define SHELL_MOJO_URL_RESOLVER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 MojoURLResolver(); 23 MojoURLResolver();
24 ~MojoURLResolver(); 24 ~MojoURLResolver();
25 25
26 // If specified, then unknown "mojo:" URLs will be resolved relative to this 26 // If specified, then unknown "mojo:" URLs will be resolved relative to this
27 // base URL. That is, the portion after the colon will be appeneded to 27 // base URL. That is, the portion after the colon will be appeneded to
28 // |base_url| with platform-specific shared library prefix and suffix 28 // |base_url| with platform-specific shared library prefix and suffix
29 // inserted. 29 // inserted.
30 void SetBaseURL(const GURL& base_url); 30 void SetBaseURL(const GURL& base_url);
31 31
32 // Set the location of applications bundled with the Mojo Shell.
33 void SetLocalAppsPath(const base::FilePath& local_apps_path);
34
35 // Add a custom mapping for a particular "mojo:" URL. If |resolved_url| is 32 // Add a custom mapping for a particular "mojo:" URL. If |resolved_url| is
36 // itself a mojo url normal resolution rules apply. 33 // itself a mojo url normal resolution rules apply.
37 void AddCustomMapping(const GURL& mojo_url, const GURL& resolved_url); 34 void AddCustomMapping(const GURL& mojo_url, const GURL& resolved_url);
38 35
39 // Add a local file mapping for a particular "mojo:" URL. This causes the
40 // "mojo:" URL to be resolved to a location where local apps are stored
41 // (base::DIR_MODULE unless overriden using SetLocalAppsPath()).
42 void AddLocalFileMapping(const GURL& mojo_url);
43
44 // Resolve the given "mojo:" URL to the URL that should be used to fetch the 36 // Resolve the given "mojo:" URL to the URL that should be used to fetch the
45 // code for the corresponding Mojo App. 37 // code for the corresponding Mojo App.
46 GURL Resolve(const GURL& mojo_url) const; 38 GURL Resolve(const GURL& mojo_url) const;
47 39
48 // Applies all custom mappings for |url|, returning the last non-mapped url. 40 // Applies all custom mappings for |url|, returning the last non-mapped url.
49 // For example, if 'a' maps to 'b' and 'b' maps to 'c' calling this with 'a' 41 // For example, if 'a' maps to 'b' and 'b' maps to 'c' calling this with 'a'
50 // returns 'c'. 42 // returns 'c'.
51 GURL ApplyCustomMappings(const GURL& url) const; 43 GURL ApplyCustomMappings(const GURL& url) const;
52 44
53 private: 45 private:
54 std::map<GURL, GURL> url_map_; 46 std::map<GURL, GURL> url_map_;
55 std::set<GURL> local_file_set_;
56 GURL local_apps_url_;
57 GURL base_url_; 47 GURL base_url_;
58 48
59 DISALLOW_COPY_AND_ASSIGN(MojoURLResolver); 49 DISALLOW_COPY_AND_ASSIGN(MojoURLResolver);
60 }; 50 };
61 51
62 } // namespace shell 52 } // namespace shell
63 } // namespace mojo 53 } // namespace mojo
64 54
65 #endif // SHELL_MOJO_URL_RESOLVER_H_ 55 #endif // SHELL_MOJO_URL_RESOLVER_H_
OLDNEW
« shell/context.cc ('K') | « shell/context.cc ('k') | shell/mojo_url_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698