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_RENDERER_RENDER_VIEW_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_VIEW_H_ |
6 #define CONTENT_RENDERER_RENDER_VIEW_H_ | 6 #define CONTENT_RENDERER_RENDER_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 class WebStorageNamespace; | 143 class WebStorageNamespace; |
144 class WebURLLoader; | 144 class WebURLLoader; |
145 class WebURLRequest; | 145 class WebURLRequest; |
146 class WebView; | 146 class WebView; |
147 struct WebContextMenuData; | 147 struct WebContextMenuData; |
148 struct WebFileChooserParams; | 148 struct WebFileChooserParams; |
149 struct WebFindOptions; | 149 struct WebFindOptions; |
150 struct WebMediaPlayerAction; | 150 struct WebMediaPlayerAction; |
151 struct WebPluginParams; | 151 struct WebPluginParams; |
152 struct WebPoint; | 152 struct WebPoint; |
153 struct WebRect; | |
153 struct WebWindowFeatures; | 154 struct WebWindowFeatures; |
154 } | 155 } |
155 | 156 |
156 // We need to prevent a page from trying to create infinite popups. It is not | 157 // We need to prevent a page from trying to create infinite popups. It is not |
157 // as simple as keeping a count of the number of immediate children | 158 // as simple as keeping a count of the number of immediate children |
158 // popups. Having an html file that window.open()s itself would create | 159 // popups. Having an html file that window.open()s itself would create |
159 // an unlimited chain of RenderViews who only have one RenderView child. | 160 // an unlimited chain of RenderViews who only have one RenderView child. |
160 // | 161 // |
161 // Therefore, each new top level RenderView creates a new counter and shares it | 162 // Therefore, each new top level RenderView creates a new counter and shares it |
162 // with all its children and grandchildren popup RenderViews created with | 163 // with all its children and grandchildren popup RenderViews created with |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 WebKit::WebFrame* creator, | 365 WebKit::WebFrame* creator, |
365 const WebKit::WebURLRequest& request, | 366 const WebKit::WebURLRequest& request, |
366 const WebKit::WebWindowFeatures& features, | 367 const WebKit::WebWindowFeatures& features, |
367 const WebKit::WebString& frame_name); | 368 const WebKit::WebString& frame_name); |
368 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type); | 369 virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type); |
369 virtual WebKit::WebWidget* createPopupMenu( | 370 virtual WebKit::WebWidget* createPopupMenu( |
370 const WebKit::WebPopupMenuInfo& info); | 371 const WebKit::WebPopupMenuInfo& info); |
371 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu( | 372 virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu( |
372 const WebKit::WebPopupMenuInfo& popup_menu_info, | 373 const WebKit::WebPopupMenuInfo& popup_menu_info, |
373 WebKit::WebExternalPopupMenuClient* popup_menu_client); | 374 WebKit::WebExternalPopupMenuClient* popup_menu_client); |
375 virtual WebKit::WebRect getDeviceRect() const; | |
374 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace( | 376 virtual WebKit::WebStorageNamespace* createSessionStorageNamespace( |
375 unsigned quota); | 377 unsigned quota); |
376 virtual void didAddMessageToConsole( | 378 virtual void didAddMessageToConsole( |
377 const WebKit::WebConsoleMessage& message, | 379 const WebKit::WebConsoleMessage& message, |
378 const WebKit::WebString& source_name, | 380 const WebKit::WebString& source_name, |
379 unsigned source_line); | 381 unsigned source_line); |
380 virtual void printPage(WebKit::WebFrame* frame); | 382 virtual void printPage(WebKit::WebFrame* frame); |
381 virtual WebKit::WebNotificationPresenter* notificationPresenter(); | 383 virtual WebKit::WebNotificationPresenter* notificationPresenter(); |
382 virtual bool enumerateChosenDirectory( | 384 virtual bool enumerateChosenDirectory( |
383 const WebKit::WebString& path, | 385 const WebKit::WebString& path, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 // RenderWidget overrides: | 628 // RenderWidget overrides: |
627 virtual void Close(); | 629 virtual void Close(); |
628 virtual void OnResize(const gfx::Size& new_size, | 630 virtual void OnResize(const gfx::Size& new_size, |
629 const gfx::Rect& resizer_rect); | 631 const gfx::Rect& resizer_rect); |
630 virtual void DidInitiatePaint(); | 632 virtual void DidInitiatePaint(); |
631 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( | 633 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( |
632 const gfx::Rect& paint_bounds, | 634 const gfx::Rect& paint_bounds, |
633 TransportDIB** dib, | 635 TransportDIB** dib, |
634 gfx::Rect* location, | 636 gfx::Rect* location, |
635 gfx::Rect* clip); | 637 gfx::Rect* clip); |
638 virtual gfx::Size GetContentSize(); | |
639 virtual float GetPageScaleFactor(); | |
636 virtual gfx::Point GetScrollOffset(); | 640 virtual gfx::Point GetScrollOffset(); |
637 virtual void DidHandleKeyEvent(); | 641 virtual void DidHandleKeyEvent(); |
638 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event); | 642 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event); |
639 virtual void OnSetFocus(bool enable); | 643 virtual void OnSetFocus(bool enable); |
640 virtual void OnWasHidden(); | 644 virtual void OnWasHidden(); |
641 virtual void OnWasRestored(bool needs_repainting); | 645 virtual void OnWasRestored(bool needs_repainting); |
642 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE; | 646 virtual bool SupportsAsynchronousSwapBuffers() OVERRIDE; |
643 virtual void OnImeSetComposition( | 647 virtual void OnImeSetComposition( |
644 const string16& text, | 648 const string16& text, |
645 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 649 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 | 882 |
879 // Misc private functions ---------------------------------------------------- | 883 // Misc private functions ---------------------------------------------------- |
880 | 884 |
881 void AltErrorPageFinished(WebKit::WebFrame* frame, | 885 void AltErrorPageFinished(WebKit::WebFrame* frame, |
882 const WebKit::WebURLError& original_error, | 886 const WebKit::WebURLError& original_error, |
883 const std::string& html); | 887 const std::string& html); |
884 | 888 |
885 // Check whether the preferred size has changed. | 889 // Check whether the preferred size has changed. |
886 void CheckPreferredSize(); | 890 void CheckPreferredSize(); |
887 | 891 |
892 // Return the offset, restricted to the document area at the given scale. | |
893 // (The offset is in the coordinate space of the new scale). | |
894 gfx::Point ClampOffsetAtScale(const gfx::Point& offset, float scale); | |
895 | |
896 // Get the scale when the document is fully zoomed out (minimum scale). | |
897 float ComputeOverviewScale(gfx::Size content_size); | |
898 | |
899 // Compute the scale within min/max limits. | |
900 float ComputeScaleWithinLimits(float scale); | |
901 | |
888 // This callback is triggered when DownloadFavicon completes, either | 902 // This callback is triggered when DownloadFavicon completes, either |
889 // succesfully or with a failure. See DownloadFavicon for more | 903 // succesfully or with a failure. See DownloadFavicon for more |
890 // details. | 904 // details. |
891 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | 905 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, |
892 const SkBitmap& image); | 906 const SkBitmap& image); |
893 | 907 |
894 // Requests to download a favicon image. When done, the RenderView | 908 // Requests to download a favicon image. When done, the RenderView |
895 // is notified by way of DidDownloadFavicon. Returns true if the | 909 // is notified by way of DidDownloadFavicon. Returns true if the |
896 // request was successfully started, false otherwise. id is used to | 910 // request was successfully started, false otherwise. id is used to |
897 // uniquely identify the request and passed back to the | 911 // uniquely identify the request and passed back to the |
(...skipping 20 matching lines...) Expand all Loading... | |
918 | 932 |
919 // Returns false unless this is a top-level navigation that crosses origins. | 933 // Returns false unless this is a top-level navigation that crosses origins. |
920 bool IsNonLocalTopLevelNavigation(const GURL& url, | 934 bool IsNonLocalTopLevelNavigation(const GURL& url, |
921 WebKit::WebFrame* frame, | 935 WebKit::WebFrame* frame, |
922 WebKit::WebNavigationType type); | 936 WebKit::WebNavigationType type); |
923 | 937 |
924 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, | 938 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, |
925 const WebKit::WebURLError& error, | 939 const WebKit::WebURLError& error, |
926 bool replace); | 940 bool replace); |
927 | 941 |
942 // Scales current scroll offset to a new factor. | |
943 void SetPageScaleFactor(float scale); | |
944 | |
945 // Moves to the scroll offset (should be provided in the new scale, not the | |
946 // previous one). | |
947 void SetPageScaleFactorAndScroll(float scale, const gfx::Point& offset); | |
948 | |
949 // Keeps Keeps the anchor (in window coordinates) in a stable position on the | |
jam
2011/09/02 17:11:41
nit Keeps Keeps
Fady Samuel
2011/09/08 23:46:39
Done.
| |
950 // screen. | |
951 void SetPageScaleFactorWithAnchor(float scale, | |
952 const gfx::Point& window_anchor); | |
953 | |
928 // Starts nav_state_sync_timer_ if it isn't already running. | 954 // Starts nav_state_sync_timer_ if it isn't already running. |
929 void StartNavStateSyncTimerIfNecessary(); | 955 void StartNavStateSyncTimerIfNecessary(); |
930 | 956 |
931 // Dispatches the current navigation state to the browser. Called on a | 957 // Dispatches the current navigation state to the browser. Called on a |
932 // periodic timer so we don't send too many messages. | 958 // periodic timer so we don't send too many messages. |
933 void SyncNavigationState(); | 959 void SyncNavigationState(); |
934 | 960 |
935 // Dispatches the current state of selection on the webpage to the browser if | 961 // Dispatches the current state of selection on the webpage to the browser if |
936 // it has changed. | 962 // it has changed. |
937 // TODO(varunjain): delete this method once we figure out how to keep | 963 // TODO(varunjain): delete this method once we figure out how to keep |
938 // selection handles in sync with the webpage. | 964 // selection handles in sync with the webpage. |
939 void SyncSelectionIfRequired(); | 965 void SyncSelectionIfRequired(); |
940 | 966 |
967 // If not already initialized, initialize the scale to the overview scale. | |
968 bool TryInitializeScale(); | |
969 | |
941 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 970 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
942 void UpdateFontRenderingFromRendererPrefs(); | 971 void UpdateFontRenderingFromRendererPrefs(); |
943 #else | 972 #else |
944 void UpdateFontRenderingFromRendererPrefs() {} | 973 void UpdateFontRenderingFromRendererPrefs() {} |
945 #endif | 974 #endif |
946 | 975 |
976 void UpdatePageScale(gfx::Size new_content_size); | |
977 | |
947 // Update the target url and tell the browser that the target URL has changed. | 978 // Update the target url and tell the browser that the target URL has changed. |
948 // If |url| is empty, show |fallback_url|. | 979 // If |url| is empty, show |fallback_url|. |
949 void UpdateTargetURL(const GURL& url, const GURL& fallback_url); | 980 void UpdateTargetURL(const GURL& url, const GURL& fallback_url); |
950 | 981 |
951 // --------------------------------------------------------------------------- | 982 // --------------------------------------------------------------------------- |
952 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put | 983 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put |
953 // it in the same order in the .cc file as it was in the header. | 984 // it in the same order in the .cc file as it was in the header. |
954 // --------------------------------------------------------------------------- | 985 // --------------------------------------------------------------------------- |
955 | 986 |
956 // Settings ------------------------------------------------------------------ | 987 // Settings ------------------------------------------------------------------ |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1170 pending_accessibility_notifications_; | 1201 pending_accessibility_notifications_; |
1171 | 1202 |
1172 // Set if we are waiting for a accessibility notification ack. | 1203 // Set if we are waiting for a accessibility notification ack. |
1173 bool accessibility_ack_pending_; | 1204 bool accessibility_ack_pending_; |
1174 | 1205 |
1175 // Dispatches all P2P socket used by the renderer. | 1206 // Dispatches all P2P socket used by the renderer. |
1176 content::P2PSocketDispatcher* p2p_socket_dispatcher_; | 1207 content::P2PSocketDispatcher* p2p_socket_dispatcher_; |
1177 | 1208 |
1178 DevToolsAgent* devtools_agent_; | 1209 DevToolsAgent* devtools_agent_; |
1179 | 1210 |
1211 // Scaling and Fixed Layout -------------------------------------------------- | |
1212 | |
1213 // viewport scale related fields. | |
1214 bool user_scalable_; | |
1215 float minimum_scale_; | |
1216 float maximum_scale_; | |
jamesr
2011/09/02 17:43:09
why are these member variables? from what I can te
Fady Samuel
2011/09/08 23:46:39
These will be used in an upcoming patch once the v
| |
1217 | |
1180 // Misc ---------------------------------------------------------------------- | 1218 // Misc ---------------------------------------------------------------------- |
1181 | 1219 |
1182 // The current and pending file chooser completion objects. If the queue is | 1220 // The current and pending file chooser completion objects. If the queue is |
1183 // nonempty, the first item represents the currently running file chooser | 1221 // nonempty, the first item represents the currently running file chooser |
1184 // callback, and the remaining elements are the other file chooser completion | 1222 // callback, and the remaining elements are the other file chooser completion |
1185 // still waiting to be run (in order). | 1223 // still waiting to be run (in order). |
1186 struct PendingFileChooser; | 1224 struct PendingFileChooser; |
1187 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; | 1225 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; |
1188 | 1226 |
1189 // The current directory enumeration callback | 1227 // The current directory enumeration callback |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1241 // bunch of stuff, you should probably create a helper class and put your | 1279 // bunch of stuff, you should probably create a helper class and put your |
1242 // data and methods on that to avoid bloating RenderView more. You can use | 1280 // data and methods on that to avoid bloating RenderView more. You can use |
1243 // the Observer interface to filter IPC messages and receive frame change | 1281 // the Observer interface to filter IPC messages and receive frame change |
1244 // notifications. | 1282 // notifications. |
1245 // --------------------------------------------------------------------------- | 1283 // --------------------------------------------------------------------------- |
1246 | 1284 |
1247 DISALLOW_COPY_AND_ASSIGN(RenderView); | 1285 DISALLOW_COPY_AND_ASSIGN(RenderView); |
1248 }; | 1286 }; |
1249 | 1287 |
1250 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ | 1288 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |