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

Side by Side Diff: chrome/browser/android/contextualsearch/contextual_search_delegate.cc

Issue 2558913003: Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Address nit. Created 4 years 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 | « no previous file | chrome/browser/android/metrics/uma_session_stats.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/contextualsearch/contextual_search_delegate.h" 5 #include "chrome/browser/android/contextualsearch/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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 DCHECK(request_url.is_valid()); 129 DCHECK(request_url.is_valid());
130 130
131 // Reset will delete any previous fetcher, and we won't get any callback. 131 // Reset will delete any previous fetcher, and we won't get any callback.
132 search_term_fetcher_.reset( 132 search_term_fetcher_.reset(
133 net::URLFetcher::Create(kContextualSearchURLFetcherID, request_url, 133 net::URLFetcher::Create(kContextualSearchURLFetcherID, request_url,
134 net::URLFetcher::GET, this).release()); 134 net::URLFetcher::GET, this).release());
135 search_term_fetcher_->SetRequestContext(url_request_context_); 135 search_term_fetcher_->SetRequestContext(url_request_context_);
136 136
137 // Add Chrome experiment state to the request headers. 137 // Add Chrome experiment state to the request headers.
138 net::HttpRequestHeaders headers; 138 net::HttpRequestHeaders headers;
139 // Note: It's fine to pass in |is_signed_in| false, which does not affect
140 // transmission of experiment ids coming from the variations server.
141 bool is_signed_in = false;
139 variations::AppendVariationHeaders( 142 variations::AppendVariationHeaders(
140 search_term_fetcher_->GetOriginalURL(), 143 search_term_fetcher_->GetOriginalURL(),
141 false, // Impossible to be incognito at this point. 144 false, // Impossible to be incognito at this point.
142 false, &headers); 145 false, is_signed_in, &headers);
143 search_term_fetcher_->SetExtraRequestHeaders(headers.ToString()); 146 search_term_fetcher_->SetExtraRequestHeaders(headers.ToString());
144 147
145 SetDiscourseContextAndAddToHeader(*context_); 148 SetDiscourseContextAndAddToHeader(*context_);
146 149
147 search_term_fetcher_->Start(); 150 search_term_fetcher_->Start();
148 } 151 }
149 152
150 void ContextualSearchDelegate::OnURLFetchComplete( 153 void ContextualSearchDelegate::OnURLFetchComplete(
151 const net::URLFetcher* source) { 154 const net::URLFetcher* source) {
152 DCHECK(source == search_term_fetcher_.get()); 155 DCHECK(source == search_term_fetcher_.get());
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 end_offset -= trim; 608 end_offset -= trim;
606 } 609 }
607 if (result_text.length() > end_offset + padding_each_side_pinned) { 610 if (result_text.length() > end_offset + padding_each_side_pinned) {
608 // Trim the end. 611 // Trim the end.
609 result_text = result_text.substr(0, end_offset + padding_each_side_pinned); 612 result_text = result_text.substr(0, end_offset + padding_each_side_pinned);
610 } 613 }
611 *start = start_offset; 614 *start = start_offset;
612 *end = end_offset; 615 *end = end_offset;
613 return result_text; 616 return result_text;
614 } 617 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/metrics/uma_session_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698