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 "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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "content/common/content_constants_internal.h" | 43 #include "content/common/content_constants_internal.h" |
| 44 #include "content/common/content_switches_internal.h" | 44 #include "content/common/content_switches_internal.h" |
| 45 #include "content/common/database_messages.h" | 45 #include "content/common/database_messages.h" |
| 46 #include "content/common/dom_storage/dom_storage_types.h" | 46 #include "content/common/dom_storage/dom_storage_types.h" |
| 47 #include "content/common/drag_messages.h" | 47 #include "content/common/drag_messages.h" |
| 48 #include "content/common/frame_messages.h" | 48 #include "content/common/frame_messages.h" |
| 49 #include "content/common/frame_replication_state.h" | 49 #include "content/common/frame_replication_state.h" |
| 50 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 50 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 51 #include "content/common/input/input_event_utils.h" | 51 #include "content/common/input/input_event_utils.h" |
| 52 #include "content/common/input_messages.h" | 52 #include "content/common/input_messages.h" |
| 53 #include "content/common/page_messages.h" | |
| 54 #include "content/common/pepper_messages.h" | 53 #include "content/common/pepper_messages.h" |
| 55 #include "content/common/site_isolation_policy.h" | 54 #include "content/common/site_isolation_policy.h" |
| 56 #include "content/common/ssl_status_serialization.h" | 55 #include "content/common/ssl_status_serialization.h" |
| 57 #include "content/common/view_messages.h" | 56 #include "content/common/view_messages.h" |
| 58 #include "content/public/common/bindings_policy.h" | 57 #include "content/public/common/bindings_policy.h" |
| 59 #include "content/public/common/content_client.h" | 58 #include "content/public/common/content_client.h" |
| 60 #include "content/public/common/content_constants.h" | 59 #include "content/public/common/content_constants.h" |
| 61 #include "content/public/common/content_switches.h" | 60 #include "content/public/common/content_switches.h" |
| 62 #include "content/public/common/drop_data.h" | 61 #include "content/public/common/drop_data.h" |
| 63 #include "content/public/common/favicon_url.h" | 62 #include "content/public/common/favicon_url.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 history_list_offset_(-1), | 623 history_list_offset_(-1), |
| 625 history_list_length_(0), | 624 history_list_length_(0), |
| 626 frames_in_progress_(0), | 625 frames_in_progress_(0), |
| 627 target_url_status_(TARGET_NONE), | 626 target_url_status_(TARGET_NONE), |
| 628 uses_temporary_zoom_level_(false), | 627 uses_temporary_zoom_level_(false), |
| 629 #if defined(OS_ANDROID) | 628 #if defined(OS_ANDROID) |
| 630 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), | 629 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), |
| 631 #endif | 630 #endif |
| 632 has_focus_(false), | 631 has_focus_(false), |
| 633 has_scrolled_focused_editable_node_into_rect_(false), | 632 has_scrolled_focused_editable_node_into_rect_(false), |
| 633 preferred_subframe_zoom_level_(params.preferred_subframe_zoom_level), | |
| 634 main_render_frame_(nullptr), | 634 main_render_frame_(nullptr), |
| 635 frame_widget_(nullptr), | 635 frame_widget_(nullptr), |
| 636 speech_recognition_dispatcher_(NULL), | 636 speech_recognition_dispatcher_(NULL), |
| 637 mouse_lock_dispatcher_(NULL), | 637 mouse_lock_dispatcher_(NULL), |
| 638 #if defined(OS_ANDROID) | 638 #if defined(OS_ANDROID) |
| 639 expected_content_intent_id_(0), | 639 expected_content_intent_id_(0), |
| 640 #endif | 640 #endif |
| 641 #if defined(ENABLE_PLUGINS) | 641 #if defined(ENABLE_PLUGINS) |
| 642 focused_pepper_plugin_(NULL), | 642 focused_pepper_plugin_(NULL), |
| 643 pepper_last_mouse_event_target_(NULL), | 643 pepper_last_mouse_event_target_(NULL), |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 GetContentClient()->renderer()->RenderViewCreated(this); | 795 GetContentClient()->renderer()->RenderViewCreated(this); |
| 796 | 796 |
| 797 // Ensure that sandbox flags are inherited from an opener in a different | 797 // Ensure that sandbox flags are inherited from an opener in a different |
| 798 // process. In that case, the browser process will set any inherited sandbox | 798 // process. In that case, the browser process will set any inherited sandbox |
| 799 // flags in |replicated_frame_state|, so apply them here. | 799 // flags in |replicated_frame_state|, so apply them here. |
| 800 if (opener_frame && !was_created_by_renderer && | 800 if (opener_frame && !was_created_by_renderer && |
| 801 webview()->mainFrame()->isWebLocalFrame()) { | 801 webview()->mainFrame()->isWebLocalFrame()) { |
| 802 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( | 802 webview()->mainFrame()->toWebLocalFrame()->forceSandboxFlags( |
| 803 params.replicated_frame_state.sandbox_flags); | 803 params.replicated_frame_state.sandbox_flags); |
| 804 } | 804 } |
| 805 | |
| 806 preferred_subframe_zoom_level_ = params.preferred_subframe_zoom_level; | |
| 805 } | 807 } |
| 806 | 808 |
| 807 RenderViewImpl::~RenderViewImpl() { | 809 RenderViewImpl::~RenderViewImpl() { |
| 808 DCHECK(!frame_widget_); | 810 DCHECK(!frame_widget_); |
| 809 | 811 |
| 810 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); | 812 for (BitmapMap::iterator it = disambiguation_bitmaps_.begin(); |
| 811 it != disambiguation_bitmaps_.end(); | 813 it != disambiguation_bitmaps_.end(); |
| 812 ++it) | 814 ++it) |
| 813 delete it->second; | 815 delete it->second; |
| 814 | 816 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1330 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, | 1332 IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, |
| 1331 OnScrollFocusedEditableNodeIntoRect) | 1333 OnScrollFocusedEditableNodeIntoRect) |
| 1332 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, | 1334 IPC_MESSAGE_HANDLER(InputMsg_SetEditCommandsForNextKeyEvent, |
| 1333 OnSetEditCommandsForNextKeyEvent) | 1335 OnSetEditCommandsForNextKeyEvent) |
| 1334 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) | 1336 IPC_MESSAGE_HANDLER(ViewMsg_CopyImageAt, OnCopyImageAt) |
| 1335 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) | 1337 IPC_MESSAGE_HANDLER(ViewMsg_SaveImageAt, OnSaveImageAt) |
| 1336 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) | 1338 IPC_MESSAGE_HANDLER(ViewMsg_SetPageScale, OnSetPageScale) |
| 1337 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) | 1339 IPC_MESSAGE_HANDLER(ViewMsg_Zoom, OnZoom) |
| 1338 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, | 1340 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL, |
| 1339 OnSetZoomLevelForLoadingURL) | 1341 OnSetZoomLevelForLoadingURL) |
| 1340 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForView, | |
| 1341 OnSetZoomLevelForView) | |
| 1342 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) | 1342 IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding) |
| 1343 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, | 1343 IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault, |
| 1344 OnResetPageEncodingToDefault) | 1344 OnResetPageEncodingToDefault) |
| 1345 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) | 1345 IPC_MESSAGE_HANDLER(DragMsg_TargetDragEnter, OnDragTargetDragEnter) |
| 1346 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) | 1346 IPC_MESSAGE_HANDLER(DragMsg_TargetDragOver, OnDragTargetDragOver) |
| 1347 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) | 1347 IPC_MESSAGE_HANDLER(DragMsg_TargetDragLeave, OnDragTargetDragLeave) |
| 1348 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) | 1348 IPC_MESSAGE_HANDLER(DragMsg_TargetDrop, OnDragTargetDrop) |
| 1349 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1349 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
| 1350 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1350 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| 1351 OnDragSourceSystemDragEnded) | 1351 OnDragSourceSystemDragEnded) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1374 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) | 1374 IPC_MESSAGE_HANDLER(ViewMsg_PluginActionAt, OnPluginActionAt) |
| 1375 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) | 1375 IPC_MESSAGE_HANDLER(ViewMsg_SetActive, OnSetActive) |
| 1376 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) | 1376 IPC_MESSAGE_HANDLER(ViewMsg_ShowContextMenu, OnShowContextMenu) |
| 1377 // TODO(viettrungluu): Move to a separate message filter. | 1377 // TODO(viettrungluu): Move to a separate message filter. |
| 1378 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, | 1378 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryOffsetAndLength, |
| 1379 OnSetHistoryOffsetAndLength) | 1379 OnSetHistoryOffsetAndLength) |
| 1380 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, | 1380 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupBitmap, |
| 1381 OnReleaseDisambiguationPopupBitmap) | 1381 OnReleaseDisambiguationPopupBitmap) |
| 1382 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) | 1382 IPC_MESSAGE_HANDLER(ViewMsg_ForceRedraw, OnForceRedraw) |
| 1383 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) | 1383 IPC_MESSAGE_HANDLER(ViewMsg_SelectWordAroundCaret, OnSelectWordAroundCaret) |
| 1384 | |
| 1385 // Page messages. | |
| 1384 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, | 1386 IPC_MESSAGE_HANDLER(PageMsg_UpdateWindowScreenRect, |
| 1385 OnUpdateWindowScreenRect) | 1387 OnUpdateWindowScreenRect) |
| 1388 IPC_MESSAGE_HANDLER(PageMsg_SetZoomLevel, OnSetZoomLevelForView) | |
|
alexmos
2016/04/07 23:48:08
nit: might be better if the function name matched
ncarter (slow)
2016/04/11 22:17:03
Agree with this.
wjmaclean
2016/04/13 18:47:47
Done.
| |
| 1386 #if defined(OS_ANDROID) | 1389 #if defined(OS_ANDROID) |
| 1387 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, | 1390 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTopControlsState, |
| 1388 OnUpdateTopControlsState) | 1391 OnUpdateTopControlsState) |
| 1389 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) | 1392 IPC_MESSAGE_HANDLER(ViewMsg_ExtractSmartClipData, OnExtractSmartClipData) |
| 1390 #elif defined(OS_MACOSX) | 1393 #elif defined(OS_MACOSX) |
| 1391 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, | 1394 IPC_MESSAGE_HANDLER(ViewMsg_GetRenderedText, |
| 1392 OnGetRenderedText) | 1395 OnGetRenderedText) |
| 1393 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1396 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
| 1394 OnPluginImeCompositionCompleted) | 1397 OnPluginImeCompositionCompleted) |
| 1395 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) | 1398 IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 view_params.swapped_out = false; | 1655 view_params.swapped_out = false; |
| 1653 // WebCore will take care of setting the correct name. | 1656 // WebCore will take care of setting the correct name. |
| 1654 view_params.replicated_frame_state = FrameReplicationState(); | 1657 view_params.replicated_frame_state = FrameReplicationState(); |
| 1655 view_params.hidden = (params.disposition == NEW_BACKGROUND_TAB); | 1658 view_params.hidden = (params.disposition == NEW_BACKGROUND_TAB); |
| 1656 view_params.never_visible = never_visible; | 1659 view_params.never_visible = never_visible; |
| 1657 view_params.next_page_id = 1; | 1660 view_params.next_page_id = 1; |
| 1658 view_params.initial_size = initial_size; | 1661 view_params.initial_size = initial_size; |
| 1659 view_params.enable_auto_resize = false; | 1662 view_params.enable_auto_resize = false; |
| 1660 view_params.min_size = gfx::Size(); | 1663 view_params.min_size = gfx::Size(); |
| 1661 view_params.max_size = gfx::Size(); | 1664 view_params.max_size = gfx::Size(); |
| 1665 view_params.preferred_subframe_zoom_level = preferred_subframe_zoom_level_; | |
| 1662 | 1666 |
| 1663 RenderViewImpl* view = | 1667 RenderViewImpl* view = |
| 1664 RenderViewImpl::Create(compositor_deps_, view_params, true); | 1668 RenderViewImpl::Create(compositor_deps_, view_params, true); |
| 1665 view->opened_by_user_gesture_ = params.user_gesture; | 1669 view->opened_by_user_gesture_ = params.user_gesture; |
| 1666 | 1670 |
| 1667 return view->webview(); | 1671 return view->webview(); |
| 1668 } | 1672 } |
| 1669 | 1673 |
| 1670 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { | 1674 WebWidget* RenderViewImpl::createPopupMenu(blink::WebPopupType popup_type) { |
| 1671 RenderWidget* widget = RenderWidget::Create(GetRoutingID(), compositor_deps_, | 1675 RenderWidget* widget = RenderWidget::Create(GetRoutingID(), compositor_deps_, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1725 } | 1729 } |
| 1726 } | 1730 } |
| 1727 | 1731 |
| 1728 void RenderViewImpl::AttachWebFrameWidget(blink::WebFrameWidget* frame_widget) { | 1732 void RenderViewImpl::AttachWebFrameWidget(blink::WebFrameWidget* frame_widget) { |
| 1729 // The previous WebFrameWidget must already be detached by CloseForFrame(). | 1733 // The previous WebFrameWidget must already be detached by CloseForFrame(). |
| 1730 DCHECK(!frame_widget_); | 1734 DCHECK(!frame_widget_); |
| 1731 frame_widget_ = frame_widget; | 1735 frame_widget_ = frame_widget; |
| 1732 } | 1736 } |
| 1733 | 1737 |
| 1734 void RenderViewImpl::SetZoomLevel(double zoom_level) { | 1738 void RenderViewImpl::SetZoomLevel(double zoom_level) { |
| 1739 // If we change the zoom level for the view, make sure any subsequent subframe | |
| 1740 // loads reflect the current zoom level. | |
| 1741 preferred_subframe_zoom_level_ = zoom_level; | |
| 1742 | |
| 1735 webview()->setZoomLevel(zoom_level); | 1743 webview()->setZoomLevel(zoom_level); |
| 1736 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); | 1744 FOR_EACH_OBSERVER(RenderViewObserver, observers_, OnZoomLevelChanged()); |
| 1737 } | 1745 } |
| 1738 | 1746 |
| 1739 void RenderViewImpl::didCancelCompositionOnSelectionChange() { | 1747 void RenderViewImpl::didCancelCompositionOnSelectionChange() { |
| 1740 Send(new InputHostMsg_ImeCancelComposition(GetRoutingID())); | 1748 Send(new InputHostMsg_ImeCancelComposition(GetRoutingID())); |
| 1741 } | 1749 } |
| 1742 | 1750 |
| 1743 bool RenderViewImpl::handleCurrentKeyboardEvent() { | 1751 bool RenderViewImpl::handleCurrentKeyboardEvent() { |
| 1744 if (edit_commands_.empty()) | 1752 if (edit_commands_.empty()) |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2337 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, | 2345 void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, |
| 2338 double zoom_level) { | 2346 double zoom_level) { |
| 2339 #if !defined(OS_ANDROID) | 2347 #if !defined(OS_ANDROID) |
| 2340 // On Android, page zoom isn't used, and in case of WebView, text zoom is used | 2348 // On Android, page zoom isn't used, and in case of WebView, text zoom is used |
| 2341 // for legacy WebView text scaling emulation. Thus, the code that resets | 2349 // for legacy WebView text scaling emulation. Thus, the code that resets |
| 2342 // the zoom level from this map will be effectively resetting text zoom level. | 2350 // the zoom level from this map will be effectively resetting text zoom level. |
| 2343 host_zoom_levels_[url] = zoom_level; | 2351 host_zoom_levels_[url] = zoom_level; |
| 2344 #endif | 2352 #endif |
| 2345 } | 2353 } |
| 2346 | 2354 |
| 2347 void RenderViewImpl::OnSetZoomLevelForView(bool uses_temporary_zoom_level, | 2355 void RenderViewImpl::OnSetZoomLevelForView( |
| 2348 double level) { | 2356 PageMsg_SetZoomLevel_Command command, |
| 2349 uses_temporary_zoom_level_ = uses_temporary_zoom_level; | 2357 double zoom_level) { |
| 2350 | 2358 switch (command) { |
| 2359 case ZOOM_CLEAR_TEMPORARY: | |
| 2360 uses_temporary_zoom_level_ = false; | |
| 2361 break; | |
| 2362 case ZOOM_SET_TEMPORARY: | |
| 2363 uses_temporary_zoom_level_ = true; | |
| 2364 break; | |
| 2365 default: // ZOOM_USE_CURRENT_TEMPORARY_MODE | |
|
alexmos
2016/04/07 23:48:08
why not just an explicit case for ZOOM_USE_CURRENT
alexmos
2016/04/11 23:19:10
Still curious about this. :)
wjmaclean
2016/04/13 18:47:47
I guess I just figured less code generated, but no
wjmaclean
2016/04/13 18:47:47
I didn't see this comment the first time.
| |
| 2366 // Don't override a temporary zoom level without an explicit SET. | |
| 2367 if (uses_temporary_zoom_level_) | |
| 2368 return; | |
| 2369 } | |
| 2351 webview()->hidePopups(); | 2370 webview()->hidePopups(); |
| 2352 SetZoomLevel(level); | 2371 SetZoomLevel(zoom_level); |
| 2353 } | 2372 } |
| 2354 | 2373 |
| 2355 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { | 2374 void RenderViewImpl::OnSetPageEncoding(const std::string& encoding_name) { |
| 2356 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); | 2375 webview()->setPageEncoding(WebString::fromUTF8(encoding_name)); |
| 2357 } | 2376 } |
| 2358 | 2377 |
| 2359 void RenderViewImpl::OnResetPageEncodingToDefault() { | 2378 void RenderViewImpl::OnResetPageEncodingToDefault() { |
| 2360 WebString no_encoding; | 2379 WebString no_encoding; |
| 2361 webview()->setPageEncoding(no_encoding); | 2380 webview()->setPageEncoding(no_encoding); |
| 2362 } | 2381 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2532 didUpdateLayout(); | 2551 didUpdateLayout(); |
| 2533 } | 2552 } |
| 2534 | 2553 |
| 2535 void RenderViewImpl::OnDisableScrollbarsForSmallWindows( | 2554 void RenderViewImpl::OnDisableScrollbarsForSmallWindows( |
| 2536 const gfx::Size& disable_scrollbar_size_limit) { | 2555 const gfx::Size& disable_scrollbar_size_limit) { |
| 2537 disable_scrollbars_size_limit_ = disable_scrollbar_size_limit; | 2556 disable_scrollbars_size_limit_ = disable_scrollbar_size_limit; |
| 2538 } | 2557 } |
| 2539 | 2558 |
| 2540 void RenderViewImpl::OnSetRendererPrefs( | 2559 void RenderViewImpl::OnSetRendererPrefs( |
| 2541 const RendererPreferences& renderer_prefs) { | 2560 const RendererPreferences& renderer_prefs) { |
| 2542 double old_zoom_level = renderer_preferences_.default_zoom_level; | |
| 2543 std::string old_accept_languages = renderer_preferences_.accept_languages; | 2561 std::string old_accept_languages = renderer_preferences_.accept_languages; |
| 2544 | 2562 |
| 2545 renderer_preferences_ = renderer_prefs; | 2563 renderer_preferences_ = renderer_prefs; |
| 2546 | 2564 |
| 2547 UpdateFontRenderingFromRendererPrefs(); | 2565 UpdateFontRenderingFromRendererPrefs(); |
| 2548 UpdateThemePrefs(); | 2566 UpdateThemePrefs(); |
| 2549 | 2567 |
| 2550 #if defined(USE_DEFAULT_RENDER_THEME) | 2568 #if defined(USE_DEFAULT_RENDER_THEME) |
| 2551 if (renderer_prefs.use_custom_colors) { | 2569 if (renderer_prefs.use_custom_colors) { |
| 2552 blink::setFocusRingColor(renderer_prefs.focus_ring_color); | 2570 blink::setFocusRingColor(renderer_prefs.focus_ring_color); |
| 2553 blink::setCaretBlinkInterval(renderer_prefs.caret_blink_interval); | 2571 blink::setCaretBlinkInterval(renderer_prefs.caret_blink_interval); |
| 2554 | 2572 |
| 2555 if (webview()) { | 2573 if (webview()) { |
| 2556 webview()->setSelectionColors( | 2574 webview()->setSelectionColors( |
| 2557 renderer_prefs.active_selection_bg_color, | 2575 renderer_prefs.active_selection_bg_color, |
| 2558 renderer_prefs.active_selection_fg_color, | 2576 renderer_prefs.active_selection_fg_color, |
| 2559 renderer_prefs.inactive_selection_bg_color, | 2577 renderer_prefs.inactive_selection_bg_color, |
| 2560 renderer_prefs.inactive_selection_fg_color); | 2578 renderer_prefs.inactive_selection_fg_color); |
| 2561 webview()->themeChanged(); | 2579 webview()->themeChanged(); |
| 2562 } | 2580 } |
| 2563 } | 2581 } |
| 2564 #endif // defined(USE_DEFAULT_RENDER_THEME) | 2582 #endif // defined(USE_DEFAULT_RENDER_THEME) |
| 2565 | 2583 |
| 2566 // If the zoom level for this page matches the old zoom default, and this | |
| 2567 // is not a plugin, update the zoom level to match the new default. | |
| 2568 if (webview() && webview()->mainFrame()->isWebLocalFrame() && | |
| 2569 !webview()->mainFrame()->document().isPluginDocument() && | |
| 2570 !ZoomValuesEqual(old_zoom_level, | |
| 2571 renderer_preferences_.default_zoom_level) && | |
| 2572 ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { | |
| 2573 SetZoomLevel(renderer_preferences_.default_zoom_level); | |
| 2574 zoomLevelChanged(); | |
| 2575 } | |
| 2576 | |
| 2577 if (webview() && | 2584 if (webview() && |
| 2578 old_accept_languages != renderer_preferences_.accept_languages) { | 2585 old_accept_languages != renderer_preferences_.accept_languages) { |
| 2579 webview()->acceptLanguagesChanged(); | 2586 webview()->acceptLanguagesChanged(); |
| 2580 } | 2587 } |
| 2581 } | 2588 } |
| 2582 | 2589 |
| 2583 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, | 2590 void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, |
| 2584 const WebMediaPlayerAction& action) { | 2591 const WebMediaPlayerAction& action) { |
| 2585 if (webview()) | 2592 if (webview()) |
| 2586 webview()->performMediaPlayerAction(action, location); | 2593 webview()->performMediaPlayerAction(action, location); |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3441 if (IsUseZoomForDSFEnabled()) { | 3448 if (IsUseZoomForDSFEnabled()) { |
| 3442 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3449 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3443 } else { | 3450 } else { |
| 3444 webview()->setDeviceScaleFactor(device_scale_factor_); | 3451 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3445 } | 3452 } |
| 3446 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3453 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3447 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3454 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3448 } | 3455 } |
| 3449 | 3456 |
| 3450 } // namespace content | 3457 } // namespace content |
| OLD | NEW |