| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // RenderViewHost. This is called when a pending RenderViewHost is created | 154 // RenderViewHost. This is called when a pending RenderViewHost is created |
| 155 // for a cross-site navigation, because we must suspend any navigations until | 155 // for a cross-site navigation, because we must suspend any navigations until |
| 156 // we hear back from the old renderer's onbeforeunload handler. Note that it | 156 // we hear back from the old renderer's onbeforeunload handler. Note that it |
| 157 // is important that only one navigation event happen after calling this | 157 // is important that only one navigation event happen after calling this |
| 158 // method with |suspend| equal to true. If |suspend| is false and there is | 158 // method with |suspend| equal to true. If |suspend| is false and there is |
| 159 // a suspended_nav_message_, this will send the message. This function | 159 // a suspended_nav_message_, this will send the message. This function |
| 160 // should only be called to toggle the state; callers should check | 160 // should only be called to toggle the state; callers should check |
| 161 // are_navigations_suspended() first. | 161 // are_navigations_suspended() first. |
| 162 void SetNavigationsSuspended(bool suspend); | 162 void SetNavigationsSuspended(bool suspend); |
| 163 | 163 |
| 164 // Clears any suspended navigation state after a cross-site navigation is |
| 165 // canceled or suspended. This is important if we later return to this |
| 166 // RenderViewHost. |
| 167 void CancelSuspendedNavigations(); |
| 168 |
| 169 // Whether this RenderViewHost has been swapped out to be displayed by a |
| 170 // different process. |
| 171 bool is_swapped_out() const { return is_swapped_out_; } |
| 172 |
| 164 // Causes the renderer to invoke the onbeforeunload event handler. The | 173 // Causes the renderer to invoke the onbeforeunload event handler. The |
| 165 // result will be returned via ViewMsg_ShouldClose. See also ClosePage which | 174 // result will be returned via ViewMsg_ShouldClose. See also ClosePage and |
| 166 // will fire the PageUnload event. | 175 // SwapOut, which fire the PageUnload event. |
| 167 // | 176 // |
| 168 // Set bool for_cross_site_transition when this close is just for the current | 177 // Set bool for_cross_site_transition when this close is just for the current |
| 169 // RenderView in the case of a cross-site transition. False means we're | 178 // RenderView in the case of a cross-site transition. False means we're |
| 170 // closing the entire tab. | 179 // closing the entire tab. |
| 171 void FirePageBeforeUnload(bool for_cross_site_transition); | 180 void FirePageBeforeUnload(bool for_cross_site_transition); |
| 172 | 181 |
| 182 // Tells the renderer that this RenderView is being swapped out for one in a |
| 183 // different renderer process. The renderer should preserve the Frame object |
| 184 // until it exits (when it has no more active RenderViews). |
| 185 // |
| 186 // Please see ViewMsg_SwapOut_Params in view_messages.h for a description |
| 187 // of the parameters. |
| 188 void SwapOut(int new_render_process_host_id, int new_request_id); |
| 189 |
| 190 // Called by ResourceDispatcherHost after the SwapOutACK is received. |
| 191 void OnSwapOutACK(); |
| 192 |
| 173 // Causes the renderer to close the current page, including running its | 193 // Causes the renderer to close the current page, including running its |
| 174 // onunload event handler. A ClosePage_ACK message will be sent to the | 194 // onunload event handler. A ClosePage_ACK message will be sent to the |
| 175 // ResourceDispatcherHost when it is finished. | 195 // ResourceDispatcherHost when it is finished. |
| 176 // | 196 void ClosePage(); |
| 177 // Please see ViewMsg_ClosePage in resource_messages_internal.h for a | |
| 178 // description of the parameters. | |
| 179 void ClosePage(bool for_cross_site_transition, | |
| 180 int new_render_process_host_id, | |
| 181 int new_request_id); | |
| 182 | |
| 183 // Called by ResourceDispatcherHost after the ClosePageACK is received. | |
| 184 void OnClosePageACK(bool for_cross_site_transition); | |
| 185 | 197 |
| 186 // Close the page ignoring whether it has unload events registers. | 198 // Close the page ignoring whether it has unload events registers. |
| 187 // This is called after the beforeunload and unload events have fired | 199 // This is called after the beforeunload and unload events have fired |
| 188 // and the user has agreed to continue with closing the page. | 200 // and the user has agreed to continue with closing the page. |
| 189 void ClosePageIgnoringUnloadEvents(); | 201 void ClosePageIgnoringUnloadEvents(); |
| 190 | 202 |
| 191 // Sets whether this RenderViewHost has an outstanding cross-site request, | 203 // Sets whether this RenderViewHost has an outstanding cross-site request, |
| 192 // for which another renderer will need to run an onunload event handler. | 204 // for which another renderer will need to run an onunload event handler. |
| 193 // This is called before the first navigation event for this RenderViewHost, | 205 // This is called before the first navigation event for this RenderViewHost, |
| 194 // and again after the corresponding OnCrossSiteResponse. | 206 // and again after the corresponding OnCrossSiteResponse. |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 const std::string& state); | 536 const std::string& state); |
| 525 void OnMsgUpdateTitle(int32 page_id, const std::wstring& title); | 537 void OnMsgUpdateTitle(int32 page_id, const std::wstring& title); |
| 526 void OnMsgUpdateEncoding(const std::string& encoding); | 538 void OnMsgUpdateEncoding(const std::string& encoding); |
| 527 void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); | 539 void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); |
| 528 void OnMsgScreenshot(const SkBitmap& bitmap); | 540 void OnMsgScreenshot(const SkBitmap& bitmap); |
| 529 void OnMsgClose(); | 541 void OnMsgClose(); |
| 530 void OnMsgRequestMove(const gfx::Rect& pos); | 542 void OnMsgRequestMove(const gfx::Rect& pos); |
| 531 void OnMsgDidStartLoading(); | 543 void OnMsgDidStartLoading(); |
| 532 void OnMsgDidStopLoading(); | 544 void OnMsgDidStopLoading(); |
| 533 void OnMsgDidChangeLoadProgress(double load_progress); | 545 void OnMsgDidChangeLoadProgress(double load_progress); |
| 546 void OnMsgDidStartProvisionalLoadForFrame(int64 frame_id, |
| 547 bool main_frame, |
| 548 const GURL& url); |
| 549 void OnMsgDidRedirectProvisionalLoad(int32 page_id, |
| 550 const GURL& source_url, |
| 551 const GURL& target_url); |
| 552 void OnMsgDidFailProvisionalLoadWithError(int64 frame_id, |
| 553 bool main_frame, |
| 554 int error_code, |
| 555 const GURL& url, |
| 556 bool showing_repost_interstitial); |
| 557 void OnMsgDidLoadResourceFromMemoryCache(const GURL& url, |
| 558 const std::string& security_info); |
| 559 void OnMsgDidDisplayInsecureContent(); |
| 560 void OnMsgDidRunInsecureContent(const std::string& security_origin, |
| 561 const GURL& target_url); |
| 562 void OnMsgDocumentLoadedInFrame(int64 frame_id); |
| 563 void OnMsgDidFinishLoad(int64 frame_id); |
| 564 void OnMsgUpdateContentRestrictions(int restrictions); |
| 534 void OnMsgDocumentAvailableInMainFrame(); | 565 void OnMsgDocumentAvailableInMainFrame(); |
| 535 void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id); | 566 void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id); |
| 536 void OnMsgUpdateFaviconURL(int32 page_id, const GURL& icon_url); | 567 void OnMsgUpdateFaviconURL(int32 page_id, const GURL& icon_url); |
| 537 void OnMsgDidDownloadFavicon(int id, | 568 void OnMsgDidDownloadFavicon(int id, |
| 538 const GURL& image_url, | 569 const GURL& image_url, |
| 539 bool errored, | 570 bool errored, |
| 540 const SkBitmap& image_data); | 571 const SkBitmap& image_data); |
| 541 void OnMsgContextMenu(const ContextMenuParams& params); | 572 void OnMsgContextMenu(const ContextMenuParams& params); |
| 542 void OnMsgOpenURL(const GURL& url, const GURL& referrer, | 573 void OnMsgOpenURL(const GURL& url, const GURL& referrer, |
| 543 WindowOpenDisposition disposition); | 574 WindowOpenDisposition disposition); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 568 const gfx::Point& image_offset); | 599 const gfx::Point& image_offset); |
| 569 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); | 600 void OnUpdateDragCursor(WebKit::WebDragOperation drag_operation); |
| 570 void OnTakeFocus(bool reverse); | 601 void OnTakeFocus(bool reverse); |
| 571 void OnAddMessageToConsole(int32 level, | 602 void OnAddMessageToConsole(int32 level, |
| 572 const std::wstring& message, | 603 const std::wstring& message, |
| 573 int32 line_no, | 604 int32 line_no, |
| 574 const std::wstring& source_id); | 605 const std::wstring& source_id); |
| 575 void OnUpdateInspectorSetting(const std::string& key, | 606 void OnUpdateInspectorSetting(const std::string& key, |
| 576 const std::string& value); | 607 const std::string& value); |
| 577 void OnMsgShouldCloseACK(bool proceed); | 608 void OnMsgShouldCloseACK(bool proceed); |
| 609 void OnMsgClosePageACK(); |
| 578 | 610 |
| 579 void OnAccessibilityNotifications( | 611 void OnAccessibilityNotifications( |
| 580 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); | 612 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); |
| 581 void OnCSSInserted(); | 613 void OnCSSInserted(); |
| 582 void OnContentBlocked(ContentSettingsType type, | 614 void OnContentBlocked(ContentSettingsType type, |
| 583 const std::string& resource_identifier); | 615 const std::string& resource_identifier); |
| 584 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); | 616 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
| 585 void OnWebDatabaseAccessed(const GURL& url, | 617 void OnWebDatabaseAccessed(const GURL& url, |
| 586 const string16& name, | 618 const string16& name, |
| 587 const string16& display_name, | 619 const string16& display_name, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 // request, until we hear back from the onbeforeunload handler of the old | 662 // request, until we hear back from the onbeforeunload handler of the old |
| 631 // RenderViewHost. | 663 // RenderViewHost. |
| 632 bool navigations_suspended_; | 664 bool navigations_suspended_; |
| 633 | 665 |
| 634 // We only buffer a suspended navigation message while we a pending RVH for a | 666 // We only buffer a suspended navigation message while we a pending RVH for a |
| 635 // TabContents. There will only ever be one suspended navigation, because | 667 // TabContents. There will only ever be one suspended navigation, because |
| 636 // TabContents will destroy the pending RVH and create a new one if a second | 668 // TabContents will destroy the pending RVH and create a new one if a second |
| 637 // navigation occurs. | 669 // navigation occurs. |
| 638 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; | 670 scoped_ptr<ViewMsg_Navigate> suspended_nav_message_; |
| 639 | 671 |
| 672 // Whether this RenderViewHost is currently swapped out, such that the view is |
| 673 // being rendered by another process. |
| 674 bool is_swapped_out_; |
| 675 |
| 640 // If we were asked to RunModal, then this will hold the reply_msg that we | 676 // If we were asked to RunModal, then this will hold the reply_msg that we |
| 641 // must return to the renderer to unblock it. | 677 // must return to the renderer to unblock it. |
| 642 IPC::Message* run_modal_reply_msg_; | 678 IPC::Message* run_modal_reply_msg_; |
| 643 | 679 |
| 644 // Set to true when there is a pending ViewMsg_ShouldClose message. This | 680 // Set to true when there is a pending ViewMsg_ShouldClose message. This |
| 645 // ensures we don't spam the renderer with multiple beforeunload requests. | 681 // ensures we don't spam the renderer with multiple beforeunload requests. |
| 646 // When either this value or is_waiting_for_unload_ack_ is true, the value of | 682 // When either this value or is_waiting_for_unload_ack_ is true, the value of |
| 647 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a | 683 // unload_ack_is_for_cross_site_transition_ indicates whether this is for a |
| 648 // cross-site transition or a tab close attempt. | 684 // cross-site transition or a tab close attempt. |
| 649 bool is_waiting_for_beforeunload_ack_; | 685 bool is_waiting_for_beforeunload_ack_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // The enabled/disabled states of various commands. | 718 // The enabled/disabled states of various commands. |
| 683 std::map<RenderViewCommand, CommandState> command_states_; | 719 std::map<RenderViewCommand, CommandState> command_states_; |
| 684 | 720 |
| 685 // A list of observers that filter messages. Weak references. | 721 // A list of observers that filter messages. Weak references. |
| 686 ObserverList<RenderViewHostObserver> observers_; | 722 ObserverList<RenderViewHostObserver> observers_; |
| 687 | 723 |
| 688 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); | 724 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); |
| 689 }; | 725 }; |
| 690 | 726 |
| 691 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 727 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |