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

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

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)
Patch Set: comments Created 4 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
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // is made a friend so that it can be the exception to this pattern. 492 // is made a friend so that it can be the exception to this pattern.
493 class TemplateURL { 493 class TemplateURL {
494 public: 494 public:
495 enum Type { 495 enum Type {
496 // Regular search engine. 496 // Regular search engine.
497 NORMAL, 497 NORMAL,
498 // Installed by extension through Override Settings API. 498 // Installed by extension through Override Settings API.
499 NORMAL_CONTROLLED_BY_EXTENSION, 499 NORMAL_CONTROLLED_BY_EXTENSION,
500 // The keyword associated with an extension that uses the Omnibox API. 500 // The keyword associated with an extension that uses the Omnibox API.
501 OMNIBOX_API_EXTENSION, 501 OMNIBOX_API_EXTENSION,
502 // Installed only on this device. Should not be sync'd.
Peter Kasting 2016/09/19 21:06:23 Nit: synced
Ian Wen 2016/09/20 04:48:03 Done.
503 LOCAL,
502 }; 504 };
503 505
504 // An AssociatedExtensionInfo represents information about the extension that 506 // An AssociatedExtensionInfo represents information about the extension that
505 // added the search engine. 507 // added the search engine.
506 struct AssociatedExtensionInfo { 508 struct AssociatedExtensionInfo {
507 AssociatedExtensionInfo(Type type, const std::string& extension_id); 509 AssociatedExtensionInfo(Type type, const std::string& extension_id);
508 ~AssociatedExtensionInfo(); 510 ~AssociatedExtensionInfo();
509 511
510 Type type; 512 Type type;
511 513
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 const SearchTermsData& search_terms_data) const; 635 const SearchTermsData& search_terms_data) const;
634 636
635 // Returns true if the keywords match or if 637 // Returns true if the keywords match or if
636 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and 638 // IsGoogleSearchURLWithReplaceableKeyword() is true for both |this| and
637 // |other|. 639 // |other|.
638 bool HasSameKeywordAs(const TemplateURLData& other, 640 bool HasSameKeywordAs(const TemplateURLData& other,
639 const SearchTermsData& search_terms_data) const; 641 const SearchTermsData& search_terms_data) const;
640 642
641 Type GetType() const; 643 Type GetType() const;
642 644
645 void SetType(Type type);
646
643 // Returns the id of the extension that added this search engine. Only call 647 // Returns the id of the extension that added this search engine. Only call
644 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or 648 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or
645 // OMNIBOX_API_EXTENSION. 649 // OMNIBOX_API_EXTENSION.
646 std::string GetExtensionId() const; 650 std::string GetExtensionId() const;
647 651
648 // Returns the type of this search engine, or SEARCH_ENGINE_OTHER if no 652 // Returns the type of this search engine, or SEARCH_ENGINE_OTHER if no
649 // engines match. 653 // engines match.
650 SearchEngineType GetEngineType( 654 SearchEngineType GetEngineType(
651 const SearchTermsData& search_terms_data) const; 655 const SearchTermsData& search_terms_data) const;
652 656
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 TemplateURLRef suggestions_url_ref_; 755 TemplateURLRef suggestions_url_ref_;
752 TemplateURLRef instant_url_ref_; 756 TemplateURLRef instant_url_ref_;
753 TemplateURLRef image_url_ref_; 757 TemplateURLRef image_url_ref_;
754 TemplateURLRef new_tab_url_ref_; 758 TemplateURLRef new_tab_url_ref_;
755 TemplateURLRef contextual_search_url_ref_; 759 TemplateURLRef contextual_search_url_ref_;
756 std::unique_ptr<AssociatedExtensionInfo> extension_info_; 760 std::unique_ptr<AssociatedExtensionInfo> extension_info_;
757 761
758 // Caches the computed engine type across successive calls to GetEngineType(). 762 // Caches the computed engine type across successive calls to GetEngineType().
759 mutable SearchEngineType engine_type_; 763 mutable SearchEngineType engine_type_;
760 764
765 Type type_;
Peter Kasting 2016/09/19 21:06:23 If you're going to elevate the "type" concept to n
Ian Wen 2016/09/20 04:48:03 In one case about omnibox extension I do need to c
766
761 // TODO(sky): Add date last parsed OSD file. 767 // TODO(sky): Add date last parsed OSD file.
762 768
763 DISALLOW_COPY_AND_ASSIGN(TemplateURL); 769 DISALLOW_COPY_AND_ASSIGN(TemplateURL);
764 }; 770 };
765 771
766 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 772 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698