| 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 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #endif // defined(OS_LINUX) | 9 #endif // defined(OS_LINUX) |
| 10 | 10 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (!base::ReadFileToString(manifest_path, &manifest_data)) | 361 if (!base::ReadFileToString(manifest_path, &manifest_data)) |
| 362 return false; | 362 return false; |
| 363 scoped_ptr<base::Value> manifest_value( | 363 scoped_ptr<base::Value> manifest_value( |
| 364 base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS)); | 364 base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS)); |
| 365 if (!manifest_value.get()) | 365 if (!manifest_value.get()) |
| 366 return false; | 366 return false; |
| 367 base::DictionaryValue* manifest = NULL; | 367 base::DictionaryValue* manifest = NULL; |
| 368 if (!manifest_value->GetAsDictionary(&manifest)) | 368 if (!manifest_value->GetAsDictionary(&manifest)) |
| 369 return false; | 369 return false; |
| 370 | 370 |
| 371 base::Version version; | 371 Version version; |
| 372 if (!chrome::CheckPepperFlashManifest(*manifest, &version)) | 372 if (!chrome::CheckPepperFlashManifest(*manifest, &version)) |
| 373 return false; | 373 return false; |
| 374 | 374 |
| 375 *plugin = CreatePepperFlashInfo(flash_filename, version.GetString()); | 375 *plugin = CreatePepperFlashInfo(flash_filename, version.GetString()); |
| 376 return true; | 376 return true; |
| 377 } | 377 } |
| 378 #endif // defined(ENABLE_PLUGINS) | 378 #endif // defined(ENABLE_PLUGINS) |
| 379 | 379 |
| 380 std::string GetProduct() { | 380 std::string GetProduct() { |
| 381 return version_info::GetProductNameAndVersionForUserAgent(); | 381 return version_info::GetProductNameAndVersionForUserAgent(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 #endif | 448 #endif |
| 449 } | 449 } |
| 450 | 450 |
| 451 #if defined(ENABLE_PLUGINS) | 451 #if defined(ENABLE_PLUGINS) |
| 452 // static | 452 // static |
| 453 content::PepperPluginInfo* ChromeContentClient::FindMostRecentPlugin( | 453 content::PepperPluginInfo* ChromeContentClient::FindMostRecentPlugin( |
| 454 const std::vector<content::PepperPluginInfo*>& plugins) { | 454 const std::vector<content::PepperPluginInfo*>& plugins) { |
| 455 auto it = std::max_element( | 455 auto it = std::max_element( |
| 456 plugins.begin(), plugins.end(), | 456 plugins.begin(), plugins.end(), |
| 457 [](content::PepperPluginInfo* x, content::PepperPluginInfo* y) { | 457 [](content::PepperPluginInfo* x, content::PepperPluginInfo* y) { |
| 458 base::Version version_x(x->version); | 458 Version version_x(x->version); |
| 459 DCHECK(version_x.IsValid()); | 459 DCHECK(version_x.IsValid()); |
| 460 return version_x.IsOlderThan(y->version); | 460 return version_x.IsOlderThan(y->version); |
| 461 }); | 461 }); |
| 462 return it != plugins.end() ? *it : nullptr; | 462 return it != plugins.end() ? *it : nullptr; |
| 463 } | 463 } |
| 464 #endif // defined(ENABLE_PLUGINS) | 464 #endif // defined(ENABLE_PLUGINS) |
| 465 | 465 |
| 466 void ChromeContentClient::AddPepperPlugins( | 466 void ChromeContentClient::AddPepperPlugins( |
| 467 std::vector<content::PepperPluginInfo>* plugins) { | 467 std::vector<content::PepperPluginInfo>* plugins) { |
| 468 #if defined(ENABLE_PLUGINS) | 468 #if defined(ENABLE_PLUGINS) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 schemes->insert(content::kChromeUIScheme); | 587 schemes->insert(content::kChromeUIScheme); |
| 588 schemes->insert(extensions::kExtensionScheme); | 588 schemes->insert(extensions::kExtensionScheme); |
| 589 schemes->insert(extensions::kExtensionResourceScheme); | 589 schemes->insert(extensions::kExtensionResourceScheme); |
| 590 GetSecureOriginWhitelist(origins); | 590 GetSecureOriginWhitelist(origins); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void ChromeContentClient::AddServiceWorkerSchemes( | 593 void ChromeContentClient::AddServiceWorkerSchemes( |
| 594 std::set<std::string>* schemes) { | 594 std::set<std::string>* schemes) { |
| 595 schemes->insert(extensions::kExtensionScheme); | 595 schemes->insert(extensions::kExtensionScheme); |
| 596 } | 596 } |
| OLD | NEW |