OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path)) | 301 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path)) |
302 return false; | 302 return false; |
303 | 303 |
304 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING); | 304 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING); |
305 return true; | 305 return true; |
306 #else | 306 #else |
307 return false; | 307 return false; |
308 #endif // FLAPPER_AVAILABLE | 308 #endif // FLAPPER_AVAILABLE |
309 } | 309 } |
310 | 310 |
311 #if defined(OS_WIN) | |
312 const char kPepperFlashDLLBaseName[] = | |
313 #if defined(ARCH_CPU_X86) | |
314 "pepflashplayer32_"; | |
315 #elif defined(ARCH_CPU_X86_64) | |
316 "pepflashplayer64_"; | |
317 #else | |
318 #error Unsupported Windows CPU architecture. | |
319 #endif // defined(ARCH_CPU_X86) | |
320 #endif // defined(OS_WIN) | |
321 | |
322 #if defined(FLAPPER_AVAILABLE) | 311 #if defined(FLAPPER_AVAILABLE) |
323 bool IsSystemFlashScriptDebuggerPresent() { | 312 bool IsSystemFlashScriptDebuggerPresent() { |
324 #if defined(OS_WIN) | 313 #if defined(OS_WIN) |
325 const wchar_t kFlashRegistryRoot[] = | 314 const wchar_t kFlashRegistryRoot[] = |
326 L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; | 315 L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; |
327 const wchar_t kIsDebuggerValueName[] = L"isScriptDebugger"; | 316 const wchar_t kIsDebuggerValueName[] = L"isScriptDebugger"; |
328 | 317 |
329 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ); | 318 base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ); |
330 DWORD debug_value; | 319 DWORD debug_value; |
331 if (FAILED(path_key.ReadValueDW(kIsDebuggerValueName, &debug_value))) | 320 if (FAILED(path_key.ReadValueDW(kIsDebuggerValueName, &debug_value))) |
(...skipping 17 matching lines...) Expand all Loading... |
349 if (!command_line->HasSwitch(switches::kDisableBundledPpapiFlash) && | 338 if (!command_line->HasSwitch(switches::kDisableBundledPpapiFlash) && |
350 !IsSystemFlashScriptDebuggerPresent()) | 339 !IsSystemFlashScriptDebuggerPresent()) |
351 return false; | 340 return false; |
352 #endif // defined(FLAPPER_AVAILABLE) | 341 #endif // defined(FLAPPER_AVAILABLE) |
353 | 342 |
354 // Do not try and find System Pepper Flash if there is a specific path on | 343 // Do not try and find System Pepper Flash if there is a specific path on |
355 // the commmand-line. | 344 // the commmand-line. |
356 if (command_line->HasSwitch(switches::kPpapiFlashPath)) | 345 if (command_line->HasSwitch(switches::kPpapiFlashPath)) |
357 return false; | 346 return false; |
358 | 347 |
359 base::FilePath flash_path; | 348 base::FilePath flash_filename; |
360 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN, &flash_path)) | 349 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, |
| 350 &flash_filename)) |
361 return false; | 351 return false; |
362 | 352 |
363 if (!base::PathExists(flash_path)) | 353 if (!base::PathExists(flash_filename)) |
364 return false; | 354 return false; |
365 | 355 |
366 base::FilePath manifest_path(flash_path.AppendASCII("manifest.json")); | 356 base::FilePath manifest_path( |
| 357 flash_filename.DirName().AppendASCII("manifest.json")); |
367 | 358 |
368 std::string manifest_data; | 359 std::string manifest_data; |
369 if (!base::ReadFileToString(manifest_path, &manifest_data)) | 360 if (!base::ReadFileToString(manifest_path, &manifest_data)) |
370 return false; | 361 return false; |
371 scoped_ptr<base::Value> manifest_value( | 362 scoped_ptr<base::Value> manifest_value( |
372 base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS)); | 363 base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS)); |
373 if (!manifest_value.get()) | 364 if (!manifest_value.get()) |
374 return false; | 365 return false; |
375 base::DictionaryValue* manifest = NULL; | 366 base::DictionaryValue* manifest = NULL; |
376 if (!manifest_value->GetAsDictionary(&manifest)) | 367 if (!manifest_value->GetAsDictionary(&manifest)) |
377 return false; | 368 return false; |
378 | 369 |
379 Version version; | 370 Version version; |
380 if (!chrome::CheckPepperFlashManifest(*manifest, &version)) | 371 if (!chrome::CheckPepperFlashManifest(*manifest, &version)) |
381 return false; | 372 return false; |
382 | 373 |
383 #if defined(OS_WIN) | 374 *plugin = CreatePepperFlashInfo(flash_filename, version.GetString()); |
384 // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll. | |
385 std::string filename(kPepperFlashDLLBaseName); | |
386 filename.append(version.GetString()); | |
387 base::ReplaceChars(filename, ".", "_", &filename); | |
388 filename.append(".dll"); | |
389 | |
390 base::FilePath path(flash_path.Append(base::ASCIIToUTF16(filename))); | |
391 #else | |
392 // PepperFlash on OS X is called PepperFlashPlayer.plugin | |
393 base::FilePath path(flash_path.Append(chrome::kPepperFlashPluginFilename)); | |
394 #endif | |
395 | |
396 if (!base::PathExists(path)) | |
397 return false; | |
398 | |
399 *plugin = CreatePepperFlashInfo(path, version.GetString()); | |
400 return true; | 375 return true; |
401 } | 376 } |
402 #endif // defined(ENABLE_PLUGINS) | 377 #endif // defined(ENABLE_PLUGINS) |
403 | 378 |
404 std::string GetProduct() { | 379 std::string GetProduct() { |
405 chrome::VersionInfo version_info; | 380 chrome::VersionInfo version_info; |
406 return version_info.ProductNameAndVersionForUserAgent(); | 381 return version_info.ProductNameAndVersionForUserAgent(); |
407 } | 382 } |
408 | 383 |
409 } // namespace | 384 } // namespace |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 #endif | 550 #endif |
576 | 551 |
577 void ChromeContentClient::AddSecureSchemesAndOrigins( | 552 void ChromeContentClient::AddSecureSchemesAndOrigins( |
578 std::set<std::string>* schemes, | 553 std::set<std::string>* schemes, |
579 std::set<GURL>* origins) { | 554 std::set<GURL>* origins) { |
580 schemes->insert(content::kChromeUIScheme); | 555 schemes->insert(content::kChromeUIScheme); |
581 schemes->insert(extensions::kExtensionScheme); | 556 schemes->insert(extensions::kExtensionScheme); |
582 schemes->insert(extensions::kExtensionResourceScheme); | 557 schemes->insert(extensions::kExtensionResourceScheme); |
583 GetSecureOriginWhitelist(origins); | 558 GetSecureOriginWhitelist(origins); |
584 } | 559 } |
OLD | NEW |