Commit ae2a704a authored by waffles's avatar waffles Committed by Commit bot

Rearrange Flash component registration.

(1) Remove redundant checks for bundled vs. component-updated Flash:
    This distinction is handled at registration time by the DCI.
(2) Update PathService after calling register. These two events are
    already racy, and it's more convenient to have the registration
    finished by the time the component updater notifies that the
    component has been updated.
(3) No need to explicitly pick up the bundled version of Flash for non-
    Linux: the component updater will manage registration of bundled
    Flash the same way it does component-updated Flash.

BUG=624067
TEST=https://docs.google.com/document/d/1iTQiaqjuHsKV4cPqSOet-eJKWb2SsJLp2ieDj_Mul4s/edit?pref=2&pli=1

Review-Url: https://codereview.chromium.org/2130803003
Cr-Commit-Position: refs/heads/master@{#405148}
parent ac35a4f3
......@@ -105,6 +105,9 @@ bool IsPepperFlash(const content::WebPluginInfo& plugin) {
(plugin.pepper_permissions & ppapi::PERMISSION_FLASH);
}
// |path| is the path to the latest Chrome-managed Flash installation (bundled
// or component updated).
// |version| is the version of that Flash implementation.
void RegisterPepperFlashWithChrome(const base::FilePath& path,
const Version& version) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
......@@ -112,8 +115,6 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
return;
base::FilePath bundled_flash_dir;
PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_dir);
base::FilePath system_flash_path;
PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, &system_flash_path);
......@@ -131,8 +132,6 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
return;
}
bool registered_is_bundled =
!bundled_flash_dir.empty() && bundled_flash_dir.IsParent(plugin.path);
bool registered_is_debug_system =
!system_flash_path.empty() &&
base::FilePath::CompareEqualIgnoreCase(plugin.path.value(),
......@@ -145,11 +144,10 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
is_on_network = base::IsOnNetworkDrive(path);
#endif
// If equal version, register iff component is not on a network drive,
// and the version of flash is not bundled, and not debug system.
// and the version of flash is not debug system.
if (registered_version.IsValid() &&
version.CompareTo(registered_version) == 0 &&
(is_on_network || registered_is_bundled ||
registered_is_debug_system)) {
(is_on_network || registered_is_debug_system)) {
return;
}
......@@ -163,12 +161,8 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
PluginService::GetInstance()->RefreshPlugins();
}
void NotifyPathServiceAndChrome(const base::FilePath& path,
const Version& version) {
void UpdatePathService(const base::FilePath& path) {
PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&RegisterPepperFlashWithChrome, path, version));
}
#endif // !defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD)
......@@ -234,8 +228,9 @@ void FlashComponentInstallerTraits::ComponentReady(
// Installation is done. Now tell the rest of chrome. Both the path service
// and to the plugin service. On Linux, a restart is required to use the new
// Flash version, so we do not do this.
RegisterPepperFlashWithChrome(path, version);
BrowserThread::GetBlockingPool()->PostTask(
FROM_HERE, base::Bind(&NotifyPathServiceAndChrome, path, version));
FROM_HERE, base::Bind(&UpdatePathService, path));
#endif // !defined(OS_LINUX)
}
......
......@@ -338,8 +338,10 @@ bool GetComponentUpdatedPepperFlash(content::PepperPluginInfo* plugin) {
#endif // defined(FLAPPER_AVAILABLE)
return false;
}
#endif // defined(OS_LINUX)
// Similar to GetComponentUpdatedPepperFlash, this is used on Linux only because
// on other platforms the component updater will take responsibility for
// locating and registering the bundled version of Flash.
bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
#if defined(FLAPPER_AVAILABLE)
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
......@@ -365,6 +367,7 @@ bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
return false;
#endif // FLAPPER_AVAILABLE
}
#endif // defined(OS_LINUX)
bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
......@@ -531,12 +534,12 @@ void ChromeContentClient::AddPepperPlugins(
new content::PepperPluginInfo);
if (GetComponentUpdatedPepperFlash(component_flash.get()))
flash_versions.push_back(component_flash.release());
#endif // defined(OS_LINUX)
std::unique_ptr<content::PepperPluginInfo> bundled_flash(
new content::PepperPluginInfo);
if (GetBundledPepperFlash(bundled_flash.get()))
flash_versions.push_back(bundled_flash.release());
#endif // defined(OS_LINUX)
std::unique_ptr<content::PepperPluginInfo> system_flash(
new content::PepperPluginInfo);
......
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