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

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

Issue 314773002: Omnibox: Send Input Type to Suggest Server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix (legitimate) clang error Created 6 years, 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/autocomplete/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 net::URLFetcher* SearchProvider::CreateSuggestFetcher( 635 net::URLFetcher* SearchProvider::CreateSuggestFetcher(
636 int id, 636 int id,
637 const TemplateURL* template_url, 637 const TemplateURL* template_url,
638 const AutocompleteInput& input) { 638 const AutocompleteInput& input) {
639 if (!template_url || template_url->suggestions_url().empty()) 639 if (!template_url || template_url->suggestions_url().empty())
640 return NULL; 640 return NULL;
641 641
642 // Bail if the suggestion URL is invalid with the given replacements. 642 // Bail if the suggestion URL is invalid with the given replacements.
643 TemplateURLRef::SearchTermsArgs search_term_args(input.text()); 643 TemplateURLRef::SearchTermsArgs search_term_args(input.text());
644 search_term_args.input_type = input.type();
644 search_term_args.cursor_position = input.cursor_position(); 645 search_term_args.cursor_position = input.cursor_position();
645 search_term_args.page_classification = input.current_page_classification(); 646 search_term_args.page_classification = input.current_page_classification();
646 if (CommandLine::ForCurrentProcess()->HasSwitch( 647 if (CommandLine::ForCurrentProcess()->HasSwitch(
647 switches::kEnableAnswersInSuggest)) 648 switches::kEnableAnswersInSuggest))
648 search_term_args.session_token = GetSessionToken(); 649 search_term_args.session_token = GetSessionToken();
649 GURL suggest_url(template_url->suggestions_url_ref().ReplaceSearchTerms( 650 GURL suggest_url(template_url->suggestions_url_ref().ReplaceSearchTerms(
650 search_term_args)); 651 search_term_args));
651 if (!suggest_url.is_valid()) 652 if (!suggest_url.is_valid())
652 return NULL; 653 return NULL;
653 // Send the current page URL if user setting and URL requirements are met and 654 // Send the current page URL if user setting and URL requirements are met and
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 // Make the base64 encoded value URL and filename safe(see RFC 3548). 1157 // Make the base64 encoded value URL and filename safe(see RFC 3548).
1157 std::replace(current_token_.begin(), current_token_.end(), '+', '-'); 1158 std::replace(current_token_.begin(), current_token_.end(), '+', '-');
1158 std::replace(current_token_.begin(), current_token_.end(), '/', '_'); 1159 std::replace(current_token_.begin(), current_token_.end(), '/', '_');
1159 } 1160 }
1160 1161
1161 // Extend expiration time another 60 seconds. 1162 // Extend expiration time another 60 seconds.
1162 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60); 1163 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60);
1163 1164
1164 return current_token_; 1165 return current_token_;
1165 } 1166 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_input.h ('k') | chrome/browser/search_engines/prepopulated_engines.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698