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

Unified Diff: mojo/runner/url_resolver.h

Issue 1342503003: Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/runner/switches.cc ('k') | mojo/runner/url_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/url_resolver.h
diff --git a/mojo/runner/url_resolver.h b/mojo/runner/url_resolver.h
deleted file mode 100644
index b34e854a474de93b989b164e6d2e73729ddc0e7e..0000000000000000000000000000000000000000
--- a/mojo/runner/url_resolver.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_RUNNER_URL_RESOLVER_H_
-#define MOJO_RUNNER_URL_RESOLVER_H_
-
-#include <map>
-#include <set>
-
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "url/gurl.h"
-
-namespace mojo {
-namespace runner {
-
-// This class supports the mapping of URLs to other URLs.
-// It's commonly used with mojo: URL, to provide a physical location URL
-// (i.e. file: or https:) but works with any URL.
-// By default, "mojo:" URLs resolve to a file location, with ".mojo" appended,
-// but that resolution can be customized via the AddURLMapping and
-// AddOriginMapping methods.
-class URLResolver {
- public:
- URLResolver();
- ~URLResolver();
-
- // Used for the return value of GetOriginMappings().
- struct OriginMapping {
- OriginMapping(const std::string& origin, const std::string& base_url)
- : origin(origin), base_url(base_url) {}
-
- std::string origin;
- std::string base_url;
- };
-
- // Returns a list of origin mappings based on command line args.
- // The switch --map-origin can be specified multiple times. Each occurrence
- // has the format of --map-origin={origin}={base_url}
- // For example:
- // --map-origin=http://domokit.org=file:///source/out
- static std::vector<OriginMapping> GetOriginMappings(
- const base::CommandLine::StringVector& argv);
-
- // Add a custom mapping for a particular URL. If |mapped_url| is
- // itself a mojo URL, then normal resolution rules apply.
- void AddURLMapping(const GURL& url, const GURL& mapped_url);
-
- // Add a custom mapping for all URLs rooted at |origin|. An origin is a
- // combination of URL scheme, host and port.
- void AddOriginMapping(const GURL& origin, const GURL& base_url);
-
- // Applies all custom mappings for |url|, returning the last non-mapped url.
- // For example, if 'a' maps to 'b' and 'b' maps to 'c', calling this with 'a'
- // returns 'c'.
- GURL ApplyMappings(const GURL& url) const;
-
- // If specified, then "mojo:" URLs will be resolved relative to this
- // URL. That is, the portion after the colon will be appended to
- // |mojo_base_url| with .mojo appended.
- void SetMojoBaseURL(const GURL& mojo_base_url);
-
- // Resolve the given "mojo:" URL to the URL that should be used to fetch the
- // code for the corresponding Mojo App.
- GURL ResolveMojoURL(const GURL& mojo_url) const;
-
- private:
- using GURLToGURLMap = std::map<GURL, GURL>;
- GURLToGURLMap url_map_;
- GURLToGURLMap origin_map_;
- GURL mojo_base_url_;
-
- DISALLOW_COPY_AND_ASSIGN(URLResolver);
-};
-
-} // namespace runner
-} // namespace mojo
-
-#endif // MOJO_RUNNER_URL_RESOLVER_H_
« no previous file with comments | « mojo/runner/switches.cc ('k') | mojo/runner/url_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698