| 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/process/kill.h" | 23 #include "base/process/kill.h" |
| 24 #include "base/process/process.h" | 24 #include "base/process/process.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/string_piece.h" | 26 #include "base/strings/string_piece.h" |
| 27 #include "base/strings/string_split.h" | 27 #include "base/strings/string_split.h" |
| 28 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
| 29 #include "base/strings/sys_string_conversions.h" | 29 #include "base/strings/sys_string_conversions.h" |
| 30 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 31 #include "base/time/time.h" | 31 #include "base/time/time.h" |
| 32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
| 33 #include "build/build_config.h" |
| 33 #include "content/child/appcache/appcache_dispatcher.h" | 34 #include "content/child/appcache/appcache_dispatcher.h" |
| 34 #include "content/child/appcache/web_application_cache_host_impl.h" | 35 #include "content/child/appcache/web_application_cache_host_impl.h" |
| 35 #include "content/child/child_shared_bitmap_manager.h" | 36 #include "content/child/child_shared_bitmap_manager.h" |
| 36 #include "content/child/npapi/webplugin_delegate_impl.h" | 37 #include "content/child/npapi/webplugin_delegate_impl.h" |
| 37 #include "content/child/request_extra_data.h" | 38 #include "content/child/request_extra_data.h" |
| 38 #include "content/child/v8_value_converter_impl.h" | 39 #include "content/child/v8_value_converter_impl.h" |
| 39 #include "content/child/webmessageportchannel_impl.h" | 40 #include "content/child/webmessageportchannel_impl.h" |
| 40 #include "content/common/content_constants_internal.h" | 41 #include "content/common/content_constants_internal.h" |
| 41 #include "content/common/content_switches_internal.h" | 42 #include "content/common/content_switches_internal.h" |
| 42 #include "content/common/database_messages.h" | 43 #include "content/common/database_messages.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 using blink::WebFloatRect; | 280 using blink::WebFloatRect; |
| 280 using blink::WebHitTestResult; | 281 using blink::WebHitTestResult; |
| 281 #endif | 282 #endif |
| 282 | 283 |
| 283 namespace content { | 284 namespace content { |
| 284 | 285 |
| 285 //----------------------------------------------------------------------------- | 286 //----------------------------------------------------------------------------- |
| 286 | 287 |
| 287 typedef std::map<blink::WebView*, RenderViewImpl*> ViewMap; | 288 typedef std::map<blink::WebView*, RenderViewImpl*> ViewMap; |
| 288 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER; | 289 static base::LazyInstance<ViewMap> g_view_map = LAZY_INSTANCE_INITIALIZER; |
| 289 typedef std::map<int32, RenderViewImpl*> RoutingIDViewMap; | 290 typedef std::map<int32_t, RenderViewImpl*> RoutingIDViewMap; |
| 290 static base::LazyInstance<RoutingIDViewMap> g_routing_id_view_map = | 291 static base::LazyInstance<RoutingIDViewMap> g_routing_id_view_map = |
| 291 LAZY_INSTANCE_INITIALIZER; | 292 LAZY_INSTANCE_INITIALIZER; |
| 292 | 293 |
| 293 // Time, in seconds, we delay before sending content state changes (such as form | 294 // Time, in seconds, we delay before sending content state changes (such as form |
| 294 // state and scroll position) to the browser. We delay sending changes to avoid | 295 // state and scroll position) to the browser. We delay sending changes to avoid |
| 295 // spamming the browser. | 296 // spamming the browser. |
| 296 // To avoid having tab/session restore require sending a message to get the | 297 // To avoid having tab/session restore require sending a message to get the |
| 297 // current content state during tab closing we use a shorter timeout for the | 298 // current content state during tab closing we use a shorter timeout for the |
| 298 // foreground renderer. This means there is a small window of time from which | 299 // foreground renderer. This means there is a small window of time from which |
| 299 // content state is modified and not sent to session restore, but this is | 300 // content state is modified and not sent to session restore, but this is |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 default: | 571 default: |
| 571 return scriptCode; | 572 return scriptCode; |
| 572 } | 573 } |
| 573 } | 574 } |
| 574 | 575 |
| 575 void ApplyFontsFromMap(const ScriptFontFamilyMap& map, | 576 void ApplyFontsFromMap(const ScriptFontFamilyMap& map, |
| 576 SetFontFamilyWrapper setter, | 577 SetFontFamilyWrapper setter, |
| 577 WebSettings* settings) { | 578 WebSettings* settings) { |
| 578 for (ScriptFontFamilyMap::const_iterator it = map.begin(); it != map.end(); | 579 for (ScriptFontFamilyMap::const_iterator it = map.begin(); it != map.end(); |
| 579 ++it) { | 580 ++it) { |
| 580 int32 script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); | 581 int32_t script = u_getPropertyValueEnum(UCHAR_SCRIPT, (it->first).c_str()); |
| 581 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { | 582 if (script >= 0 && script < USCRIPT_CODE_LIMIT) { |
| 582 UScriptCode code = static_cast<UScriptCode>(script); | 583 UScriptCode code = static_cast<UScriptCode>(script); |
| 583 (*setter)(settings, it->second, GetScriptForWebSettings(code)); | 584 (*setter)(settings, it->second, GetScriptForWebSettings(code)); |
| 584 } | 585 } |
| 585 } | 586 } |
| 586 } | 587 } |
| 587 | 588 |
| 588 void ApplyBlinkSettings(const base::CommandLine& command_line, | 589 void ApplyBlinkSettings(const base::CommandLine& command_line, |
| 589 WebSettings* settings) { | 590 WebSettings* settings) { |
| 590 if (!command_line.HasSwitch(switches::kBlinkSettings)) | 591 if (!command_line.HasSwitch(switches::kBlinkSettings)) |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 ViewMap::iterator it = views->find(webview); | 854 ViewMap::iterator it = views->find(webview); |
| 854 return it == views->end() ? NULL : it->second; | 855 return it == views->end() ? NULL : it->second; |
| 855 } | 856 } |
| 856 | 857 |
| 857 /*static*/ | 858 /*static*/ |
| 858 RenderView* RenderView::FromWebView(blink::WebView* webview) { | 859 RenderView* RenderView::FromWebView(blink::WebView* webview) { |
| 859 return RenderViewImpl::FromWebView(webview); | 860 return RenderViewImpl::FromWebView(webview); |
| 860 } | 861 } |
| 861 | 862 |
| 862 /*static*/ | 863 /*static*/ |
| 863 RenderViewImpl* RenderViewImpl::FromRoutingID(int32 routing_id) { | 864 RenderViewImpl* RenderViewImpl::FromRoutingID(int32_t routing_id) { |
| 864 RoutingIDViewMap* views = g_routing_id_view_map.Pointer(); | 865 RoutingIDViewMap* views = g_routing_id_view_map.Pointer(); |
| 865 RoutingIDViewMap::iterator it = views->find(routing_id); | 866 RoutingIDViewMap::iterator it = views->find(routing_id); |
| 866 return it == views->end() ? NULL : it->second; | 867 return it == views->end() ? NULL : it->second; |
| 867 } | 868 } |
| 868 | 869 |
| 869 /*static*/ | 870 /*static*/ |
| 870 RenderView* RenderView::FromRoutingID(int routing_id) { | 871 RenderView* RenderView::FromRoutingID(int routing_id) { |
| 871 return RenderViewImpl::FromRoutingID(routing_id); | 872 return RenderViewImpl::FromRoutingID(routing_id); |
| 872 } | 873 } |
| 873 | 874 |
| (...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3726 if (IsUseZoomForDSFEnabled()) { | 3727 if (IsUseZoomForDSFEnabled()) { |
| 3727 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3728 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3728 } else { | 3729 } else { |
| 3729 webview()->setDeviceScaleFactor(device_scale_factor_); | 3730 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3730 } | 3731 } |
| 3731 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3732 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3732 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3733 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3733 } | 3734 } |
| 3734 | 3735 |
| 3735 } // namespace content | 3736 } // namespace content |
| OLD | NEW |