Chromium Code Reviews| 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 782 | 782 |
| 783 bool is_invoked_by_hosted_app = extension && | 783 bool is_invoked_by_hosted_app = extension && |
| 784 extension->is_hosted_app() && | 784 extension->is_hosted_app() && |
| 785 extension->web_extent().MatchesURL(app_url); | 785 extension->web_extent().MatchesURL(app_url); |
| 786 | 786 |
| 787 // Allow built-in extensions and extensions under development. | 787 // Allow built-in extensions and extensions under development. |
| 788 bool is_extension_unrestricted = extension && | 788 bool is_extension_unrestricted = extension && |
| 789 (extension->location() == extensions::Manifest::COMPONENT || | 789 (extension->location() == extensions::Manifest::COMPONENT || |
| 790 extensions::Manifest::IsUnpackedLocation(extension->location())); | 790 extensions::Manifest::IsUnpackedLocation(extension->location())); |
| 791 | 791 |
| 792 bool is_invoked_by_extension = app_url.SchemeIs("chrome-extension"); | 792 bool is_invoked_by_extension = app_url.SchemeIs(extensions::kExtensionScheme); |
| 793 | 793 |
| 794 // The NaCl PDF viewer is always allowed and can use 'Dev' interfaces. | 794 // The NaCl PDF viewer is always allowed and can use 'Dev' interfaces. |
| 795 bool is_nacl_pdf_viewer = | 795 bool is_nacl_pdf_viewer = |
| 796 (is_extension_from_webstore && | 796 (is_extension_from_webstore && |
| 797 manifest_url.SchemeIs("chrome-extension") && | 797 manifest_url.SchemeIs(extensions::kExtensionScheme) && |
| 798 manifest_url.host() == "acadkphlmlegjaadjagenfimbpphcgnh"); | 798 manifest_url.host() == "acadkphlmlegjaadjagenfimbpphcgnh"); |
| 799 | 799 |
| 800 // Allow Chrome Web Store extensions, built-in extensions and extensions | 800 // Allow Chrome Web Store extensions, built-in extensions and extensions |
| 801 // under development if the invocation comes from a URL with an extension | 801 // under development if the invocation comes from a URL with an extension |
| 802 // scheme. Also allow invocations if they are from whitelisted URLs or | 802 // scheme. Also allow invocations if they are from whitelisted URLs or |
| 803 // if --enable-nacl is set. | 803 // if --enable-nacl is set. |
| 804 bool is_nacl_allowed = is_nacl_unrestricted || | 804 bool is_nacl_allowed = is_nacl_unrestricted || |
| 805 is_whitelisted_url || | 805 is_whitelisted_url || |
| 806 is_nacl_pdf_viewer || | 806 is_nacl_pdf_viewer || |
| 807 is_invoked_by_hosted_app || | 807 is_invoked_by_hosted_app || |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 } | 1276 } |
| 1277 // Allow access for tests. | 1277 // Allow access for tests. |
| 1278 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1278 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1279 switches::kEnablePepperTesting)) { | 1279 switches::kEnablePepperTesting)) { |
| 1280 return true; | 1280 return true; |
| 1281 } | 1281 } |
| 1282 #endif // !defined(OS_ANDROID) | 1282 #endif // !defined(OS_ANDROID) |
| 1283 return false; | 1283 return false; |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 bool ChromeContentRendererClient::ShouldReportDetailedMessage( | |
| 1287 const GURL& url) const { | |
| 1288 // Currently, we are only interested in anything caused by an extension. | |
| 1289 // A source came from an extension if it is either directly from the | |
| 1290 // extension's url (chrome-extension://), or if it did not come from a real | |
| 1291 // url at all (as in the source being "event_bindings"). | |
|
Matt Perry
2013/07/15 21:35:31
I'm not sure the latter assertion is true (e.g. ma
Devlin
2013/07/16 01:41:28
Done.
| |
| 1292 return !url.is_empty() && | |
| 1293 (!url.is_valid() || url.SchemeIs(extensions::kExtensionScheme)); | |
| 1294 } | |
| 1286 | 1295 |
| 1287 } // namespace chrome | 1296 } // namespace chrome |
| OLD | NEW |