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

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

Issue 10908044: Refuse invalid SearchProvider and OSDD suggest URLs; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 8 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.h" 5 #include "chrome/browser/search_engines/template_url.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/i18n/icu_string_conversions.h" 9 #include "base/i18n/icu_string_conversions.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 instant_url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this), 623 instant_url_ref_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
624 TemplateURLRef::INSTANT) { 624 TemplateURLRef::INSTANT) {
625 SetPrepopulateId(data_.prepopulate_id); 625 SetPrepopulateId(data_.prepopulate_id);
626 } 626 }
627 627
628 TemplateURL::~TemplateURL() { 628 TemplateURL::~TemplateURL() {
629 } 629 }
630 630
631 // static 631 // static
632 GURL TemplateURL::GenerateFaviconURL(const GURL& url) { 632 GURL TemplateURL::GenerateFaviconURL(const GURL& url) {
633 DCHECK(url.is_valid());
634 GURL::Replacements rep;
635
636 const char favicon_path[] = "/favicon.ico"; 633 const char favicon_path[] = "/favicon.ico";
637 int favicon_path_len = arraysize(favicon_path) - 1; 634 int favicon_path_len = arraysize(favicon_path) - 1;
638 635
636 GURL::Replacements rep;
639 rep.SetPath(favicon_path, url_parse::Component(0, favicon_path_len)); 637 rep.SetPath(favicon_path, url_parse::Component(0, favicon_path_len));
640 rep.ClearUsername(); 638 rep.ClearUsername();
641 rep.ClearPassword(); 639 rep.ClearPassword();
642 rep.ClearQuery(); 640 rep.ClearQuery();
643 rep.ClearRef(); 641 rep.ClearRef();
644 return url.ReplaceComponents(rep); 642 return url.ReplaceComponents(rep);
645 } 643 }
646 644
647 string16 TemplateURL::AdjustedShortNameForLocaleDirection() const { 645 string16 TemplateURL::AdjustedShortNameForLocaleDirection() const {
648 string16 bidi_safe_short_name = data_.short_name; 646 string16 bidi_safe_short_name = data_.short_name;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 } 709 }
712 710
713 void TemplateURL::ResetKeywordIfNecessary(bool force) { 711 void TemplateURL::ResetKeywordIfNecessary(bool force) {
714 if (IsGoogleSearchURLWithReplaceableKeyword() || force) { 712 if (IsGoogleSearchURLWithReplaceableKeyword() || force) {
715 DCHECK(!IsExtensionKeyword()); 713 DCHECK(!IsExtensionKeyword());
716 GURL url(TemplateURLService::GenerateSearchURL(this)); 714 GURL url(TemplateURLService::GenerateSearchURL(this));
717 if (url.is_valid()) 715 if (url.is_valid())
718 data_.SetKeyword(TemplateURLService::GenerateKeyword(url)); 716 data_.SetKeyword(TemplateURLService::GenerateKeyword(url));
719 } 717 }
720 } 718 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698