| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // antialiasing won't have a noticeable effect on text quality. | 360 // antialiasing won't have a noticeable effect on text quality. |
| 361 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { | 361 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { |
| 362 #if defined(OS_ANDROID) | 362 #if defined(OS_ANDROID) |
| 363 // On Android, we never have subpixel antialiasing. | 363 // On Android, we never have subpixel antialiasing. |
| 364 return true; | 364 return true; |
| 365 #else | 365 #else |
| 366 // 1.5 is a common touchscreen tablet device scale factor. For such | 366 // 1.5 is a common touchscreen tablet device scale factor. For such |
| 367 // devices main thread antialiasing is a heavy burden. | 367 // devices main thread antialiasing is a heavy burden. |
| 368 return device_scale_factor >= 1.5f; | 368 return device_scale_factor >= 1.5f; |
| 369 #endif | 369 #endif |
| 370 | |
| 371 } | 370 } |
| 372 | 371 |
| 373 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps, | 372 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps, |
| 374 float device_scale_factor) { | 373 float device_scale_factor) { |
| 375 const base::CommandLine& command_line = | 374 const base::CommandLine& command_line = |
| 376 *base::CommandLine::ForCurrentProcess(); | 375 *base::CommandLine::ForCurrentProcess(); |
| 377 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) | 376 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) |
| 378 return false; | 377 return false; |
| 379 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) | 378 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) |
| 380 return true; | 379 return true; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 666 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 668 bool was_created_by_renderer) { | 667 bool was_created_by_renderer) { |
| 669 routing_id_ = params.view_id; | 668 routing_id_ = params.view_id; |
| 670 | 669 |
| 671 int opener_view_routing_id; | 670 int opener_view_routing_id; |
| 672 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 671 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 673 params.opener_frame_route_id, &opener_view_routing_id); | 672 params.opener_frame_route_id, &opener_view_routing_id); |
| 674 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) | 673 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) |
| 675 opener_id_ = opener_view_routing_id; | 674 opener_id_ = opener_view_routing_id; |
| 676 | 675 |
| 677 display_mode_= params.initial_size.display_mode; | 676 display_mode_ = params.initial_size.display_mode; |
| 678 | 677 |
| 679 // Ensure we start with a valid next_page_id_ from the browser. | 678 // Ensure we start with a valid next_page_id_ from the browser. |
| 680 DCHECK_GE(next_page_id_, 0); | 679 DCHECK_GE(next_page_id_, 0); |
| 681 | 680 |
| 682 webwidget_ = WebView::create(this); | 681 webwidget_ = WebView::create(this); |
| 683 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 682 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
| 684 | 683 |
| 685 g_view_map.Get().insert(std::make_pair(webview(), this)); | 684 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 686 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 685 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 687 | 686 |
| (...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 if (plugin_find_handler_) | 2285 if (plugin_find_handler_) |
| 2287 return plugin_find_handler_->container()->plugin(); | 2286 return plugin_find_handler_->container()->plugin(); |
| 2288 #endif | 2287 #endif |
| 2289 | 2288 |
| 2290 return NULL; | 2289 return NULL; |
| 2291 } | 2290 } |
| 2292 | 2291 |
| 2293 void RenderViewImpl::OnFind(int request_id, | 2292 void RenderViewImpl::OnFind(int request_id, |
| 2294 const base::string16& search_text, | 2293 const base::string16& search_text, |
| 2295 const WebFindOptions& options) { | 2294 const WebFindOptions& options) { |
| 2295 DCHECK(!search_text.empty()); |
| 2296 |
| 2296 WebFrame* main_frame = webview()->mainFrame(); | 2297 WebFrame* main_frame = webview()->mainFrame(); |
| 2297 blink::WebPlugin* plugin = GetWebPluginForFind(); | 2298 blink::WebPlugin* plugin = GetWebPluginForFind(); |
| 2298 // Check if the plugin still exists in the document. | 2299 // Check if the plugin still exists in the document. |
| 2299 if (plugin) { | 2300 if (plugin) { |
| 2300 if (options.findNext) { | 2301 if (options.findNext) { |
| 2301 // Just navigate back/forward. | 2302 // Just navigate back/forward. |
| 2302 plugin->selectFindResult(options.forward); | 2303 plugin->selectFindResult(options.forward); |
| 2303 } else { | 2304 } else { |
| 2304 if (!plugin->startFind( | 2305 if (!plugin->startFind( |
| 2305 search_text, options.matchCase, request_id)) { | 2306 search_text, options.matchCase, request_id)) { |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3074 (*i)->PageVisibilityChanged(false); | 3075 (*i)->PageVisibilityChanged(false); |
| 3075 | 3076 |
| 3076 #if defined(OS_MACOSX) | 3077 #if defined(OS_MACOSX) |
| 3077 // Inform NPAPI plugins that their container is no longer visible. | 3078 // Inform NPAPI plugins that their container is no longer visible. |
| 3078 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 3079 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 3079 for (plugin_it = plugin_delegates_.begin(); | 3080 for (plugin_it = plugin_delegates_.begin(); |
| 3080 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3081 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 3081 (*plugin_it)->SetContainerVisibility(false); | 3082 (*plugin_it)->SetContainerVisibility(false); |
| 3082 } | 3083 } |
| 3083 #endif // OS_MACOSX | 3084 #endif // OS_MACOSX |
| 3084 #endif // ENABLE_PLUGINS | 3085 #endif // ENABLE_PLUGINS |
| 3085 } | 3086 } |
| 3086 | 3087 |
| 3087 void RenderViewImpl::OnWasShown(bool needs_repainting, | 3088 void RenderViewImpl::OnWasShown(bool needs_repainting, |
| 3088 const ui::LatencyInfo& latency_info) { | 3089 const ui::LatencyInfo& latency_info) { |
| 3089 RenderWidget::OnWasShown(needs_repainting, latency_info); | 3090 RenderWidget::OnWasShown(needs_repainting, latency_info); |
| 3090 | 3091 |
| 3091 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 3092 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| 3092 RenderThreadImpl::current()->video_capture_impl_manager()-> | 3093 RenderThreadImpl::current()->video_capture_impl_manager()-> |
| 3093 SuspendDevices(false); | 3094 SuspendDevices(false); |
| 3094 #endif | 3095 #endif |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3738 std::vector<gfx::Size> sizes; | 3739 std::vector<gfx::Size> sizes; |
| 3739 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3740 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3740 if (!url.isEmpty()) | 3741 if (!url.isEmpty()) |
| 3741 urls.push_back( | 3742 urls.push_back( |
| 3742 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3743 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3743 } | 3744 } |
| 3744 SendUpdateFaviconURL(urls); | 3745 SendUpdateFaviconURL(urls); |
| 3745 } | 3746 } |
| 3746 | 3747 |
| 3747 } // namespace content | 3748 } // namespace content |
| OLD | NEW |