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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 10795060: Rename all of experiments_helper to variations_helper, including files, namespaces, and various fun… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: rebase Created 8 years, 4 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
« no previous file with comments | « chrome/browser/metrics/variations_service.cc ('k') | chrome/chrome_common.gypi » ('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 (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 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/prerender/prerender_tracker.h" 22 #include "chrome/browser/prerender/prerender_tracker.h"
23 #include "chrome/browser/profiles/profile_io_data.h" 23 #include "chrome/browser/profiles/profile_io_data.h"
24 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" 24 #include "chrome/browser/renderer_host/chrome_url_request_user_data.h"
25 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" 25 #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h"
26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
27 #include "chrome/browser/ui/auto_login_prompter.h" 27 #include "chrome/browser/ui/auto_login_prompter.h"
28 #include "chrome/browser/ui/login/login_prompt.h" 28 #include "chrome/browser/ui/login/login_prompt.h"
29 #include "chrome/browser/ui/sync/one_click_signin_helper.h" 29 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
30 #include "chrome/common/chrome_notification_types.h" 30 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/extensions/user_script.h" 31 #include "chrome/common/extensions/user_script.h"
32 #include "chrome/common/metrics/experiments_helper.h" 32 #include "chrome/common/metrics/variations_util.h"
33 #include "chrome/common/metrics/proto/chrome_experiments.pb.h" 33 #include "chrome/common/metrics/proto/chrome_experiments.pb.h"
34 #include "chrome/common/render_messages.h" 34 #include "chrome/common/render_messages.h"
35 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/resource_context.h" 38 #include "content/public/browser/resource_context.h"
39 #include "content/public/browser/resource_dispatcher_host.h" 39 #include "content/public/browser/resource_dispatcher_host.h"
40 #include "content/public/browser/resource_request_info.h" 40 #include "content/public/browser/resource_request_info.h"
41 #include "net/base/load_flags.h" 41 #include "net/base/load_flags.h"
42 #include "net/base/ssl_config_service.h" 42 #include "net/base/ssl_config_service.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected( 370 io_data->resource_prefetch_predictor_observer()->OnRequestRedirected(
371 redirect_url, request); 371 redirect_url, request);
372 } 372 }
373 } 373 }
374 374
375 void ChromeResourceDispatcherHostDelegate::OnFieldTrialGroupFinalized( 375 void ChromeResourceDispatcherHostDelegate::OnFieldTrialGroupFinalized(
376 const std::string& trial_name, 376 const std::string& trial_name,
377 const std::string& group_name) { 377 const std::string& group_name) {
378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
379 chrome_variations::VariationID new_id = 379 chrome_variations::VariationID new_id =
380 experiments_helper::GetGoogleVariationID(trial_name, group_name); 380 chrome_variations::GetGoogleVariationID(trial_name, group_name);
381 if (new_id == chrome_variations::kEmptyID) 381 if (new_id == chrome_variations::kEmptyID)
382 return; 382 return;
383 variation_ids_set_.insert(new_id); 383 variation_ids_set_.insert(new_id);
384 UpdateVariationIDsHeaderValue(); 384 UpdateVariationIDsHeaderValue();
385 } 385 }
386 386
387 void ChromeResourceDispatcherHostDelegate::InitVariationIDsCacheIfNeeded() { 387 void ChromeResourceDispatcherHostDelegate::InitVariationIDsCacheIfNeeded() {
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
389 if (variation_ids_cache_initialized_) 389 if (variation_ids_cache_initialized_)
390 return; 390 return;
391 391
392 // Register for additional cache updates. We do this first to avoid a race 392 // Register for additional cache updates. We do this first to avoid a race
393 // that could cause us to miss registered FieldTrials. 393 // that could cause us to miss registered FieldTrials.
394 base::FieldTrialList::AddObserver(this); 394 base::FieldTrialList::AddObserver(this);
395 395
396 base::FieldTrial::SelectedGroups initial_groups; 396 base::FieldTrial::SelectedGroups initial_groups;
397 base::FieldTrialList::GetFieldTrialSelectedGroups(&initial_groups); 397 base::FieldTrialList::GetFieldTrialSelectedGroups(&initial_groups);
398 for (base::FieldTrial::SelectedGroups::const_iterator it = 398 for (base::FieldTrial::SelectedGroups::const_iterator it =
399 initial_groups.begin(); it != initial_groups.end(); ++it) { 399 initial_groups.begin(); it != initial_groups.end(); ++it) {
400 chrome_variations::VariationID id = 400 chrome_variations::VariationID id =
401 experiments_helper::GetGoogleVariationID(it->trial, it->group); 401 chrome_variations::GetGoogleVariationID(it->trial, it->group);
402 if (id != chrome_variations::kEmptyID) 402 if (id != chrome_variations::kEmptyID)
403 variation_ids_set_.insert(id); 403 variation_ids_set_.insert(id);
404 } 404 }
405 UpdateVariationIDsHeaderValue(); 405 UpdateVariationIDsHeaderValue();
406 406
407 variation_ids_cache_initialized_ = true; 407 variation_ids_cache_initialized_ = true;
408 } 408 }
409 409
410 void ChromeResourceDispatcherHostDelegate::UpdateVariationIDsHeaderValue() { 410 void ChromeResourceDispatcherHostDelegate::UpdateVariationIDsHeaderValue() {
411 // The header value is a serialized protobuffer of Variation IDs which we 411 // The header value is a serialized protobuffer of Variation IDs which we
(...skipping 12 matching lines...) Expand all
424 if (base::Base64Encode(serialized, &hashed)) { 424 if (base::Base64Encode(serialized, &hashed)) {
425 // If successful, swap the header value with the new one. 425 // If successful, swap the header value with the new one.
426 // Note that the list of IDs and the header could be temporarily out of sync 426 // Note that the list of IDs and the header could be temporarily out of sync
427 // if IDs are added as we are recreating the header, but we're OK with those 427 // if IDs are added as we are recreating the header, but we're OK with those
428 // descrepancies. 428 // descrepancies.
429 variation_ids_header_ = hashed; 429 variation_ids_header_ = hashed;
430 } else { 430 } else {
431 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized; 431 DVLOG(1) << "Failed to base64 encode Variation IDs value: " << serialized;
432 } 432 }
433 } 433 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/variations_service.cc ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698