| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 6 #define CHROME_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> |
| 11 | 11 |
| 12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "chrome/browser/renderer_host/render_widget_host.h" | 14 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 15 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 15 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 16 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
| 17 #include "chrome/common/page_zoom.h" | 17 #include "chrome/common/page_zoom.h" |
| 18 #include "chrome/common/render_view_commands.h" |
| 18 #include "chrome/common/translate_errors.h" | 19 #include "chrome/common/translate_errors.h" |
| 19 #include "chrome/common/view_types.h" | 20 #include "chrome/common/view_types.h" |
| 20 #include "chrome/common/window_container_type.h" | 21 #include "chrome/common/window_container_type.h" |
| 21 #include "net/base/load_states.h" | 22 #include "net/base/load_states.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
| 23 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" |
| 24 #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" |
| 25 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" |
| 26 #include "webkit/glue/webaccessibility.h" | 27 #include "webkit/glue/webaccessibility.h" |
| 27 #include "webkit/glue/window_open_disposition.h" | 28 #include "webkit/glue/window_open_disposition.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // for which another renderer will need to run an onunload event handler. | 195 // for which another renderer will need to run an onunload event handler. |
| 195 // This is called before the first navigation event for this RenderViewHost, | 196 // This is called before the first navigation event for this RenderViewHost, |
| 196 // and again after the corresponding OnCrossSiteResponse. | 197 // and again after the corresponding OnCrossSiteResponse. |
| 197 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); | 198 void SetHasPendingCrossSiteRequest(bool has_pending_request, int request_id); |
| 198 | 199 |
| 199 // Returns the request_id for the pending cross-site request. | 200 // Returns the request_id for the pending cross-site request. |
| 200 // This is just needed in case the unload of the current page | 201 // This is just needed in case the unload of the current page |
| 201 // hangs, in which case we need to swap to the pending RenderViewHost. | 202 // hangs, in which case we need to swap to the pending RenderViewHost. |
| 202 int GetPendingRequestId(); | 203 int GetPendingRequestId(); |
| 203 | 204 |
| 205 struct CommandState { |
| 206 bool is_enabled; |
| 207 RenderViewCommandCheckedState checked_state; |
| 208 }; |
| 209 CommandState GetStateForCommand(RenderViewCommand command) const; |
| 210 |
| 204 // Stops the current load. | 211 // Stops the current load. |
| 205 void Stop(); | 212 void Stop(); |
| 206 | 213 |
| 207 // Reloads the current frame. | 214 // Reloads the current frame. |
| 208 void ReloadFrame(); | 215 void ReloadFrame(); |
| 209 | 216 |
| 210 // Asks the renderer to "render" printed pages and initiate printing on our | 217 // Asks the renderer to "render" printed pages and initiate printing on our |
| 211 // behalf. | 218 // behalf. |
| 212 bool PrintPages(); | 219 bool PrintPages(); |
| 213 | 220 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 int maximum_percent, | 695 int maximum_percent, |
| 689 bool remember); | 696 bool remember); |
| 690 void OnSetSuggestions(int32 page_id, | 697 void OnSetSuggestions(int32 page_id, |
| 691 const std::vector<std::string>& suggestions); | 698 const std::vector<std::string>& suggestions); |
| 692 void OnInstantSupportDetermined(int32 page_id, bool result); | 699 void OnInstantSupportDetermined(int32 page_id, bool result); |
| 693 void OnDetectedPhishingSite(const GURL& phishing_url, double phishing_score); | 700 void OnDetectedPhishingSite(const GURL& phishing_url, double phishing_score); |
| 694 void OnScriptEvalResponse(int id, const ListValue& result); | 701 void OnScriptEvalResponse(int id, const ListValue& result); |
| 695 void OnUpdateContentRestrictions(int restrictions); | 702 void OnUpdateContentRestrictions(int restrictions); |
| 696 void OnPagesReadyForPreview( | 703 void OnPagesReadyForPreview( |
| 697 const ViewHostMsg_DidPreviewDocument_Params& params); | 704 const ViewHostMsg_DidPreviewDocument_Params& params); |
| 705 void OnCommandStateChanged(int command, |
| 706 bool is_enabled, |
| 707 int checked_state); |
| 698 | 708 |
| 699 #if defined(OS_MACOSX) | 709 #if defined(OS_MACOSX) |
| 700 void OnMsgShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 710 void OnMsgShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
| 701 #endif | 711 #endif |
| 702 | 712 |
| 703 private: | 713 private: |
| 704 friend class TestRenderViewHost; | 714 friend class TestRenderViewHost; |
| 705 | 715 |
| 706 // Get/Create print preview tab. | 716 // Get/Create print preview tab. |
| 707 TabContents* GetOrCreatePrintPreviewTab(); | 717 TabContents* GetOrCreatePrintPreviewTab(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 786 |
| 777 // Whether the accessibility tree should be saved, for unit testing. | 787 // Whether the accessibility tree should be saved, for unit testing. |
| 778 bool save_accessibility_tree_for_testing_; | 788 bool save_accessibility_tree_for_testing_; |
| 779 | 789 |
| 780 // The most recently received accessibility tree - for unit testing only. | 790 // The most recently received accessibility tree - for unit testing only. |
| 781 webkit_glue::WebAccessibility accessibility_tree_; | 791 webkit_glue::WebAccessibility accessibility_tree_; |
| 782 | 792 |
| 783 // The termination status of the last render view that terminated. | 793 // The termination status of the last render view that terminated. |
| 784 base::TerminationStatus render_view_termination_status_; | 794 base::TerminationStatus render_view_termination_status_; |
| 785 | 795 |
| 796 // The enabled/disabled states of various commands. |
| 797 std::map<RenderViewCommand, CommandState> command_states_; |
| 798 |
| 786 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); | 799 DISALLOW_COPY_AND_ASSIGN(RenderViewHost); |
| 787 }; | 800 }; |
| 788 | 801 |
| 789 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ | 802 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_H_ |
| OLD | NEW |