Chromium Code Reviews| Index: chrome/browser/component_updater/pepper_flash_component_installer.cc |
| =================================================================== |
| --- chrome/browser/component_updater/pepper_flash_component_installer.cc (revision 112808) |
| +++ chrome/browser/component_updater/pepper_flash_component_installer.cc (working copy) |
| @@ -21,6 +21,7 @@ |
| #include "chrome/browser/component_updater/component_updater_service.h" |
| #include "chrome/browser/plugin_prefs.h" |
| #include "chrome/common/chrome_paths.h" |
| +#include "chrome/installer/util/browser_distribution.h" |
| #include "content/browser/plugin_service.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/common/pepper_plugin_info.h" |
| @@ -78,12 +79,23 @@ |
| // If we don't have a Pepper Flash component, this is the version we claim. |
| const char kNullVersion[] = "0.0.0.0"; |
| -// True if Pepper Flash should be enabled by default. |
| +// True if Pepper Flash should be enabled by default. Aura builds for any OS |
| +// and Windows canary have it enabled by default. |
| +bool IsPepperFlashEnabledByDefault() { |
| #if defined(USE_AURA) |
| -const bool kEnablePepperFlash = true; |
| + return true; |
| +#elif !defined(OS_WIN) |
| + return false; |
| #else |
| -const bool kEnablePepperFlash = false; |
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| + if (!dist) |
| + return false; |
| + std::wstring channel; |
|
brettw
2011/12/06 01:34:48
Can you use string16 for new code?
|
| + if (!dist->GetChromeChannel(&channel)) |
| + return false; |
| + return (channel == L"canary"); |
| #endif |
| +} |
| // The base directory on Windows looks like: |
| // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. |
| @@ -160,14 +172,18 @@ |
| return true; |
| } |
| +// If it is a |fresh_install| we enable or disable it by default in some |
| +// configurations. See IsPepperFlashEnabledByDefault() for more information. |
| void RegisterPepperFlashWithChrome(const FilePath& path, |
| - const Version& version) { |
| + const Version& version, |
| + bool fresh_install) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| content::PepperPluginInfo plugin_info; |
| - // Register it as out-of-process and disabled. |
| if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) |
| return; |
| - PluginPrefs::EnablePluginGlobally(kEnablePepperFlash, plugin_info.path); |
| + if (fresh_install) |
|
brettw
2011/12/06 01:34:48
Need {}
|
| + PluginPrefs::EnablePluginGlobally(IsPepperFlashEnabledByDefault(), |
| + plugin_info.path); |
| PluginService::GetInstance()->RegisterInternalPlugin( |
| plugin_info.ToWebPluginInfo()); |
| PluginService::GetInstance()->RefreshPlugins(); |
| @@ -222,7 +238,7 @@ |
| PathService::Override(chrome::FILE_PEPPER_FLASH_PLUGIN, path); |
| BrowserThread::PostTask( |
| BrowserThread::UI, FROM_HERE, |
| - base::Bind(&RegisterPepperFlashWithChrome, path, version)); |
| + base::Bind(&RegisterPepperFlashWithChrome, path, version, true)); |
| return true; |
| } |
| @@ -311,7 +327,7 @@ |
| if (file_util::PathExists(path)) { |
| BrowserThread::PostTask( |
| BrowserThread::UI, FROM_HERE, |
| - base::Bind(&RegisterPepperFlashWithChrome, path, version)); |
| + base::Bind(&RegisterPepperFlashWithChrome, path, version, false)); |
| } else { |
| version = Version(kNullVersion); |
| } |
| @@ -325,8 +341,8 @@ |
| } // namespace |
| void RegisterPepperFlashComponent(ComponentUpdateService* cus) { |
| -// #if defined(GOOGLE_CHROME_BUILD) |
| +#if defined(GOOGLE_CHROME_BUILD) |
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
| -// #endif |
| +#endif |
| } |