| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 params.initial_size.screen_info, | 611 params.initial_size.screen_info, |
| 612 params.swapped_out, | 612 params.swapped_out, |
| 613 params.hidden, | 613 params.hidden, |
| 614 params.never_visible), | 614 params.never_visible), |
| 615 webkit_preferences_(params.web_preferences), | 615 webkit_preferences_(params.web_preferences), |
| 616 send_content_state_immediately_(false), | 616 send_content_state_immediately_(false), |
| 617 enabled_bindings_(0), | 617 enabled_bindings_(0), |
| 618 send_preferred_size_changes_(false), | 618 send_preferred_size_changes_(false), |
| 619 navigation_gesture_(NavigationGestureUnknown), | 619 navigation_gesture_(NavigationGestureUnknown), |
| 620 opened_by_user_gesture_(true), | 620 opened_by_user_gesture_(true), |
| 621 suppress_dialogs_until_swap_out_(false), | |
| 622 page_id_(-1), | 621 page_id_(-1), |
| 623 next_page_id_(params.next_page_id), | 622 next_page_id_(params.next_page_id), |
| 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 |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) | 1348 IPC_MESSAGE_HANDLER(DragMsg_SourceEnded, OnDragSourceEnded) |
| 1350 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, | 1349 IPC_MESSAGE_HANDLER(DragMsg_SourceSystemDragEnded, |
| 1351 OnDragSourceSystemDragEnded) | 1350 OnDragSourceSystemDragEnded) |
| 1352 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) | 1351 IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings) |
| 1353 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) | 1352 IPC_MESSAGE_HANDLER(ViewMsg_SetInitialFocus, OnSetInitialFocus) |
| 1354 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) | 1353 IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck) |
| 1355 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) | 1354 IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
| 1356 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, | 1355 IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse, |
| 1357 OnEnumerateDirectoryResponse) | 1356 OnEnumerateDirectoryResponse) |
| 1358 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) | 1357 IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
| 1359 IPC_MESSAGE_HANDLER(ViewMsg_SuppressDialogsUntilSwapOut, | |
| 1360 OnSuppressDialogsUntilSwapOut) | |
| 1361 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) | 1358 IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage) |
| 1362 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) | 1359 IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged) |
| 1363 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) | 1360 IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted) |
| 1364 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedElement, OnClearFocusedElement) | 1361 IPC_MESSAGE_HANDLER(ViewMsg_ClearFocusedElement, OnClearFocusedElement) |
| 1365 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) | 1362 IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque) |
| 1366 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, | 1363 IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode, |
| 1367 OnEnablePreferredSizeChangedMode) | 1364 OnEnablePreferredSizeChangedMode) |
| 1368 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) | 1365 IPC_MESSAGE_HANDLER(ViewMsg_EnableAutoResize, OnEnableAutoResize) |
| 1369 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) | 1366 IPC_MESSAGE_HANDLER(ViewMsg_DisableAutoResize, OnDisableAutoResize) |
| 1370 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, | 1367 IPC_MESSAGE_HANDLER(ViewMsg_DisableScrollbarsForSmallWindows, |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 if (webview() && webview()->mainFrame()->isWebLocalFrame()) | 2575 if (webview() && webview()->mainFrame()->isWebLocalFrame()) |
| 2579 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); | 2576 webview()->mainFrame()->toWebLocalFrame()->sendOrientationChangeEvent(); |
| 2580 } | 2577 } |
| 2581 | 2578 |
| 2582 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, | 2579 void RenderViewImpl::OnPluginActionAt(const gfx::Point& location, |
| 2583 const WebPluginAction& action) { | 2580 const WebPluginAction& action) { |
| 2584 if (webview()) | 2581 if (webview()) |
| 2585 webview()->performPluginAction(action, location); | 2582 webview()->performPluginAction(action, location); |
| 2586 } | 2583 } |
| 2587 | 2584 |
| 2588 void RenderViewImpl::OnSuppressDialogsUntilSwapOut() { | |
| 2589 // Don't show any more dialogs until we finish OnSwapOut. | |
| 2590 suppress_dialogs_until_swap_out_ = true; | |
| 2591 } | |
| 2592 | |
| 2593 void RenderViewImpl::OnClosePage() { | 2585 void RenderViewImpl::OnClosePage() { |
| 2594 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 2586 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
| 2595 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 2587 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
| 2596 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 2588 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
| 2597 // in the onunload handler from appearing. For now, we're bypassing that and | 2589 // in the onunload handler from appearing. For now, we're bypassing that and |
| 2598 // calling the FrameLoader's CloseURL method directly. This should be | 2590 // calling the FrameLoader's CloseURL method directly. This should be |
| 2599 // revisited to avoid having two ways to close a page. Having a single way | 2591 // revisited to avoid having two ways to close a page. Having a single way |
| 2600 // to close that can run onunload is also useful for fixing | 2592 // to close that can run onunload is also useful for fixing |
| 2601 // http://b/issue?id=753080. | 2593 // http://b/issue?id=753080. |
| 2602 webview()->mainFrame()->dispatchUnloadEvent(); | 2594 webview()->mainFrame()->dispatchUnloadEvent(); |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3429 if (IsUseZoomForDSFEnabled()) { | 3421 if (IsUseZoomForDSFEnabled()) { |
| 3430 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3422 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3431 } else { | 3423 } else { |
| 3432 webview()->setDeviceScaleFactor(device_scale_factor_); | 3424 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3433 } | 3425 } |
| 3434 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3426 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3435 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3427 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3436 } | 3428 } |
| 3437 | 3429 |
| 3438 } // namespace content | 3430 } // namespace content |
| OLD | NEW |