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

Side by Side Diff: chrome/browser/autocomplete/autocomplete.cc

Issue 150207: Foundations for Print Preview and Setup... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « no previous file | chrome/browser/child_process_security_policy.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/autocomplete/autocomplete.h" 5 #include "chrome/browser/autocomplete/autocomplete.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // See if we know how to handle the URL internally. 118 // See if we know how to handle the URL internally.
119 if (URLRequest::IsHandledProtocol(WideToASCII(parsed_scheme))) 119 if (URLRequest::IsHandledProtocol(WideToASCII(parsed_scheme)))
120 return URL; 120 return URL;
121 121
122 // There are also some schemes that we convert to other things before they 122 // There are also some schemes that we convert to other things before they
123 // reach the renderer or else the renderer handles internally without 123 // reach the renderer or else the renderer handles internally without
124 // reaching the URLRequest logic. We thus won't catch these above, but we 124 // reaching the URLRequest logic. We thus won't catch these above, but we
125 // should still claim to handle them. 125 // should still claim to handle them.
126 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) || 126 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kViewSourceScheme) ||
127 LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) || 127 LowerCaseEqualsASCII(parsed_scheme, chrome::kJavaScriptScheme) ||
128 LowerCaseEqualsASCII(parsed_scheme, chrome::kDataScheme)) 128 LowerCaseEqualsASCII(parsed_scheme, chrome::kDataScheme) ||
129 LowerCaseEqualsASCII(parsed_scheme, chrome::kPrintScheme))
129 return URL; 130 return URL;
130 131
131 // Finally, check and see if the user has explicitly opened this scheme as 132 // Finally, check and see if the user has explicitly opened this scheme as
132 // a URL before. We need to do this last because some schemes may be in 133 // a URL before. We need to do this last because some schemes may be in
133 // here as "blocked" (e.g. "javascript") because we don't want pages to open 134 // here as "blocked" (e.g. "javascript") because we don't want pages to open
134 // them, but users still can. 135 // them, but users still can.
135 switch (ExternalProtocolHandler::GetBlockState(parsed_scheme)) { 136 switch (ExternalProtocolHandler::GetBlockState(parsed_scheme)) {
136 case ExternalProtocolHandler::DONT_BLOCK: 137 case ExternalProtocolHandler::DONT_BLOCK:
137 return URL; 138 return URL;
138 139
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 url_parse::Component* scheme, 251 url_parse::Component* scheme,
251 url_parse::Component* host) { 252 url_parse::Component* host) {
252 url_parse::Parsed parts; 253 url_parse::Parsed parts;
253 std::wstring scheme_str; 254 std::wstring scheme_str;
254 Parse(text, desired_tld, &parts, &scheme_str); 255 Parse(text, desired_tld, &parts, &scheme_str);
255 256
256 *scheme = parts.scheme; 257 *scheme = parts.scheme;
257 *host = parts.host; 258 *host = parts.host;
258 259
259 int after_scheme_and_colon = parts.scheme.end() + 1; 260 int after_scheme_and_colon = parts.scheme.end() + 1;
260 // For the view-source scheme, we should emphasize the scheme and host of 261 // For the view-source and print schemes, we should emphasize the scheme and
261 // the URL qualified by the view-source prefix. 262 // host of the URL qualified by the scheme prefix.
262 if (LowerCaseEqualsASCII(scheme_str, chrome::kViewSourceScheme) && 263 if ((LowerCaseEqualsASCII(scheme_str, chrome::kViewSourceScheme) ||
264 LowerCaseEqualsASCII(scheme_str, chrome::kPrintScheme)) &&
263 (static_cast<int>(text.length()) > after_scheme_and_colon)) { 265 (static_cast<int>(text.length()) > after_scheme_and_colon)) {
264 // Obtain the URL prefixed by view-source and parse it. 266 // Obtain the URL prefixed by scheme and parse it.
265 std::wstring real_url(text.substr(after_scheme_and_colon)); 267 std::wstring real_url(text.substr(after_scheme_and_colon));
266 url_parse::Parsed real_parts; 268 url_parse::Parsed real_parts;
267 AutocompleteInput::Parse(real_url, desired_tld, &real_parts, NULL); 269 AutocompleteInput::Parse(real_url, desired_tld, &real_parts, NULL);
268 if (real_parts.scheme.is_nonempty() || real_parts.host.is_nonempty()) { 270 if (real_parts.scheme.is_nonempty() || real_parts.host.is_nonempty()) {
269 if (real_parts.scheme.is_nonempty()) { 271 if (real_parts.scheme.is_nonempty()) {
270 *scheme = url_parse::Component( 272 *scheme = url_parse::Component(
271 after_scheme_and_colon + real_parts.scheme.begin, 273 after_scheme_and_colon + real_parts.scheme.begin,
272 real_parts.scheme.len); 274 real_parts.scheme.len);
273 } else { 275 } else {
274 scheme->reset(); 276 scheme->reset();
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 match.contents_class.push_back( 891 match.contents_class.push_back(
890 ACMatchClassification(keyword_offset + input_.text().size(), 892 ACMatchClassification(keyword_offset + input_.text().size(),
891 ACMatchClassification::NONE)); 893 ACMatchClassification::NONE));
892 } 894 }
893 match.destination_url = 895 match.destination_url =
894 HistoryUI::GetHistoryURLWithSearchText(input_.text()); 896 HistoryUI::GetHistoryURLWithSearchText(input_.text());
895 match.transition = PageTransition::AUTO_BOOKMARK; 897 match.transition = PageTransition::AUTO_BOOKMARK;
896 match.provider = history_contents_provider_; 898 match.provider = history_contents_provider_;
897 latest_result_.AddMatch(match); 899 latest_result_.AddMatch(match);
898 } 900 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/child_process_security_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698