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

Side by Side Diff: chrome/common/pepper_flash.cc

Issue 10123016: Use bundled Pepper Flash on Windows (Canary, still on a field trial). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 8 years, 8 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/common/pepper_flash.h ('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 (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/component_updater/pepper_flash_field_trial.h" 5 #include "chrome/common/pepper_flash.h"
6 6
7 #include "base/basictypes.h"
7 #include "base/command_line.h" 8 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
9 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/string16.h"
10 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/installer/util/browser_distribution.h"
14
15 #if defined(OS_WIN)
16 #include "base/win/metro.h"
17 #endif
11 18
12 namespace { 19 namespace {
13 20
14 const char* const kFieldTrialName = "PepperFlash"; 21 const char* const kFieldTrialName = "PepperFlash";
15 const char* const kDisableGroupName = "DisableByDefault"; 22 const char* const kDisableGroupName = "DisableByDefault";
16 const char* const kEnableGroupName = "EnableByDefault"; 23 const char* const kEnableGroupName = "EnableByDefault";
17 int g_disabled_group_number = -1; 24 int g_disabled_group_number = -1;
18 25
19 void ActivateFieldTrial() { 26 void ActivateFieldTrial() {
20 // The field trial will expire on Jan 1st, 2014. 27 // The field trial will expire on Jan 1st, 2014.
(...skipping 17 matching lines...) Expand all
38 45
39 // Disable by default if one time randomization is not available. 46 // Disable by default if one time randomization is not available.
40 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled()) 47 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled())
41 return; 48 return;
42 49
43 trial->UseOneTimeRandomization(); 50 trial->UseOneTimeRandomization();
44 // 50% goes into the enable-by-default group. 51 // 50% goes into the enable-by-default group.
45 trial->AppendGroup(kEnableGroupName, 500); 52 trial->AppendGroup(kEnableGroupName, 500);
46 } 53 }
47 54
48 } // namespace 55 bool IsInFieldTrialGroup() {
49
50 // static
51 bool PepperFlashFieldTrial::InEnableByDefaultGroup() {
52 static bool activated = false; 56 static bool activated = false;
53 if (!activated) { 57 if (!activated) {
54 ActivateFieldTrial(); 58 ActivateFieldTrial();
55 activated = true; 59 activated = true;
56 } 60 }
57 61
58 int group = base::FieldTrialList::FindValue(kFieldTrialName); 62 int group = base::FieldTrialList::FindValue(kFieldTrialName);
59 return group != base::FieldTrial::kNotFinalized && 63 return group != base::FieldTrial::kNotFinalized &&
60 group != g_disabled_group_number; 64 group != g_disabled_group_number;
61 } 65 }
66
67 } // namespace
68
69 bool IsPepperFlashEnabledByDefault() {
70 #if defined(USE_AURA)
71 // Pepper Flash is required for Aura (on any OS).
72 return true;
73 #elif defined(OS_WIN)
74 // Pepper Flash is required for Windows 8 Metro mode.
75 if (base::win::GetMetroModule())
76 return true;
77
78 // For other Windows users, enable only for Canary users in a field trial.
79 if (!IsInFieldTrialGroup())
80 return false;
81 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
82 if (!dist)
83 return false;
84 string16 channel;
85 if (!dist->GetChromeChannel(&channel))
86 return false;
87 return (channel == L"canary");
88 #elif defined(OS_LINUX)
89 // For Linux, always try to use it (availability is checked elsewhere).
90 return true;
91 #else
92 return false;
93 #endif
94 }
OLDNEW
« no previous file with comments | « chrome/common/pepper_flash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698