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/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/metrics/user_metrics_action.h" | 12 #include "base/metrics/user_metrics_action.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/common/channel_info.h" |
17 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/chrome_version_info.h" | |
20 #include "chrome/common/crash_keys.h" | 20 #include "chrome/common/crash_keys.h" |
21 #include "chrome/common/extensions/extension_metrics.h" | 21 #include "chrome/common/extensions/extension_metrics.h" |
22 #include "chrome/common/localized_error.h" | 22 #include "chrome/common/localized_error.h" |
23 #include "chrome/common/pepper_permission_util.h" | 23 #include "chrome/common/pepper_permission_util.h" |
24 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
25 #include "chrome/common/secure_origin_whitelist.h" | 25 #include "chrome/common/secure_origin_whitelist.h" |
26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
28 #include "chrome/grit/locale_settings.h" | 28 #include "chrome/grit/locale_settings.h" |
29 #include "chrome/grit/renderer_resources.h" | 29 #include "chrome/grit/renderer_resources.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "components/content_settings/core/common/content_settings_pattern.h" | 61 #include "components/content_settings/core/common/content_settings_pattern.h" |
62 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" | 62 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade
rs.h" |
63 #include "components/dom_distiller/core/url_constants.h" | 63 #include "components/dom_distiller/core/url_constants.h" |
64 #include "components/nacl/renderer/ppb_nacl_private.h" | 64 #include "components/nacl/renderer/ppb_nacl_private.h" |
65 #include "components/nacl/renderer/ppb_nacl_private_impl.h" | 65 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
66 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 66 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
67 #include "components/password_manager/content/renderer/credential_manager_client
.h" | 67 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
68 #include "components/pdf/renderer/pepper_pdf_host.h" | 68 #include "components/pdf/renderer/pepper_pdf_host.h" |
69 #include "components/plugins/renderer/mobile_youtube_plugin.h" | 69 #include "components/plugins/renderer/mobile_youtube_plugin.h" |
70 #include "components/signin/core/common/profile_management_switches.h" | 70 #include "components/signin/core/common/profile_management_switches.h" |
| 71 #include "components/version_info/version_info.h" |
71 #include "components/visitedlink/renderer/visitedlink_slave.h" | 72 #include "components/visitedlink/renderer/visitedlink_slave.h" |
72 #include "components/web_cache/renderer/web_cache_render_process_observer.h" | 73 #include "components/web_cache/renderer/web_cache_render_process_observer.h" |
73 #include "content/public/common/content_constants.h" | 74 #include "content/public/common/content_constants.h" |
74 #include "content/public/renderer/plugin_instance_throttler.h" | 75 #include "content/public/renderer/plugin_instance_throttler.h" |
75 #include "content/public/renderer/render_frame.h" | 76 #include "content/public/renderer/render_frame.h" |
76 #include "content/public/renderer/render_thread.h" | 77 #include "content/public/renderer/render_thread.h" |
77 #include "content/public/renderer/render_view.h" | 78 #include "content/public/renderer/render_view.h" |
78 #include "content/public/renderer/render_view_visitor.h" | 79 #include "content/public/renderer/render_view_visitor.h" |
79 #include "extensions/common/constants.h" | 80 #include "extensions/common/constants.h" |
80 #include "ipc/ipc_sync_channel.h" | 81 #include "ipc/ipc_sync_channel.h" |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 } | 1536 } |
1536 | 1537 |
1537 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { | 1538 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { |
1538 #if defined(ENABLE_PLUGINS) | 1539 #if defined(ENABLE_PLUGINS) |
1539 // Allow access for tests. | 1540 // Allow access for tests. |
1540 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1541 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1541 switches::kEnablePepperTesting)) { | 1542 switches::kEnablePepperTesting)) { |
1542 return true; | 1543 return true; |
1543 } | 1544 } |
1544 | 1545 |
1545 version_info::Channel channel = chrome::VersionInfo::GetChannel(); | 1546 version_info::Channel channel = chrome::GetChannel(); |
1546 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" | 1547 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" |
1547 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 1548 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
1548 // Chromium builds as well. | 1549 // Chromium builds as well. |
1549 return channel <= version_info::Channel::DEV; | 1550 return channel <= version_info::Channel::DEV; |
1550 #else | 1551 #else |
1551 return false; | 1552 return false; |
1552 #endif | 1553 #endif |
1553 } | 1554 } |
1554 | 1555 |
1555 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( | 1556 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( |
(...skipping 12 matching lines...) Expand all Loading... |
1568 | 1569 |
1569 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( | 1570 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( |
1570 const GURL& url) { | 1571 const GURL& url) { |
1571 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1572 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
1572 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1573 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1573 switches::kEnablePepperTesting)) | 1574 switches::kEnablePepperTesting)) |
1574 return true; | 1575 return true; |
1575 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) | 1576 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) |
1576 return true; | 1577 return true; |
1577 | 1578 |
1578 version_info::Channel channel = chrome::VersionInfo::GetChannel(); | 1579 version_info::Channel channel = chrome::GetChannel(); |
1579 return channel <= version_info::Channel::DEV; | 1580 return channel <= version_info::Channel::DEV; |
1580 #else | 1581 #else |
1581 return false; | 1582 return false; |
1582 #endif | 1583 #endif |
1583 } | 1584 } |
1584 | 1585 |
1585 content::BrowserPluginDelegate* | 1586 content::BrowserPluginDelegate* |
1586 ChromeContentRendererClient::CreateBrowserPluginDelegate( | 1587 ChromeContentRendererClient::CreateBrowserPluginDelegate( |
1587 content::RenderFrame* render_frame, | 1588 content::RenderFrame* render_frame, |
1588 const std::string& mime_type, | 1589 const std::string& mime_type, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 WebString header_key(ASCIIToUTF16( | 1624 WebString header_key(ASCIIToUTF16( |
1624 data_reduction_proxy::chrome_proxy_header())); | 1625 data_reduction_proxy::chrome_proxy_header())); |
1625 if (!response.httpHeaderField(header_key).isNull() && | 1626 if (!response.httpHeaderField(header_key).isNull() && |
1626 response.httpHeaderField(header_key).utf8().find( | 1627 response.httpHeaderField(header_key).utf8().find( |
1627 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != | 1628 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != |
1628 std::string::npos) { | 1629 std::string::npos) { |
1629 (*properties)[data_reduction_proxy::chrome_proxy_header()] = | 1630 (*properties)[data_reduction_proxy::chrome_proxy_header()] = |
1630 data_reduction_proxy::chrome_proxy_lo_fi_directive(); | 1631 data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
1631 } | 1632 } |
1632 } | 1633 } |
OLD | NEW |