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

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

Issue 10033017: More misc. cleanups to minimize future refactoring diffs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/icu_string_conversions.h" 8 #include "base/i18n/icu_string_conversions.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 usage_count(0), 578 usage_count(0),
579 prepopulate_id(0), 579 prepopulate_id(0),
580 sync_guid(guid::GenerateGUID()), 580 sync_guid(guid::GenerateGUID()),
581 autogenerate_keyword_(false), 581 autogenerate_keyword_(false),
582 keyword_generated_(false) { 582 keyword_generated_(false) {
583 } 583 }
584 584
585 TemplateURLData::~TemplateURLData() { 585 TemplateURLData::~TemplateURLData() {
586 } 586 }
587 587
588 void TemplateURLData::SetKeyword(const string16& keyword) const { 588 void TemplateURLData::SetKeyword(const string16& keyword) {
589 // Case sensitive keyword matching is confusing. As such, we force all 589 // Case sensitive keyword matching is confusing. As such, we force all
590 // keywords to be lower case. 590 // keywords to be lower case.
591 keyword_ = base::i18n::ToLower(keyword); 591 keyword_ = base::i18n::ToLower(keyword);
592 autogenerate_keyword_ = false; 592 autogenerate_keyword_ = false;
593 } 593 }
594 594
595 const string16& TemplateURLData::keyword(const TemplateURL* t_url) const { 595 const string16& TemplateURLData::keyword(const TemplateURL* t_url) const {
596 EnsureKeyword(t_url); 596 EnsureKeyword(t_url);
597 return keyword_; 597 return keyword_;
598 } 598 }
599 599
600 void TemplateURLData::SetAutogenerateKeyword(bool autogenerate_keyword) const { 600 void TemplateURLData::SetAutogenerateKeyword(bool autogenerate_keyword) {
601 autogenerate_keyword_ = autogenerate_keyword; 601 autogenerate_keyword_ = autogenerate_keyword;
602 if (autogenerate_keyword_) { 602 if (autogenerate_keyword_) {
603 keyword_.clear(); 603 keyword_.clear();
604 keyword_generated_ = false; 604 keyword_generated_ = false;
605 } 605 }
606 } 606 }
607 607
608 void TemplateURLData::EnsureKeyword(const TemplateURL* t_url) const { 608 void TemplateURLData::EnsureKeyword(const TemplateURL* t_url) const {
609 if (autogenerate_keyword_ && !keyword_generated_) { 609 if (autogenerate_keyword_ && !keyword_generated_) {
610 // Generate a keyword and cache it. 610 // Generate a keyword and cache it.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 } 702 }
703 703
704 void TemplateURL::SetURL(const std::string& url) { 704 void TemplateURL::SetURL(const std::string& url) {
705 data_.SetURL(url); 705 data_.SetURL(url);
706 url_ref_.InvalidateCachedValues(); 706 url_ref_.InvalidateCachedValues();
707 } 707 }
708 708
709 void TemplateURL::SetPrepopulateId(int id) { 709 void TemplateURL::SetPrepopulateId(int id) {
710 data_.prepopulate_id = id; 710 data_.prepopulate_id = id;
711 const bool prepopulated = id > 0; 711 const bool prepopulated = id > 0;
712 url_ref_.prepopulated_ = prepopulated;
712 suggestions_url_ref_.prepopulated_ = prepopulated; 713 suggestions_url_ref_.prepopulated_ = prepopulated;
713 url_ref_.prepopulated_ = prepopulated;
714 instant_url_ref_.prepopulated_ = prepopulated; 714 instant_url_ref_.prepopulated_ = prepopulated;
715 } 715 }
716 716
717 void TemplateURL::InvalidateCachedValues() const { 717 void TemplateURL::InvalidateCachedValues() {
718 url_ref_.InvalidateCachedValues(); 718 url_ref_.InvalidateCachedValues();
719 suggestions_url_ref_.InvalidateCachedValues(); 719 suggestions_url_ref_.InvalidateCachedValues();
720 instant_url_ref_.InvalidateCachedValues(); 720 instant_url_ref_.InvalidateCachedValues();
721 data_.SetAutogenerateKeyword(data_.autogenerate_keyword()); 721 data_.SetAutogenerateKeyword(data_.autogenerate_keyword());
722 } 722 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698