| Index: chrome/common/pepper_flash.cc
|
| diff --git a/chrome/browser/component_updater/pepper_flash_field_trial.cc b/chrome/common/pepper_flash.cc
|
| similarity index 65%
|
| rename from chrome/browser/component_updater/pepper_flash_field_trial.cc
|
| rename to chrome/common/pepper_flash.cc
|
| index 7cea088318b13056480a00899f5b7b9fe82e009f..8f6309c19dd63666e39f054228b308f1de090122 100644
|
| --- a/chrome/browser/component_updater/pepper_flash_field_trial.cc
|
| +++ b/chrome/common/pepper_flash.cc
|
| @@ -2,12 +2,19 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/component_updater/pepper_flash_field_trial.h"
|
| +#include "chrome/common/pepper_flash.h"
|
|
|
| +#include "base/basictypes.h"
|
| #include "base/command_line.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/metrics/field_trial.h"
|
| +#include "base/string16.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "chrome/installer/util/browser_distribution.h"
|
| +
|
| +#if defined(OS_WIN)
|
| +#include "base/win/metro.h"
|
| +#endif
|
|
|
| namespace {
|
|
|
| @@ -45,10 +52,7 @@ void ActivateFieldTrial() {
|
| trial->AppendGroup(kEnableGroupName, 500);
|
| }
|
|
|
| -} // namespace
|
| -
|
| -// static
|
| -bool PepperFlashFieldTrial::InEnableByDefaultGroup() {
|
| +bool IsInFieldTrialGroup() {
|
| static bool activated = false;
|
| if (!activated) {
|
| ActivateFieldTrial();
|
| @@ -59,3 +63,32 @@ bool PepperFlashFieldTrial::InEnableByDefaultGroup() {
|
| return group != base::FieldTrial::kNotFinalized &&
|
| group != g_disabled_group_number;
|
| }
|
| +
|
| +} // namespace
|
| +
|
| +bool IsPepperFlashEnabledByDefault() {
|
| +#if defined(USE_AURA)
|
| + // Pepper Flash is required for Aura (on any OS).
|
| + return true;
|
| +#elif defined(OS_WIN)
|
| + // Pepper Flash is required for Windows 8 Metro mode.
|
| + if (base::win::GetMetroModule())
|
| + return true;
|
| +
|
| + // For other Windows users, enable only for Canary users in a field trial.
|
| + if (!IsInFieldTrialGroup())
|
| + return false;
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| + if (!dist)
|
| + return false;
|
| + string16 channel;
|
| + if (!dist->GetChromeChannel(&channel))
|
| + return false;
|
| + return (channel == L"canary");
|
| +#elif defined(OS_LINUX)
|
| + // For Linux, always try to use it (availability is checked elsewhere).
|
| + return true;
|
| +#else
|
| + return false;
|
| +#endif
|
| +}
|
|
|