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

Side by Side Diff: components/search_engines/template_url.h

Issue 2639153002: Make extensions DSE persistent in browser prefs (Reland) (Closed)
Patch Set: Fixed after review, round 4 Created 3 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 505
506 // Generates a favicon URL from the specified url. 506 // Generates a favicon URL from the specified url.
507 static GURL GenerateFaviconURL(const GURL& url); 507 static GURL GenerateFaviconURL(const GURL& url);
508 508
509 // Returns true if |t_url| and |data| are equal in all meaningful respects. 509 // Returns true if |t_url| and |data| are equal in all meaningful respects.
510 // Static to allow either or both params to be NULL. 510 // Static to allow either or both params to be NULL.
511 static bool MatchesData(const TemplateURL* t_url, 511 static bool MatchesData(const TemplateURL* t_url,
512 const TemplateURLData* data, 512 const TemplateURLData* data,
513 const SearchTermsData& search_terms_data); 513 const SearchTermsData& search_terms_data);
514 514
515 // Special case for search_terms_replacement_key comparison, because of
516 // its special initialization in TemplateURL constructor.
517 static bool SearchTermsReplacementKeysMatch(const std::string& key1,
518 const std::string& key2);
519
515 const TemplateURLData& data() const { return data_; } 520 const TemplateURLData& data() const { return data_; }
516 521
517 const base::string16& short_name() const { return data_.short_name(); } 522 const base::string16& short_name() const { return data_.short_name(); }
518 // An accessor for the short_name, but adjusted so it can be appropriately 523 // An accessor for the short_name, but adjusted so it can be appropriately
519 // displayed even if it is LTR and the UI is RTL. 524 // displayed even if it is LTR and the UI is RTL.
520 base::string16 AdjustedShortNameForLocaleDirection() const; 525 base::string16 AdjustedShortNameForLocaleDirection() const;
521 526
522 const base::string16& keyword() const { return data_.keyword(); } 527 const base::string16& keyword() const { return data_.keyword(); }
523 528
524 const std::string& url() const { return data_.url(); } 529 const std::string& url() const { return data_.url(); }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 const TemplateURLRef& image_url_ref() const { return image_url_ref_; } 587 const TemplateURLRef& image_url_ref() const { return image_url_ref_; }
583 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; } 588 const TemplateURLRef& new_tab_url_ref() const { return new_tab_url_ref_; }
584 const TemplateURLRef& contextual_search_url_ref() const { 589 const TemplateURLRef& contextual_search_url_ref() const {
585 return contextual_search_url_ref_; 590 return contextual_search_url_ref_;
586 } 591 }
587 592
588 Type type() const { return type_; } 593 Type type() const { return type_; }
589 594
590 // This setter shouldn't be used except by TemplateURLService and 595 // This setter shouldn't be used except by TemplateURLService and
591 // TemplateURLServiceClient implementations. 596 // TemplateURLServiceClient implementations.
592 void set_extension_info( 597 void set_extension_info(
Peter Kasting 2017/02/28 00:56:37 Nit: While here: I think this method is dead. Rem
Alexander Yashkin 2017/02/28 11:59:56 Done.
593 std::unique_ptr<AssociatedExtensionInfo> extension_info) { 598 std::unique_ptr<AssociatedExtensionInfo> extension_info) {
594 extension_info_ = std::move(extension_info); 599 extension_info_ = std::move(extension_info);
595 } 600 }
596 601
602 const AssociatedExtensionInfo* GetExtensionInfoForTesting() const {
603 return extension_info_.get();
604 }
605
597 // Returns true if |url| supports replacement. 606 // Returns true if |url| supports replacement.
598 bool SupportsReplacement(const SearchTermsData& search_terms_data) const; 607 bool SupportsReplacement(const SearchTermsData& search_terms_data) const;
599 608
600 // Returns true if any URLRefs use Googe base URLs. 609 // Returns true if any URLRefs use Googe base URLs.
601 bool HasGoogleBaseURLs(const SearchTermsData& search_terms_data) const; 610 bool HasGoogleBaseURLs(const SearchTermsData& search_terms_data) const;
602 611
603 // Returns true if this TemplateURL uses Google base URLs and has a keyword 612 // Returns true if this TemplateURL uses Google base URLs and has a keyword
604 // of "google.TLD". We use this to decide whether we can automatically 613 // of "google.TLD". We use this to decide whether we can automatically
605 // update the keyword to reflect the current Google base URL TLD. 614 // update the keyword to reflect the current Google base URL TLD.
606 bool IsGoogleSearchURLWithReplaceableKeyword( 615 bool IsGoogleSearchURLWithReplaceableKeyword(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 740
732 // Caches the computed engine type across successive calls to GetEngineType(). 741 // Caches the computed engine type across successive calls to GetEngineType().
733 mutable SearchEngineType engine_type_; 742 mutable SearchEngineType engine_type_;
734 743
735 // TODO(sky): Add date last parsed OSD file. 744 // TODO(sky): Add date last parsed OSD file.
736 745
737 DISALLOW_COPY_AND_ASSIGN(TemplateURL); 746 DISALLOW_COPY_AND_ASSIGN(TemplateURL);
738 }; 747 };
739 748
740 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 749 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698