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

Side by Side Diff: chrome/browser/autocomplete/search_provider.h

Issue 23621037: Send URLs on non-zero prefix suggest requests also. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 (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 // This file contains the Search autocomplete provider. This provider is 5 // This file contains the Search autocomplete provider. This provider is
6 // responsible for all autocomplete entries that start with "Search <engine> 6 // responsible for all autocomplete entries that start with "Search <engine>
7 // for ...", including searching for the current input string, search 7 // for ...", including searching for the current input string, search
8 // history, and search suggestions. An instance of it gets created and 8 // history, and search suggestions. An instance of it gets created and
9 // managed by the autocomplete controller. 9 // managed by the autocomplete controller.
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool append_extra_query_params); 91 bool append_extra_query_params);
92 92
93 // Returns whether the SearchProvider previously flagged |match| as a query 93 // Returns whether the SearchProvider previously flagged |match| as a query
94 // that should be prefetched. 94 // that should be prefetched.
95 static bool ShouldPrefetch(const AutocompleteMatch& match); 95 static bool ShouldPrefetch(const AutocompleteMatch& match);
96 96
97 // Extracts the suggest response metadata which SearchProvider previously 97 // Extracts the suggest response metadata which SearchProvider previously
98 // stored for |match|. 98 // stored for |match|.
99 static std::string GetSuggestMetadata(const AutocompleteMatch& match); 99 static std::string GetSuggestMetadata(const AutocompleteMatch& match);
100 100
101 // Set the URL of the current page to |url|.
Peter Kasting 2013/09/19 21:20:06 This reads misleadingly. We're not changing the U
H Fung 2013/09/21 01:13:25 Done.
102 void SetCurrentPageUrl(const GURL& url);
103
101 // AutocompleteProvider: 104 // AutocompleteProvider:
102 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; 105 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE;
103 virtual void ResetSession() OVERRIDE; 106 virtual void ResetSession() OVERRIDE;
104 107
105 bool field_trial_triggered_in_session() const { 108 bool field_trial_triggered_in_session() const {
106 return field_trial_triggered_in_session_; 109 return field_trial_triggered_in_session_;
107 } 110 }
108 111
109 private: 112 private:
110 // TODO(hfung): Remove ZeroSuggestProvider as a friend class after 113 // TODO(hfung): Remove ZeroSuggestProvider as a friend class after
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // suggestions stored in |keyword_suggest_results_|). If there 488 // suggestions stored in |keyword_suggest_results_|). If there
486 // are no keyword suggestions and keyword verbatim is suppressed, 489 // are no keyword suggestions and keyword verbatim is suppressed,
487 // then drops the suggested relevance scores for the navsuggestions 490 // then drops the suggested relevance scores for the navsuggestions
488 // and drops the request to suppress verbatim, thereby introducing the 491 // and drops the request to suppress verbatim, thereby introducing the
489 // keyword verbatim match which will naturally outscore the navsuggestions. 492 // keyword verbatim match which will naturally outscore the navsuggestions.
490 void DemoteKeywordNavigationMatchesPastTopQuery(); 493 void DemoteKeywordNavigationMatchesPastTopQuery();
491 494
492 // Updates the value of |done_| from the internal state. 495 // Updates the value of |done_| from the internal state.
493 void UpdateDone(); 496 void UpdateDone();
494 497
498 // Whether the URL can be sent in the suggest request. Don't send the URL of
499 // non-Google HTTPS requests because it may contain sensitive information.
Peter Kasting 2013/09/19 21:20:06 It shouldn't be non-Google requests, it should be
500 // Don't allow incognito, if suggest is disabled, no chrome sync or custom
501 // sync passphrase. Checking that the user is in a field trial and that the
Peter Kasting 2013/09/19 21:20:06 This description sounds like it needs updating bas
H Fung 2013/09/21 01:13:25 Done.
502 // search provider is Google is done elsewhere.
Peter Kasting 2013/09/19 21:20:06 We shouldn't limit this to just Google being the s
H Fung 2013/09/21 01:13:25 It's clarified in the .cc file per your other comm
503 static bool CanSendURL(const GURL& url, Profile *profile);
504
495 // The amount of time to wait before sending a new suggest request after the 505 // The amount of time to wait before sending a new suggest request after the
496 // previous one. Non-const because some unittests modify this value. 506 // previous one. Non-const because some unittests modify this value.
497 static int kMinimumTimeBetweenSuggestQueriesMs; 507 static int kMinimumTimeBetweenSuggestQueriesMs;
498 508
499 // The following keys are used to record additional information on matches. 509 // The following keys are used to record additional information on matches.
500 510
501 // We annotate our AutocompleteMatches with whether their relevance scores 511 // We annotate our AutocompleteMatches with whether their relevance scores
502 // were server-provided using this key in the |additional_info| field. 512 // were server-provided using this key in the |additional_info| field.
503 static const char kRelevanceFromServerKey[]; 513 static const char kRelevanceFromServerKey[];
504 514
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 bool field_trial_triggered_; 564 bool field_trial_triggered_;
555 565
556 // Same as above except that it is maintained across the current Omnibox 566 // Same as above except that it is maintained across the current Omnibox
557 // session. 567 // session.
558 bool field_trial_triggered_in_session_; 568 bool field_trial_triggered_in_session_;
559 569
560 // If true, search history query suggestions will score low enough that 570 // If true, search history query suggestions will score low enough that
561 // they will not be inlined. 571 // they will not be inlined.
562 bool prevent_search_history_inlining_; 572 bool prevent_search_history_inlining_;
563 573
574 GURL current_page_url_;
575
564 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 576 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
565 }; 577 };
566 578
567 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 579 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698