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

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

Issue 10193001: Revert 133472 - Use bundled Pepper Flash on Windows (Canary, still on a field trial). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/pepper_flash.h"
6
7 #include "base/basictypes.h"
8 #include "base/command_line.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/metrics/field_trial.h"
11 #include "base/string16.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
18
19 namespace {
20
21 const char* const kFieldTrialName = "PepperFlash";
22 const char* const kDisableGroupName = "DisableByDefault";
23 const char* const kEnableGroupName = "EnableByDefault";
24 int g_disabled_group_number = -1;
25
26 void ActivateFieldTrial() {
27 // The field trial will expire on Jan 1st, 2014.
28 scoped_refptr<base::FieldTrial> trial(
29 base::FieldTrialList::FactoryGetFieldTrial(
30 kFieldTrialName, 1000, kDisableGroupName, 2014, 1, 1,
31 &g_disabled_group_number));
32
33 CommandLine* command_line = CommandLine::ForCurrentProcess();
34 if (command_line->HasSwitch(switches::kPpapiFlashFieldTrial)) {
35 std::string switch_value =
36 command_line->GetSwitchValueASCII(switches::kPpapiFlashFieldTrial);
37 if (switch_value == switches::kPpapiFlashFieldTrialEnableByDefault) {
38 trial->AppendGroup(kEnableGroupName, 1000);
39 return;
40 } else if (switch_value ==
41 switches::kPpapiFlashFieldTrialDisableByDefault) {
42 return;
43 }
44 }
45
46 // Disable by default if one time randomization is not available.
47 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled())
48 return;
49
50 trial->UseOneTimeRandomization();
51 // 50% goes into the enable-by-default group.
52 trial->AppendGroup(kEnableGroupName, 500);
53 }
54
55 bool IsInFieldTrialGroup() {
56 static bool activated = false;
57 if (!activated) {
58 ActivateFieldTrial();
59 activated = true;
60 }
61
62 int group = base::FieldTrialList::FindValue(kFieldTrialName);
63 return group != base::FieldTrial::kNotFinalized &&
64 group != g_disabled_group_number;
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