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

Side by Side Diff: chrome/browser/net/url_fixer_upper.h

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. Created 9 years, 6 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
« no previous file with comments | « chrome/browser/history/history.cc ('k') | chrome/browser/net/url_fixer_upper.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_NET_URL_FIXER_UPPER_H_ 5 #ifndef CHROME_BROWSER_NET_URL_FIXER_UPPER_H_
6 #define CHROME_BROWSER_NET_URL_FIXER_UPPER_H_ 6 #define CHROME_BROWSER_NET_URL_FIXER_UPPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h"
(...skipping 22 matching lines...) Expand all
34 34
35 // Converts |text| to a fixed-up URL and returns it. Attempts to make 35 // Converts |text| to a fixed-up URL and returns it. Attempts to make
36 // some "smart" adjustments to obviously-invalid input where possible. 36 // some "smart" adjustments to obviously-invalid input where possible.
37 // |text| may be an absolute path to a file, which will get converted to a 37 // |text| may be an absolute path to a file, which will get converted to a
38 // "file:" URL. 38 // "file:" URL.
39 // 39 //
40 // The result will be a "more" valid URL than the input. It may still not 40 // The result will be a "more" valid URL than the input. It may still not
41 // be valid, so check the return value's validity or use 41 // be valid, so check the return value's validity or use
42 // possibly_invalid_spec(). 42 // possibly_invalid_spec().
43 // 43 //
44 // Schemes "about" and "chrome" are normalized to "chrome://", with slashes.
45 // "about:blank" is unaltered, as Webkit allows frames to access about:blank.
46 // Additionally, if a chrome URL does not have a valid host, as in "about:",
47 // the returned URL will have the host "version", as in "chrome://version".
48 //
44 // If |desired_tld| is non-empty, it represents the TLD the user wishes to 49 // If |desired_tld| is non-empty, it represents the TLD the user wishes to
45 // append in the case of an incomplete domain. We check that this is not a 50 // append in the case of an incomplete domain. We check that this is not a
46 // file path and there does not appear to be a valid TLD already, then append 51 // file path and there does not appear to be a valid TLD already, then append
47 // |desired_tld| to the domain and prepend "www." (unless it, or a scheme, 52 // |desired_tld| to the domain and prepend "www." (unless it, or a scheme,
48 // are already present.) This TLD should not have a leading '.' (use "com" 53 // are already present.) This TLD should not have a leading '.' (use "com"
49 // instead of ".com"). 54 // instead of ".com").
50 GURL FixupURL(const std::string& text, const std::string& desired_tld); 55 GURL FixupURL(const std::string& text, const std::string& desired_tld);
51 56
52 // Converts |text| to a fixed-up URL, allowing it to be a relative path on 57 // Converts |text| to a fixed-up URL, allowing it to be a relative path on
53 // the local filesystem. Begin searching in |base_dir|; if empty, use the 58 // the local filesystem. Begin searching in |base_dir|; if empty, use the
(...skipping 14 matching lines...) Expand all
68 // Does nothing if |part| is invalid. 73 // Does nothing if |part| is invalid.
69 void OffsetComponent(int offset, url_parse::Component* part); 74 void OffsetComponent(int offset, url_parse::Component* part);
70 75
71 // For paths like ~, we use $HOME for the current user's home 76 // For paths like ~, we use $HOME for the current user's home
72 // directory. For tests, we allow our idea of $HOME to be overriden 77 // directory. For tests, we allow our idea of $HOME to be overriden
73 // by this variable. 78 // by this variable.
74 extern const char* home_directory_override; 79 extern const char* home_directory_override;
75 }; 80 };
76 81
77 #endif // CHROME_BROWSER_NET_URL_FIXER_UPPER_H_ 82 #endif // CHROME_BROWSER_NET_URL_FIXER_UPPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history.cc ('k') | chrome/browser/net/url_fixer_upper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698