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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/metrics/user_metrics_action.h" | 15 #include "base/metrics/user_metrics_action.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/time/time.h" | |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chrome/common/channel_info.h" | 22 #include "chrome/common/channel_info.h" |
22 #include "chrome/common/chrome_isolated_world_ids.h" | 23 #include "chrome/common/chrome_isolated_world_ids.h" |
23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/crash_keys.h" | 26 #include "chrome/common/crash_keys.h" |
26 #include "chrome/common/pepper_permission_util.h" | 27 #include "chrome/common/pepper_permission_util.h" |
27 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
28 #include "chrome/common/secure_origin_whitelist.h" | 29 #include "chrome/common/secure_origin_whitelist.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 #include "components/dom_distiller/core/url_constants.h" | 68 #include "components/dom_distiller/core/url_constants.h" |
68 #include "components/error_page/common/localized_error.h" | 69 #include "components/error_page/common/localized_error.h" |
69 #include "components/nacl/renderer/ppb_nacl_private.h" | 70 #include "components/nacl/renderer/ppb_nacl_private.h" |
70 #include "components/nacl/renderer/ppb_nacl_private_impl.h" | 71 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
71 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" | 72 #include "components/network_hints/renderer/prescient_networking_dispatcher.h" |
72 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" | 73 #include "components/page_load_metrics/renderer/metrics_render_frame_observer.h" |
73 #include "components/password_manager/content/renderer/credential_manager_client .h" | 74 #include "components/password_manager/content/renderer/credential_manager_client .h" |
74 #include "components/pdf/renderer/pepper_pdf_host.h" | 75 #include "components/pdf/renderer/pepper_pdf_host.h" |
75 #include "components/plugins/renderer/mobile_youtube_plugin.h" | 76 #include "components/plugins/renderer/mobile_youtube_plugin.h" |
76 #include "components/signin/core/common/profile_management_switches.h" | 77 #include "components/signin/core/common/profile_management_switches.h" |
78 #include "components/startup_metric_utils/common/startup_metric_messages.h" | |
77 #include "components/version_info/version_info.h" | 79 #include "components/version_info/version_info.h" |
78 #include "components/visitedlink/renderer/visitedlink_slave.h" | 80 #include "components/visitedlink/renderer/visitedlink_slave.h" |
79 #include "components/web_cache/renderer/web_cache_render_process_observer.h" | 81 #include "components/web_cache/renderer/web_cache_render_process_observer.h" |
80 #include "content/public/common/content_constants.h" | 82 #include "content/public/common/content_constants.h" |
81 #include "content/public/common/content_switches.h" | 83 #include "content/public/common/content_switches.h" |
82 #include "content/public/renderer/plugin_instance_throttler.h" | 84 #include "content/public/renderer/plugin_instance_throttler.h" |
83 #include "content/public/renderer/render_frame.h" | 85 #include "content/public/renderer/render_frame.h" |
84 #include "content/public/renderer/render_thread.h" | 86 #include "content/public/renderer/render_thread.h" |
85 #include "content/public/renderer/render_view.h" | 87 #include "content/public/renderer/render_view.h" |
86 #include "content/public/renderer/render_view_visitor.h" | 88 #include "content/public/renderer/render_view_visitor.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 delete this; | 292 delete this; |
291 } | 293 } |
292 | 294 |
293 const base::Closure continue_loading_cb_; | 295 const base::Closure continue_loading_cb_; |
294 | 296 |
295 DISALLOW_COPY_AND_ASSIGN(MediaLoadDeferrer); | 297 DISALLOW_COPY_AND_ASSIGN(MediaLoadDeferrer); |
296 }; | 298 }; |
297 | 299 |
298 } // namespace | 300 } // namespace |
299 | 301 |
300 ChromeContentRendererClient::ChromeContentRendererClient() { | 302 ChromeContentRendererClient::ChromeContentRendererClient() |
303 : renderer_main_entry_time_(base::TimeTicks::Now()) { | |
jam
2016/02/02 23:53:18
nit: renderer_ is redundant
fdoray
2016/02/03 02:56:51
Done.
| |
301 #if defined(ENABLE_EXTENSIONS) | 304 #if defined(ENABLE_EXTENSIONS) |
302 extensions::ExtensionsClient::Set( | 305 extensions::ExtensionsClient::Set( |
303 extensions::ChromeExtensionsClient::GetInstance()); | 306 extensions::ChromeExtensionsClient::GetInstance()); |
304 extensions::ExtensionsRendererClient::Set( | 307 extensions::ExtensionsRendererClient::Set( |
305 ChromeExtensionsRendererClient::GetInstance()); | 308 ChromeExtensionsRendererClient::GetInstance()); |
306 #endif | 309 #endif |
307 #if defined(ENABLE_PLUGINS) | 310 #if defined(ENABLE_PLUGINS) |
308 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) | 311 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) |
309 allowed_camera_device_origins_.insert( | 312 allowed_camera_device_origins_.insert( |
310 kPredefinedAllowedCameraDeviceOrigins[i]); | 313 kPredefinedAllowedCameraDeviceOrigins[i]); |
311 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) | 314 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) |
312 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); | 315 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); |
313 #endif | 316 #endif |
314 #if defined(ENABLE_PRINTING) | 317 #if defined(ENABLE_PRINTING) |
315 printing::SetAgent(GetUserAgent()); | 318 printing::SetAgent(GetUserAgent()); |
316 #endif | 319 #endif |
317 } | 320 } |
318 | 321 |
319 ChromeContentRendererClient::~ChromeContentRendererClient() { | 322 ChromeContentRendererClient::~ChromeContentRendererClient() { |
320 } | 323 } |
321 | 324 |
322 void ChromeContentRendererClient::RenderThreadStarted() { | 325 void ChromeContentRendererClient::RenderThreadStarted() { |
323 RenderThread* thread = RenderThread::Get(); | 326 RenderThread* thread = RenderThread::Get(); |
324 | 327 |
328 thread->Send(new StartupMetricHostMsg_RecordRendererMainEntryTime( | |
329 renderer_main_entry_time_)); | |
330 | |
325 chrome_observer_.reset(new ChromeRenderProcessObserver()); | 331 chrome_observer_.reset(new ChromeRenderProcessObserver()); |
326 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); | 332 web_cache_observer_.reset(new web_cache::WebCacheRenderProcessObserver()); |
327 | 333 |
328 #if defined(ENABLE_EXTENSIONS) | 334 #if defined(ENABLE_EXTENSIONS) |
329 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); | 335 ChromeExtensionsRendererClient::GetInstance()->RenderThreadStarted(); |
330 #endif | 336 #endif |
331 | 337 |
332 prescient_networking_dispatcher_.reset( | 338 prescient_networking_dispatcher_.reset( |
333 new network_hints::PrescientNetworkingDispatcher()); | 339 new network_hints::PrescientNetworkingDispatcher()); |
334 #if defined(ENABLE_SPELLCHECK) | 340 #if defined(ENABLE_SPELLCHECK) |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 // chrome.system.network.getNetworkInterfaces provides the same | 1420 // chrome.system.network.getNetworkInterfaces provides the same |
1415 // information. Also, the enforcement of sending and binding UDP is already done | 1421 // information. Also, the enforcement of sending and binding UDP is already done |
1416 // by chrome extension permission model. | 1422 // by chrome extension permission model. |
1417 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { | 1423 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { |
1418 #if defined(ENABLE_EXTENSIONS) | 1424 #if defined(ENABLE_EXTENSIONS) |
1419 return !IsStandaloneExtensionProcess(); | 1425 return !IsStandaloneExtensionProcess(); |
1420 #else | 1426 #else |
1421 return true; | 1427 return true; |
1422 #endif | 1428 #endif |
1423 } | 1429 } |
OLD | NEW |