Use bundled Pepper Flash on Windows (Canary, still on a field trial).

First committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=133472
(was reverted, due to missing SHARED_INTERMEDIATE_DIR include dir in chrome_browser.gypi)

Review URL: http://codereview.chromium.org/10123016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133594 0039d316-1c4b-4281-b951-d872f2087c98
parent dc0ad034
...@@ -22,11 +22,10 @@ ...@@ -22,11 +22,10 @@
#include "base/version.h" #include "base/version.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/component_updater/component_updater_service.h" #include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/component_updater/pepper_flash_field_trial.h" #include "chrome/common/pepper_flash.h"
#include "chrome/browser/plugin_prefs.h" #include "chrome/browser/plugin_prefs.h"
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/installer/util/browser_distribution.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h" #include "content/public/browser/plugin_service.h"
#include "content/public/common/pepper_plugin_info.h" #include "content/public/common/pepper_plugin_info.h"
...@@ -34,9 +33,7 @@ ...@@ -34,9 +33,7 @@
#include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/plugin_constants.h"
#include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/plugin_module.h"
#if defined(OS_WIN) #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
#include "base/win/metro.h"
#endif
using content::BrowserThread; using content::BrowserThread;
using content::PluginService; using content::PluginService;
...@@ -79,29 +76,6 @@ const FilePath::CharType kPepperFlashBaseDirectory[] = ...@@ -79,29 +76,6 @@ const FilePath::CharType kPepperFlashBaseDirectory[] =
// If we don't have a Pepper Flash component, this is the version we claim. // If we don't have a Pepper Flash component, this is the version we claim.
const char kNullVersion[] = "0.0.0.0"; const char kNullVersion[] = "0.0.0.0";
// True if Pepper Flash should be enabled by default. Aura builds for any OS
// Windows 8 metro mode and part of Windows canary have it enabled by default.
bool IsPepperFlashEnabledByDefault() {
#if defined(USE_AURA)
return true;
#elif !defined(OS_WIN)
return false;
#else
if (base::win::GetMetroModule())
return true;
if (!PepperFlashFieldTrial::InEnableByDefaultGroup())
return false;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
if (!dist)
return false;
string16 channel;
if (!dist->GetChromeChannel(&channel))
return false;
return (channel == L"canary");
#endif
}
// The base directory on Windows looks like: // The base directory on Windows looks like:
// <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\.
FilePath GetPepperFlashBaseDirectory() { FilePath GetPepperFlashBaseDirectory() {
...@@ -386,7 +360,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { ...@@ -386,7 +360,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
} // namespace } // namespace
void RegisterPepperFlashComponent(ComponentUpdateService* cus) { void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD) && !defined(FLAPPER_AVAILABLE)
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
base::Bind(&StartPepperFlashUpdateRegistration, cus)); base::Bind(&StartPepperFlashUpdateRegistration, cus));
#endif #endif
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
'../printing/printing.gyp:printing', '../printing/printing.gyp:printing',
'../skia/skia.gyp:skia', '../skia/skia.gyp:skia',
'../sync/sync.gyp:syncapi_core', '../sync/sync.gyp:syncapi_core',
'../third_party/adobe/flash/flash_player.gyp:flapper_version_h',
'../third_party/bzip2/bzip2.gyp:bzip2', '../third_party/bzip2/bzip2.gyp:bzip2',
'../third_party/cld/cld.gyp:cld', '../third_party/cld/cld.gyp:cld',
'../third_party/expat/expat.gyp:expat', '../third_party/expat/expat.gyp:expat',
...@@ -69,6 +70,8 @@ ...@@ -69,6 +70,8 @@
'include_dirs': [ 'include_dirs': [
'..', '..',
'<(INTERMEDIATE_DIR)', '<(INTERMEDIATE_DIR)',
# Needed by pepper_flash_component_installer.cc.
'<(SHARED_INTERMEDIATE_DIR)',
], ],
'defines': [ 'defines': [
'<@(nacl_defines)', '<@(nacl_defines)',
...@@ -869,8 +872,6 @@ ...@@ -869,8 +872,6 @@
'browser/component_updater/flash_component_installer.h', 'browser/component_updater/flash_component_installer.h',
'browser/component_updater/npapi_flash_component_installer.cc', 'browser/component_updater/npapi_flash_component_installer.cc',
'browser/component_updater/pepper_flash_component_installer.cc', 'browser/component_updater/pepper_flash_component_installer.cc',
'browser/component_updater/pepper_flash_field_trial.cc',
'browser/component_updater/pepper_flash_field_trial.h',
'browser/component_updater/pnacl/pnacl_component_installer.cc', 'browser/component_updater/pnacl/pnacl_component_installer.cc',
'browser/component_updater/pnacl/pnacl_component_installer.h', 'browser/component_updater/pnacl/pnacl_component_installer.h',
'browser/component_updater/recovery_component_installer.cc', 'browser/component_updater/recovery_component_installer.cc',
......
...@@ -218,6 +218,8 @@ ...@@ -218,6 +218,8 @@
'common/nacl_types.h', 'common/nacl_types.h',
'common/libxml_utils.cc', 'common/libxml_utils.cc',
'common/libxml_utils.h', 'common/libxml_utils.h',
'common/pepper_flash.cc',
'common/pepper_flash.h',
'common/persistent_pref_store.h', 'common/persistent_pref_store.h',
'common/pref_store.cc', 'common/pref_store.cc',
'common/pref_store.h', 'common/pref_store.h',
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h" #include "chrome/common/chrome_version_info.h"
#include "chrome/common/pepper_flash.h"
#include "chrome/common/render_messages.h" #include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "content/public/common/pepper_plugin_info.h" #include "content/public/common/pepper_plugin_info.h"
...@@ -29,7 +30,7 @@ ...@@ -29,7 +30,7 @@
#include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/plugin_constants.h" #include "webkit/plugins/plugin_constants.h"
#include "flapper_version.h" // In <(SHARED_INTERMEDIATE_DIR). #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/registry.h" #include "base/win/registry.h"
...@@ -215,15 +216,15 @@ void AddPepperFlash(std::vector<content::PepperPluginInfo>* plugins) { ...@@ -215,15 +216,15 @@ void AddPepperFlash(std::vector<content::PepperPluginInfo>* plugins) {
flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( flash_version = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kPpapiFlashVersion); switches::kPpapiFlashVersion);
} else { } else {
// Use the bundled Pepper Flash if it's enabled and available. // Try to use a bundled Pepper Flash if:
// It's currently only enabled by default on Linux ia32 and x64. // 1) it's forcibly enabled via the command-line;
#if defined(FLAPPER_AVAILABLE) && defined(OS_LINUX) && \
(defined(ARCH_CPU_X86) || defined(ARCH_CPU_X86_64))
bool bundled_flapper_enabled = true;
#else
bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch( bool bundled_flapper_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBundledPpapiFlash); switches::kEnableBundledPpapiFlash);
// 2) it's known to be available at build time and enabled by default; and
#if defined(FLAPPER_AVAILABLE)
bundled_flapper_enabled |= IsPepperFlashEnabledByDefault();
#endif #endif
// 3) it's not forcibly disabled via the command-line.
bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch( bundled_flapper_enabled &= !CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableBundledPpapiFlash); switches::kDisableBundledPpapiFlash);
if (!bundled_flapper_enabled) if (!bundled_flapper_enabled)
......
...@@ -2,12 +2,19 @@ ...@@ -2,12 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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/command_line.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/string16.h"
#include "chrome/common/chrome_switches.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 { namespace {
...@@ -45,10 +52,7 @@ void ActivateFieldTrial() { ...@@ -45,10 +52,7 @@ void ActivateFieldTrial() {
trial->AppendGroup(kEnableGroupName, 500); trial->AppendGroup(kEnableGroupName, 500);
} }
} // namespace bool IsInFieldTrialGroup() {
// static
bool PepperFlashFieldTrial::InEnableByDefaultGroup() {
static bool activated = false; static bool activated = false;
if (!activated) { if (!activated) {
ActivateFieldTrial(); ActivateFieldTrial();
...@@ -59,3 +63,32 @@ bool PepperFlashFieldTrial::InEnableByDefaultGroup() { ...@@ -59,3 +63,32 @@ bool PepperFlashFieldTrial::InEnableByDefaultGroup() {
return group != base::FieldTrial::kNotFinalized && return group != base::FieldTrial::kNotFinalized &&
group != g_disabled_group_number; 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
}
...@@ -2,17 +2,10 @@ ...@@ -2,17 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_COMPONENT_UPDATER_PEPPER_FLASH_FIELD_TRIAL_H_ #ifndef CHROME_COMMON_PEPPER_FLASH_H_
#define CHROME_BROWSER_COMPONENT_UPDATER_PEPPER_FLASH_FIELD_TRIAL_H_ #define CHROME_COMMON_PEPPER_FLASH_H_
#include "base/basictypes.h" // True if Pepper Flash should be enabled by default.
bool IsPepperFlashEnabledByDefault();
class PepperFlashFieldTrial { #endif // CHROME_COMMON_PEPPER_FLASH_H_
public:
static bool InEnableByDefaultGroup();
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PepperFlashFieldTrial);
};
#endif // CHROME_BROWSER_COMPONENT_UPDATER_PEPPER_FLASH_FIELD_TRIAL_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment