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

Side by Side Diff: chrome/browser/search_engines/template_url_service.cc

Issue 23658056: content: Move kHttpScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/search_engines/template_url_service.h" 5 #include "chrome/browser/search_engines/template_url_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 string16 result(base::i18n::ToLower(keyword)); 365 string16 result(base::i18n::ToLower(keyword));
366 TrimWhitespace(result, TRIM_ALL, &result); 366 TrimWhitespace(result, TRIM_ALL, &result);
367 url_parse::Component scheme_component; 367 url_parse::Component scheme_component;
368 if (url_parse::ExtractScheme(UTF16ToUTF8(keyword).c_str(), 368 if (url_parse::ExtractScheme(UTF16ToUTF8(keyword).c_str(),
369 static_cast<int>(keyword.length()), 369 static_cast<int>(keyword.length()),
370 &scheme_component)) { 370 &scheme_component)) {
371 // If the scheme isn't "http" or "https", bail. The user isn't trying to 371 // If the scheme isn't "http" or "https", bail. The user isn't trying to
372 // type a web address, but rather an FTP, file:, or other scheme URL, or a 372 // type a web address, but rather an FTP, file:, or other scheme URL, or a
373 // search query with some sort of initial operator (e.g. "site:"). 373 // search query with some sort of initial operator (e.g. "site:").
374 if (result.compare(0, scheme_component.end(), 374 if (result.compare(0, scheme_component.end(),
375 ASCIIToUTF16(chrome::kHttpScheme)) && 375 ASCIIToUTF16(content::kHttpScheme)) &&
376 result.compare(0, scheme_component.end(), 376 result.compare(0, scheme_component.end(),
377 ASCIIToUTF16(content::kHttpsScheme))) 377 ASCIIToUTF16(content::kHttpsScheme)))
378 return string16(); 378 return string16();
379 379
380 // Include trailing ':'. 380 // Include trailing ':'.
381 result.erase(0, scheme_component.end() + 1); 381 result.erase(0, scheme_component.end() + 1);
382 // Many schemes usually have "//" after them, so strip it too. 382 // Many schemes usually have "//" after them, so strip it too.
383 const string16 after_scheme(ASCIIToUTF16("//")); 383 const string16 after_scheme(ASCIIToUTF16("//"));
384 if (result.compare(0, after_scheme.length(), after_scheme) == 0) 384 if (result.compare(0, after_scheme.length(), after_scheme) == 0)
385 result.erase(0, after_scheme.length()); 385 result.erase(0, after_scheme.length());
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 const ExtensionKeyword& extension_keyword) const { 2626 const ExtensionKeyword& extension_keyword) const {
2627 TemplateURLData data; 2627 TemplateURLData data;
2628 data.short_name = UTF8ToUTF16(extension_keyword.extension_name); 2628 data.short_name = UTF8ToUTF16(extension_keyword.extension_name);
2629 data.SetKeyword(UTF8ToUTF16(extension_keyword.extension_keyword)); 2629 data.SetKeyword(UTF8ToUTF16(extension_keyword.extension_keyword));
2630 // This URL is not actually used for navigation. It holds the extension's 2630 // This URL is not actually used for navigation. It holds the extension's
2631 // ID, as well as forcing the TemplateURL to be treated as a search keyword. 2631 // ID, as well as forcing the TemplateURL to be treated as a search keyword.
2632 data.SetURL(std::string(extensions::kExtensionScheme) + "://" + 2632 data.SetURL(std::string(extensions::kExtensionScheme) + "://" +
2633 extension_keyword.extension_id + "/?q={searchTerms}"); 2633 extension_keyword.extension_id + "/?q={searchTerms}");
2634 return new TemplateURL(profile_, data); 2634 return new TemplateURL(profile_, data);
2635 } 2635 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_parser.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698