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

Side by Side Diff: ios/chrome/browser/ui/contextual_search/contextual_search_delegate.cc

Issue 2627033003: Update some comments about variations headers API use. (Closed)
Patch Set: Remove extra . Created 3 years, 11 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
« no previous file with comments | « components/suggestions/suggestions_service_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ios/chrome/browser/ui/contextual_search/contextual_search_delegate.h" 5 #include "ios/chrome/browser/ui/contextual_search/contextual_search_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 GURL request_url(BuildRequestUrl()); 166 GURL request_url(BuildRequestUrl());
167 DCHECK(request_url.is_valid()); 167 DCHECK(request_url.is_valid());
168 168
169 // Reset will delete any previous fetcher, and we won't get any callback. 169 // Reset will delete any previous fetcher, and we won't get any callback.
170 search_term_fetcher_ = net::URLFetcher::Create( 170 search_term_fetcher_ = net::URLFetcher::Create(
171 kContextualSearchURLFetcherID, request_url, net::URLFetcher::GET, this); 171 kContextualSearchURLFetcherID, request_url, net::URLFetcher::GET, this);
172 search_term_fetcher_->SetRequestContext(browser_state_->GetRequestContext()); 172 search_term_fetcher_->SetRequestContext(browser_state_->GetRequestContext());
173 173
174 // Add Chrome experiment state to the request headers. 174 // Add Chrome experiment state to the request headers.
175 net::HttpRequestHeaders headers; 175 net::HttpRequestHeaders headers;
176 // Note: It's fine to pass in |is_signed_in| false, which does not affect 176 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does
177 // transmission of experiment ids coming from the variations server. 177 // not affect transmission of experiments coming from the variations server.
178 bool is_signed_in = false; 178 bool is_signed_in = false;
179 variations::AppendVariationHeaders(search_term_fetcher_->GetOriginalURL(), 179 variations::AppendVariationHeaders(search_term_fetcher_->GetOriginalURL(),
180 browser_state_->IsOffTheRecord(), false, 180 browser_state_->IsOffTheRecord(), false,
181 is_signed_in, &headers); 181 is_signed_in, &headers);
182 search_term_fetcher_->SetExtraRequestHeaders(headers.ToString()); 182 search_term_fetcher_->SetExtraRequestHeaders(headers.ToString());
183 183
184 SetDiscourseContextAndAddToHeader(*context_); 184 SetDiscourseContextAndAddToHeader(*context_);
185 185
186 search_term_fetcher_->Start(); 186 search_term_fetcher_->Start();
187 } 187 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 proto.SerializeToString(&serialized); 324 proto.SerializeToString(&serialized);
325 325
326 std::string encoded_context; 326 std::string encoded_context;
327 base::Base64Encode(serialized, &encoded_context); 327 base::Base64Encode(serialized, &encoded_context);
328 // The server memoizer expects a web-safe encoding. 328 // The server memoizer expects a web-safe encoding.
329 std::replace(encoded_context.begin(), encoded_context.end(), '+', '-'); 329 std::replace(encoded_context.begin(), encoded_context.end(), '+', '-');
330 std::replace(encoded_context.begin(), encoded_context.end(), '/', '_'); 330 std::replace(encoded_context.begin(), encoded_context.end(), '/', '_');
331 search_term_fetcher_->AddExtraRequestHeader(kDiscourseContextHeaderPrefix + 331 search_term_fetcher_->AddExtraRequestHeader(kDiscourseContextHeaderPrefix +
332 encoded_context); 332 encoded_context);
333 } 333 }
OLDNEW
« no previous file with comments | « components/suggestions/suggestions_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698