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

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

Issue 1983773002: Cache SearchEngineType of TemplateURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-extracting-terms-from-template-url
Patch Set: Created 4 years, 7 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 bool HasSameKeywordAs(const TemplateURLData& other, 637 bool HasSameKeywordAs(const TemplateURLData& other,
638 const SearchTermsData& search_terms_data) const; 638 const SearchTermsData& search_terms_data) const;
639 639
640 Type GetType() const; 640 Type GetType() const;
641 641
642 // Returns the id of the extension that added this search engine. Only call 642 // Returns the id of the extension that added this search engine. Only call
643 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or 643 // this for TemplateURLs of type NORMAL_CONTROLLED_BY_EXTENSION or
644 // OMNIBOX_API_EXTENSION. 644 // OMNIBOX_API_EXTENSION.
645 std::string GetExtensionId() const; 645 std::string GetExtensionId() const;
646 646
647 // Returns the type of the provided engine, or SEARCH_ENGINE_OTHER if no
Peter Kasting 2016/05/17 04:43:04 "the provided engine" is meaningless since this do
Vitaly Baranov 2016/06/03 15:31:45 Done.
648 // engines match.
649 SearchEngineType GetEngineType(
650 const SearchTermsData& search_terms_data) const;
651
647 // Use the alternate URLs and the search URL to match the provided |url| 652 // Use the alternate URLs and the search URL to match the provided |url|
648 // and extract |search_terms| from it. Returns false and an empty 653 // and extract |search_terms| from it. Returns false and an empty
649 // |search_terms| if no search terms can be matched. The order in which the 654 // |search_terms| if no search terms can be matched. The order in which the
650 // alternate URLs are listed dictates their priority, the URL at index 0 is 655 // alternate URLs are listed dictates their priority, the URL at index 0 is
651 // treated as the highest priority and the primary search URL is treated as 656 // treated as the highest priority and the primary search URL is treated as
652 // the lowest priority. For example, if a TemplateURL has alternate URL 657 // the lowest priority. For example, if a TemplateURL has alternate URL
653 // "http://foo/#q={searchTerms}" and search URL "http://foo/?q={searchTerms}", 658 // "http://foo/#q={searchTerms}" and search URL "http://foo/?q={searchTerms}",
654 // and the URL to be decoded is "http://foo/?q=a#q=b", the alternate URL will 659 // and the URL to be decoded is "http://foo/?q=a#q=b", the alternate URL will
655 // match first and the decoded search term will be "b". 660 // match first and the decoded search term will be "b".
656 bool ExtractSearchTermsFromURL(const GURL& url, 661 bool ExtractSearchTermsFromURL(const GURL& url,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 // Points to the TemplateURLRef in |url_refs_| which corresponds to the search 746 // Points to the TemplateURLRef in |url_refs_| which corresponds to the search
742 // URL. 747 // URL.
743 TemplateURLRef* url_ref_; 748 TemplateURLRef* url_ref_;
744 749
745 TemplateURLRef suggestions_url_ref_; 750 TemplateURLRef suggestions_url_ref_;
746 TemplateURLRef instant_url_ref_; 751 TemplateURLRef instant_url_ref_;
747 TemplateURLRef image_url_ref_; 752 TemplateURLRef image_url_ref_;
748 TemplateURLRef new_tab_url_ref_; 753 TemplateURLRef new_tab_url_ref_;
749 TemplateURLRef contextual_search_url_ref_; 754 TemplateURLRef contextual_search_url_ref_;
750 std::unique_ptr<AssociatedExtensionInfo> extension_info_; 755 std::unique_ptr<AssociatedExtensionInfo> extension_info_;
756 mutable SearchEngineType engine_type_;
Peter Kasting 2016/05/17 04:43:04 I think it's confusing for there to be an engine_t
Vitaly Baranov 2016/06/03 15:31:45 Done. And field TemplateURLData::engine_type_ is m
751 757
752 // TODO(sky): Add date last parsed OSD file. 758 // TODO(sky): Add date last parsed OSD file.
753 759
754 DISALLOW_COPY_AND_ASSIGN(TemplateURL); 760 DISALLOW_COPY_AND_ASSIGN(TemplateURL);
755 }; 761 };
756 762
757 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 763 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698