Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: content/renderer/render_view_impl.h

Issue 130773004: Start moving context menu code to RenderFrame. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "third_party/WebKit/public/web/WebFrameClient.h" 49 #include "third_party/WebKit/public/web/WebFrameClient.h"
50 #include "third_party/WebKit/public/web/WebHistoryItem.h" 50 #include "third_party/WebKit/public/web/WebHistoryItem.h"
51 #include "third_party/WebKit/public/web/WebIconURL.h" 51 #include "third_party/WebKit/public/web/WebIconURL.h"
52 #include "third_party/WebKit/public/web/WebInputEvent.h" 52 #include "third_party/WebKit/public/web/WebInputEvent.h"
53 #include "third_party/WebKit/public/web/WebNavigationType.h" 53 #include "third_party/WebKit/public/web/WebNavigationType.h"
54 #include "third_party/WebKit/public/web/WebNode.h" 54 #include "third_party/WebKit/public/web/WebNode.h"
55 #include "third_party/WebKit/public/web/WebPageSerializerClient.h" 55 #include "third_party/WebKit/public/web/WebPageSerializerClient.h"
56 #include "third_party/WebKit/public/web/WebPageVisibilityState.h" 56 #include "third_party/WebKit/public/web/WebPageVisibilityState.h"
57 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" 57 #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
58 #include "third_party/WebKit/public/web/WebViewClient.h" 58 #include "third_party/WebKit/public/web/WebViewClient.h"
59 #include "ui/base/ui_base_types.h"
60 #include "ui/surface/transport_dib.h" 59 #include "ui/surface/transport_dib.h"
61 #include "webkit/common/webpreferences.h" 60 #include "webkit/common/webpreferences.h"
62 61
63 #if defined(OS_ANDROID) 62 #if defined(OS_ANDROID)
64 #include "content/renderer/android/content_detector.h" 63 #include "content/renderer/android/content_detector.h"
65 #include "third_party/WebKit/public/web/WebContentDetectionResult.h" 64 #include "third_party/WebKit/public/web/WebContentDetectionResult.h"
66 #endif 65 #endif
67 66
68 #if defined(COMPILER_MSVC) 67 #if defined(COMPILER_MSVC)
69 // RenderViewImpl is a diamond-shaped hierarchy, with WebWidgetClient at the 68 // RenderViewImpl is a diamond-shaped hierarchy, with WebWidgetClient at the
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 class NavigationState; 146 class NavigationState;
148 class NotificationProvider; 147 class NotificationProvider;
149 class PepperPluginInstanceImpl; 148 class PepperPluginInstanceImpl;
150 class RenderViewObserver; 149 class RenderViewObserver;
151 class RenderViewTest; 150 class RenderViewTest;
152 class RendererAccessibility; 151 class RendererAccessibility;
153 class RendererDateTimePicker; 152 class RendererDateTimePicker;
154 class RendererWebColorChooserImpl; 153 class RendererWebColorChooserImpl;
155 class SpeechRecognitionDispatcher; 154 class SpeechRecognitionDispatcher;
156 class WebPluginDelegateProxy; 155 class WebPluginDelegateProxy;
157 struct CustomContextMenuContext;
158 struct DropData; 156 struct DropData;
159 struct FaviconURL; 157 struct FaviconURL;
160 struct FileChooserParams; 158 struct FileChooserParams;
161 struct RenderViewImplParams; 159 struct RenderViewImplParams;
162 160
163 #if defined(OS_ANDROID) 161 #if defined(OS_ANDROID)
164 class RendererMediaPlayerManager; 162 class RendererMediaPlayerManager;
165 class WebMediaPlayerProxyAndroid; 163 class WebMediaPlayerProxyAndroid;
166 #endif 164 #endif
167 165
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // periodic timer so we don't send too many messages. 326 // periodic timer so we don't send too many messages.
329 void SyncNavigationState(); 327 void SyncNavigationState();
330 328
331 // Temporary call until all this media code moves to RenderFrame. 329 // Temporary call until all this media code moves to RenderFrame.
332 // TODO(jam): remove me 330 // TODO(jam): remove me
333 blink::WebMediaPlayer* CreateMediaPlayer( 331 blink::WebMediaPlayer* CreateMediaPlayer(
334 RenderFrame* render_frame, 332 RenderFrame* render_frame,
335 blink::WebFrame* frame, 333 blink::WebFrame* frame,
336 const blink::WebURL& url, 334 const blink::WebURL& url,
337 blink::WebMediaPlayerClient* client); 335 blink::WebMediaPlayerClient* client);
338 // Temporary call until the context menu code moves to RenderFrmae.
339 // TODO(jam): remove me
340 int ShowContextMenu(ContextMenuClient* client,
341 const ContextMenuParams& params);
342 void CancelContextMenu(int request_id);
343 // Temporary call until this code moves to RenderFrame. 336 // Temporary call until this code moves to RenderFrame.
344 // virtual since overriden by WebTestProxy for layout tests. 337 // virtual since overriden by WebTestProxy for layout tests.
345 virtual blink::WebNavigationPolicy DecidePolicyForNavigation( 338 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
346 RenderFrame* render_frame, 339 RenderFrame* render_frame,
347 blink::WebFrame* frame, 340 blink::WebFrame* frame,
348 blink::WebDataSource::ExtraData* extraData, 341 blink::WebDataSource::ExtraData* extraData,
349 const blink::WebURLRequest& request, 342 const blink::WebURLRequest& request,
350 blink::WebNavigationType type, 343 blink::WebNavigationType type,
351 blink::WebNavigationPolicy default_policy, 344 blink::WebNavigationPolicy default_policy,
352 bool is_redirect); 345 bool is_redirect);
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint( 687 virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
695 const gfx::Rect& paint_bounds, 688 const gfx::Rect& paint_bounds,
696 TransportDIB** dib, 689 TransportDIB** dib,
697 gfx::Rect* location, 690 gfx::Rect* location,
698 gfx::Rect* clip, 691 gfx::Rect* clip,
699 float* scale_factor) OVERRIDE; 692 float* scale_factor) OVERRIDE;
700 virtual gfx::Vector2d GetScrollOffset() OVERRIDE; 693 virtual gfx::Vector2d GetScrollOffset() OVERRIDE;
701 virtual void DidHandleKeyEvent() OVERRIDE; 694 virtual void DidHandleKeyEvent() OVERRIDE;
702 virtual bool WillHandleMouseEvent( 695 virtual bool WillHandleMouseEvent(
703 const blink::WebMouseEvent& event) OVERRIDE; 696 const blink::WebMouseEvent& event) OVERRIDE;
704 virtual bool WillHandleKeyEvent(
705 const blink::WebKeyboardEvent& event) OVERRIDE;
706 virtual bool WillHandleGestureEvent( 697 virtual bool WillHandleGestureEvent(
707 const blink::WebGestureEvent& event) OVERRIDE; 698 const blink::WebGestureEvent& event) OVERRIDE;
708 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) OVERRIDE; 699 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) OVERRIDE;
709 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) OVERRIDE; 700 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) OVERRIDE;
710 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const OVERRIDE; 701 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const OVERRIDE;
711 virtual void OnSetFocus(bool enable) OVERRIDE; 702 virtual void OnSetFocus(bool enable) OVERRIDE;
712 virtual void OnWasHidden() OVERRIDE; 703 virtual void OnWasHidden() OVERRIDE;
713 virtual void OnWasShown(bool needs_repainting) OVERRIDE; 704 virtual void OnWasShown(bool needs_repainting) OVERRIDE;
714 virtual GURL GetURLForGraphicsContext3D() OVERRIDE; 705 virtual GURL GetURLForGraphicsContext3D() OVERRIDE;
715 virtual bool ForceCompositingModeEnabled() OVERRIDE; 706 virtual bool ForceCompositingModeEnabled() OVERRIDE;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 GetCompositionCharacterBoundsTest); 784 GetCompositionCharacterBoundsTest);
794 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost); 785 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, OnNavigationHttpPost);
795 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 786 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
796 DecideNavigationPolicyHandlesAllTopLevel); 787 DecideNavigationPolicyHandlesAllTopLevel);
797 #if defined(OS_MACOSX) 788 #if defined(OS_MACOSX)
798 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); 789 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp);
799 #endif 790 #endif
800 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune); 791 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SetHistoryLengthAndPrune);
801 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit); 792 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ZoomLimit);
802 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame); 793 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, NavigateFrame);
803 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
804 ShouldUpdateSelectionTextFromContextMenuParams);
805 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame); 794 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, BasicRenderFrame);
806 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper); 795 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, TextInputTypeWithPepper);
807 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, 796 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
808 MessageOrderInDidChangeSelection); 797 MessageOrderInDidChangeSelection);
809 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents); 798 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendCandidateWindowEvents);
810 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses); 799 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, Suppresses);
811 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress); 800 FRIEND_TEST_ALL_PREFIXES(SuppressErrorPageTest, DoesNotSuppress);
812 801
813 typedef std::map<GURL, double> HostZoomLevels; 802 typedef std::map<GURL, double> HostZoomLevels;
814 803
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 void OnSelectAll(); 879 void OnSelectAll();
891 void OnSelectRange(const gfx::Point& start, const gfx::Point& end); 880 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
892 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands); 881 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
893 void OnUndo(); 882 void OnUndo();
894 void OnUnselect(); 883 void OnUnselect();
895 void OnAllowBindings(int enabled_bindings_flags); 884 void OnAllowBindings(int enabled_bindings_flags);
896 void OnAllowScriptToClose(bool script_can_close); 885 void OnAllowScriptToClose(bool script_can_close);
897 void OnCancelDownload(int32 download_id); 886 void OnCancelDownload(int32 download_id);
898 void OnClearFocusedNode(); 887 void OnClearFocusedNode();
899 void OnClosePage(); 888 void OnClosePage();
900 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
901 void OnShowContextMenu(const gfx::Point& location); 889 void OnShowContextMenu(const gfx::Point& location);
902 void OnCopyImageAt(int x, int y); 890 void OnCopyImageAt(int x, int y);
903 void OnCSSInsertRequest(const base::string16& frame_xpath, 891 void OnCSSInsertRequest(const base::string16& frame_xpath,
904 const std::string& css); 892 const std::string& css);
905 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
906 unsigned action);
907 void OnSetName(const std::string& name); 893 void OnSetName(const std::string& name);
908 void OnDeterminePageLanguage(); 894 void OnDeterminePageLanguage();
909 void OnDisableScrollbarsForSmallWindows( 895 void OnDisableScrollbarsForSmallWindows(
910 const gfx::Size& disable_scrollbars_size_limit); 896 const gfx::Size& disable_scrollbars_size_limit);
911 void OnDragSourceEndedOrMoved(const gfx::Point& client_point, 897 void OnDragSourceEndedOrMoved(const gfx::Point& client_point,
912 const gfx::Point& screen_point, 898 const gfx::Point& screen_point,
913 bool ended, 899 bool ended,
914 blink::WebDragOperation drag_operation); 900 blink::WebDragOperation drag_operation);
915 void OnDragSourceSystemDragEnded(); 901 void OnDragSourceSystemDragEnded();
916 void OnDragTargetDrop(const gfx::Point& client_pt, 902 void OnDragTargetDrop(const gfx::Point& client_pt,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 blink::WebMediaPlayerClient* client); 1069 blink::WebMediaPlayerClient* client);
1084 1070
1085 // Sends a reply to the current find operation handling if it was a 1071 // Sends a reply to the current find operation handling if it was a
1086 // synchronous find request. 1072 // synchronous find request.
1087 void SendFindReply(int request_id, 1073 void SendFindReply(int request_id,
1088 int match_count, 1074 int match_count,
1089 int ordinal, 1075 int ordinal,
1090 const blink::WebRect& selection_rect, 1076 const blink::WebRect& selection_rect,
1091 bool final_status_update); 1077 bool final_status_update);
1092 1078
1093 // Returns whether |params.selection_text| should be synchronized to the
1094 // browser before bringing up the context menu. Static for testing.
1095 static bool ShouldUpdateSelectionTextFromContextMenuParams(
1096 const base::string16& selection_text,
1097 size_t selection_text_offset,
1098 const gfx::Range& selection_range,
1099 const ContextMenuParams& params);
1100
1101 // Starts nav_state_sync_timer_ if it isn't already running. 1079 // Starts nav_state_sync_timer_ if it isn't already running.
1102 void StartNavStateSyncTimerIfNecessary(); 1080 void StartNavStateSyncTimerIfNecessary();
1103 1081
1104 // Dispatches the current state of selection on the webpage to the browser if 1082 // Dispatches the current state of selection on the webpage to the browser if
1105 // it has changed. 1083 // it has changed.
1106 // TODO(varunjain): delete this method once we figure out how to keep 1084 // TODO(varunjain): delete this method once we figure out how to keep
1107 // selection handles in sync with the webpage. 1085 // selection handles in sync with the webpage.
1108 void SyncSelectionIfRequired(); 1086 void SyncSelectionIfRequired();
1109 1087
1110 #if defined(OS_POSIX) && !defined(OS_MACOSX) 1088 #if defined(OS_POSIX) && !defined(OS_MACOSX)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 // portion of this string that is the actual selected text starts at index 1265 // portion of this string that is the actual selected text starts at index
1288 // |selection_range_.GetMin() - selection_text_offset_| and has length 1266 // |selection_range_.GetMin() - selection_text_offset_| and has length
1289 // |selection_range_.length()|. 1267 // |selection_range_.length()|.
1290 base::string16 selection_text_; 1268 base::string16 selection_text_;
1291 // The offset corresponding to the start of |selection_text_| in the document. 1269 // The offset corresponding to the start of |selection_text_| in the document.
1292 size_t selection_text_offset_; 1270 size_t selection_text_offset_;
1293 // Range over the document corresponding to the actual selected text (which 1271 // Range over the document corresponding to the actual selected text (which
1294 // could correspond to a substring of |selection_text_|; see above). 1272 // could correspond to a substring of |selection_text_|; see above).
1295 gfx::Range selection_range_; 1273 gfx::Range selection_range_;
1296 1274
1297 // External context menu requests we're waiting for. "Internal"
1298 // (WebKit-originated) context menu events will have an ID of 0 and will not
1299 // be in this map.
1300 //
1301 // We don't want to add internal ones since some of the "special" page
1302 // handlers in the browser process just ignore the context menu requests so
1303 // avoid showing context menus, and so this will cause right clicks to leak
1304 // entries in this map. Most users of the custom context menu (e.g. Pepper
1305 // plugins) are normally only on "regular" pages and the regular pages will
1306 // always respond properly to the request, so we don't have to worry so
1307 // much about leaks.
1308 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
1309
1310 #if defined(OS_ANDROID) 1275 #if defined(OS_ANDROID)
1311 // Cache the old top controls state constraints. Used when updating 1276 // Cache the old top controls state constraints. Used when updating
1312 // current value only without altering the constraints. 1277 // current value only without altering the constraints.
1313 cc::TopControlsState top_controls_constraints_; 1278 cc::TopControlsState top_controls_constraints_;
1314 #endif 1279 #endif
1315 1280
1316 // View ---------------------------------------------------------------------- 1281 // View ----------------------------------------------------------------------
1317 1282
1318 // Cache the preferred size of the page in order to prevent sending the IPC 1283 // Cache the preferred size of the page in order to prevent sending the IPC
1319 // when layout() recomputes but doesn't actually change sizes. 1284 // when layout() recomputes but doesn't actually change sizes.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 1454
1490 // This field stores drag/drop related info for the event that is currently 1455 // This field stores drag/drop related info for the event that is currently
1491 // being handled. If the current event results in starting a drag/drop 1456 // being handled. If the current event results in starting a drag/drop
1492 // session, this info is sent to the browser along with other drag/drop info. 1457 // session, this info is sent to the browser along with other drag/drop info.
1493 DragEventSourceInfo possible_drag_event_info_; 1458 DragEventSourceInfo possible_drag_event_info_;
1494 1459
1495 // NOTE: stats_collection_observer_ should be the last members because their 1460 // NOTE: stats_collection_observer_ should be the last members because their
1496 // constructors call the AddObservers method of RenderViewImpl. 1461 // constructors call the AddObservers method of RenderViewImpl.
1497 scoped_ptr<StatsCollectionObserver> stats_collection_observer_; 1462 scoped_ptr<StatsCollectionObserver> stats_collection_observer_;
1498 1463
1499 ui::MenuSourceType context_menu_source_type_;
1500 gfx::Point touch_editing_context_menu_location_;
1501
1502 // --------------------------------------------------------------------------- 1464 // ---------------------------------------------------------------------------
1503 // ADDING NEW DATA? Please see if it fits appropriately in one of the above 1465 // ADDING NEW DATA? Please see if it fits appropriately in one of the above
1504 // sections rather than throwing it randomly at the end. If you're adding a 1466 // sections rather than throwing it randomly at the end. If you're adding a
1505 // bunch of stuff, you should probably create a helper class and put your 1467 // bunch of stuff, you should probably create a helper class and put your
1506 // data and methods on that to avoid bloating RenderView more. You can 1468 // data and methods on that to avoid bloating RenderView more. You can
1507 // use the Observer interface to filter IPC messages and receive frame change 1469 // use the Observer interface to filter IPC messages and receive frame change
1508 // notifications. 1470 // notifications.
1509 // --------------------------------------------------------------------------- 1471 // ---------------------------------------------------------------------------
1510 1472
1511 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); 1473 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
1512 }; 1474 };
1513 1475
1514 } // namespace content 1476 } // namespace content
1515 1477
1516 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ 1478 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698