| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/component_updater/flash_component_installer.h" | 5 #include "chrome/browser/component_updater/flash_component_installer.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 "???"; | 68 "???"; |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 // The Pepper Flash plugins are in a directory with this name. | 71 // The Pepper Flash plugins are in a directory with this name. |
| 72 const FilePath::CharType kPepperFlashBaseDirectory[] = | 72 const FilePath::CharType kPepperFlashBaseDirectory[] = |
| 73 FILE_PATH_LITERAL("PepperFlash"); | 73 FILE_PATH_LITERAL("PepperFlash"); |
| 74 | 74 |
| 75 // If we don't have a Pepper Flash component, this is the version we claim. | 75 // If we don't have a Pepper Flash component, this is the version we claim. |
| 76 const char kNullVersion[] = "0.0.0.0"; | 76 const char kNullVersion[] = "0.0.0.0"; |
| 77 | 77 |
| 78 // True if Pepper Flash should be enabled by default. |
| 79 #if defined(USE_AURA) |
| 80 const bool kEnablePepperFlash = true; |
| 81 #else |
| 82 const bool kEnablePepperFlash = false; |
| 83 #endif |
| 84 |
| 78 // The base directory on Windows looks like: | 85 // The base directory on Windows looks like: |
| 79 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. | 86 // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\. |
| 80 FilePath GetPepperFlashBaseDirectory() { | 87 FilePath GetPepperFlashBaseDirectory() { |
| 81 FilePath result; | 88 FilePath result; |
| 82 PathService::Get(chrome::DIR_USER_DATA, &result); | 89 PathService::Get(chrome::DIR_USER_DATA, &result); |
| 83 return result.Append(kPepperFlashBaseDirectory); | 90 return result.Append(kPepperFlashBaseDirectory); |
| 84 } | 91 } |
| 85 | 92 |
| 86 // Pepper Flash plugins have the version encoded in the path itself | 93 // Pepper Flash plugins have the version encoded in the path itself |
| 87 // so we need to enumerate the directories to find the full path. | 94 // so we need to enumerate the directories to find the full path. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return true; | 157 return true; |
| 151 } | 158 } |
| 152 | 159 |
| 153 void RegisterPepperFlashWithChrome(const FilePath& path, | 160 void RegisterPepperFlashWithChrome(const FilePath& path, |
| 154 const Version& version) { | 161 const Version& version) { |
| 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 156 content::PepperPluginInfo plugin_info; | 163 content::PepperPluginInfo plugin_info; |
| 157 // Register it as out-of-process and disabled. | 164 // Register it as out-of-process and disabled. |
| 158 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) | 165 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) |
| 159 return; | 166 return; |
| 160 PluginPrefs::EnablePluginGlobally(false, plugin_info.path); | 167 PluginPrefs::EnablePluginGlobally(kEnablePepperFlash, plugin_info.path); |
| 161 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( | 168 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( |
| 162 plugin_info.ToWebPluginInfo()); | 169 plugin_info.ToWebPluginInfo()); |
| 163 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); | 170 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
| 164 } | 171 } |
| 165 | 172 |
| 166 } // namespace | 173 } // namespace |
| 167 | 174 |
| 168 class PepperFlashComponentInstaller : public ComponentInstaller { | 175 class PepperFlashComponentInstaller : public ComponentInstaller { |
| 169 public: | 176 public: |
| 170 explicit PepperFlashComponentInstaller(const Version& version); | 177 explicit PepperFlashComponentInstaller(const Version& version); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 317 } |
| 311 | 318 |
| 312 } // namespace | 319 } // namespace |
| 313 | 320 |
| 314 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { | 321 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { |
| 315 #if defined(GOOGLE_CHROME_BUILD) | 322 #if defined(GOOGLE_CHROME_BUILD) |
| 316 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 323 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 317 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus)); | 324 NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus)); |
| 318 #endif | 325 #endif |
| 319 } | 326 } |
| OLD | NEW |