| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 class SpeechInputDispatcher; | 73 class SpeechInputDispatcher; |
| 74 class WebPluginDelegatePepper; | 74 class WebPluginDelegatePepper; |
| 75 class WebPluginDelegateProxy; | 75 class WebPluginDelegateProxy; |
| 76 class WebUIBindings; | 76 class WebUIBindings; |
| 77 struct ContextMenuMediaParams; | 77 struct ContextMenuMediaParams; |
| 78 struct PP_Flash_NetAddress; | 78 struct PP_Flash_NetAddress; |
| 79 struct ViewHostMsg_RunFileChooser_Params; | 79 struct ViewHostMsg_RunFileChooser_Params; |
| 80 struct ViewMsg_ClosePage_Params; | 80 struct ViewMsg_ClosePage_Params; |
| 81 struct ViewMsg_Navigate_Params; | 81 struct ViewMsg_Navigate_Params; |
| 82 struct ViewMsg_StopFinding_Params; | 82 struct ViewMsg_StopFinding_Params; |
| 83 struct WebApplicationInfo; | |
| 84 struct WebDropData; | 83 struct WebDropData; |
| 85 | 84 |
| 86 namespace base { | 85 namespace base { |
| 87 class WaitableEvent; | 86 class WaitableEvent; |
| 88 } | 87 } |
| 89 | 88 |
| 90 namespace chrome { | 89 namespace chrome { |
| 91 class ChromeContentRendererClient; | 90 class ChromeContentRendererClient; |
| 92 } | 91 } |
| 93 | 92 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 WebKit::WebFileChooserCompletion* completion); | 274 WebKit::WebFileChooserCompletion* completion); |
| 276 | 275 |
| 277 // Sets the content settings that back allowScripts(), allowImages(), and | 276 // Sets the content settings that back allowScripts(), allowImages(), and |
| 278 // allowPlugins(). | 277 // allowPlugins(). |
| 279 void SetContentSettings(const ContentSettings& settings); | 278 void SetContentSettings(const ContentSettings& settings); |
| 280 | 279 |
| 281 // Notifies the browser that the given action has been performed. This is | 280 // Notifies the browser that the given action has been performed. This is |
| 282 // aggregated to the user metrics service. | 281 // aggregated to the user metrics service. |
| 283 void UserMetricsRecordAction(const std::string& action); | 282 void UserMetricsRecordAction(const std::string& action); |
| 284 | 283 |
| 285 // Starts installation of the page in the specified frame as a web app. The | |
| 286 // page must link to an external 'definition file'. This is different from | |
| 287 // the 'application shortcuts' feature where we pull the application | |
| 288 // definition out of optional meta tags in the page. | |
| 289 bool InstallWebApplicationUsingDefinitionFile(WebKit::WebFrame* frame, | |
| 290 string16* error); | |
| 291 | |
| 292 // Sets whether the renderer should report load progress to the browser. | 284 // Sets whether the renderer should report load progress to the browser. |
| 293 void SetReportLoadProgressEnabled(bool enabled); | 285 void SetReportLoadProgressEnabled(bool enabled); |
| 294 | 286 |
| 287 // Gets the focused node. If no such node exists then the node will be isNull. |
| 288 WebKit::WebNode GetFocusedNode() const; |
| 289 |
| 290 // Returns true if the parameter node is a textfield, text area or a content |
| 291 // editable div. |
| 292 bool IsEditableNode(const WebKit::WebNode& node); |
| 293 |
| 295 // Plugin-related functions -------------------------------------------------- | 294 // Plugin-related functions -------------------------------------------------- |
| 296 // (See also WebPluginPageDelegate implementation.) | 295 // (See also WebPluginPageDelegate implementation.) |
| 297 | 296 |
| 298 // Notification that the given plugin has crashed. | 297 // Notification that the given plugin has crashed. |
| 299 void PluginCrashed(const FilePath& plugin_path); | 298 void PluginCrashed(const FilePath& plugin_path); |
| 300 | 299 |
| 301 // Notification that the default plugin has done something about a missing | 300 // Notification that the default plugin has done something about a missing |
| 302 // plugin. See default_plugin_shared.h for possible values of |status|. | 301 // plugin. See default_plugin_shared.h for possible values of |status|. |
| 303 void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, | 302 void OnMissingPluginStatus(WebPluginDelegateProxy* delegate, |
| 304 int status); | 303 int status); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 virtual void DidStartLoadingForPlugin(); | 602 virtual void DidStartLoadingForPlugin(); |
| 604 virtual void DidStopLoadingForPlugin(); | 603 virtual void DidStopLoadingForPlugin(); |
| 605 virtual WebKit::WebCookieJar* GetCookieJar(); | 604 virtual WebKit::WebCookieJar* GetCookieJar(); |
| 606 | 605 |
| 607 // Please do not add your stuff randomly to the end here. If there is an | 606 // Please do not add your stuff randomly to the end here. If there is an |
| 608 // appropriate section, add it there. If not, there are some random functions | 607 // appropriate section, add it there. If not, there are some random functions |
| 609 // nearer to the top you can add it to. | 608 // nearer to the top you can add it to. |
| 610 | 609 |
| 611 virtual void DidFlushPaint(); | 610 virtual void DidFlushPaint(); |
| 612 | 611 |
| 612 // Cannot use std::set unfortunately since linked_ptr<> does not support |
| 613 // operator<. |
| 614 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> > |
| 615 ImageResourceFetcherList; |
| 616 |
| 613 protected: | 617 protected: |
| 614 // RenderWidget overrides: | 618 // RenderWidget overrides: |
| 615 virtual void Close(); | 619 virtual void Close(); |
| 616 virtual void OnResize(const gfx::Size& new_size, | 620 virtual void OnResize(const gfx::Size& new_size, |
| 617 const gfx::Rect& resizer_rect); | 621 const gfx::Rect& resizer_rect); |
| 618 virtual void DidInitiatePaint(); | 622 virtual void DidInitiatePaint(); |
| 619 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( | 623 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( |
| 620 const gfx::Rect& paint_bounds, | 624 const gfx::Rect& paint_bounds, |
| 621 TransportDIB** dib, | 625 TransportDIB** dib, |
| 622 gfx::Rect* location, | 626 gfx::Rect* location, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 649 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged); | 653 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnNavStateChanged); |
| 650 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection); | 654 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, OnSetTextDirection); |
| 651 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL); | 655 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, UpdateTargetURLWithInvalidURL); |
| 652 #if defined(OS_MACOSX) | 656 #if defined(OS_MACOSX) |
| 653 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); | 657 FRIEND_TEST_ALL_PREFIXES(RenderViewTest, MacTestCmdUp); |
| 654 #endif | 658 #endif |
| 655 | 659 |
| 656 typedef std::map<GURL, ContentSettings> HostContentSettings; | 660 typedef std::map<GURL, ContentSettings> HostContentSettings; |
| 657 typedef std::map<GURL, double> HostZoomLevels; | 661 typedef std::map<GURL, double> HostZoomLevels; |
| 658 | 662 |
| 659 // Cannot use std::set unfortunately since linked_ptr<> does not support | |
| 660 // operator<. | |
| 661 typedef std::vector<linked_ptr<webkit_glue::ImageResourceFetcher> > | |
| 662 ImageResourceFetcherList; | |
| 663 | |
| 664 // Identifies an accessibility notification from webkit. | 663 // Identifies an accessibility notification from webkit. |
| 665 struct RendererAccessibilityNotification { | 664 struct RendererAccessibilityNotification { |
| 666 public: | 665 public: |
| 667 bool ShouldIncludeChildren(); | 666 bool ShouldIncludeChildren(); |
| 668 | 667 |
| 669 // The webkit glue id of the accessibility object. | 668 // The webkit glue id of the accessibility object. |
| 670 int32 id; | 669 int32 id; |
| 671 | 670 |
| 672 // The accessibility notification type. | 671 // The accessibility notification type. |
| 673 WebKit::WebAccessibilityNotification type; | 672 WebKit::WebAccessibilityNotification type; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 WebKit::WebDragOperationsMask operations_allowed); | 791 WebKit::WebDragOperationsMask operations_allowed); |
| 793 void OnEnablePreferredSizeChangedMode(int flags); | 792 void OnEnablePreferredSizeChangedMode(int flags); |
| 794 void OnEnableViewSourceMode(); | 793 void OnEnableViewSourceMode(); |
| 795 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths); | 794 void OnEnumerateDirectoryResponse(int id, const std::vector<FilePath>& paths); |
| 796 void OnExecuteEditCommand(const std::string& name, const std::string& value); | 795 void OnExecuteEditCommand(const std::string& name, const std::string& value); |
| 797 void OnFileChooserResponse(const std::vector<FilePath>& paths); | 796 void OnFileChooserResponse(const std::vector<FilePath>& paths); |
| 798 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); | 797 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); |
| 799 void OnFindReplyAck(); | 798 void OnFindReplyAck(); |
| 800 void OnEnableAccessibility(); | 799 void OnEnableAccessibility(); |
| 801 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); | 800 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); |
| 802 void OnGetApplicationInfo(int page_id); | |
| 803 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | 801 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
| 804 const std::vector<GURL>& links, | 802 const std::vector<GURL>& links, |
| 805 const std::vector<FilePath>& local_paths, | 803 const std::vector<FilePath>& local_paths, |
| 806 const FilePath& local_directory_name); | 804 const FilePath& local_directory_name); |
| 807 void OnHandleMessageFromExternalHost(const std::string& message, | 805 void OnHandleMessageFromExternalHost(const std::string& message, |
| 808 const std::string& origin, | 806 const std::string& origin, |
| 809 const std::string& target); | 807 const std::string& target); |
| 810 void OnInstallMissingPlugin(); | 808 void OnInstallMissingPlugin(); |
| 811 void OnDisplayPrerenderedPage(); | 809 void OnDisplayPrerenderedPage(); |
| 812 void OnMediaPlayerActionAt(const gfx::Point& location, | 810 void OnMediaPlayerActionAt(const gfx::Point& location, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 // otherwise it's the empty string. | 904 // otherwise it's the empty string. |
| 907 void DidBlockContentType(ContentSettingsType settings_type, | 905 void DidBlockContentType(ContentSettingsType settings_type, |
| 908 const std::string& resource_identifier); | 906 const std::string& resource_identifier); |
| 909 | 907 |
| 910 // This callback is triggered when DownloadFavicon completes, either | 908 // This callback is triggered when DownloadFavicon completes, either |
| 911 // succesfully or with a failure. See DownloadFavicon for more | 909 // succesfully or with a failure. See DownloadFavicon for more |
| 912 // details. | 910 // details. |
| 913 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | 911 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, |
| 914 const SkBitmap& image); | 912 const SkBitmap& image); |
| 915 | 913 |
| 916 // Callback triggered when we finish downloading the application definition | |
| 917 // file. | |
| 918 void DidDownloadApplicationDefinition(const WebKit::WebURLResponse& response, | |
| 919 const std::string& data); | |
| 920 | |
| 921 // Callback triggered after each icon referenced by the application definition | |
| 922 // is downloaded. | |
| 923 void DidDownloadApplicationIcon(webkit_glue::ImageResourceFetcher* fetcher, | |
| 924 const SkBitmap& image); | |
| 925 | |
| 926 // Requests to download a favicon image. When done, the RenderView | 914 // Requests to download a favicon image. When done, the RenderView |
| 927 // is notified by way of DidDownloadFavicon. Returns true if the | 915 // is notified by way of DidDownloadFavicon. Returns true if the |
| 928 // request was successfully started, false otherwise. id is used to | 916 // request was successfully started, false otherwise. id is used to |
| 929 // uniquely identify the request and passed back to the | 917 // uniquely identify the request and passed back to the |
| 930 // DidDownloadFavicon method. If the image has multiple frames, the | 918 // DidDownloadFavicon method. If the image has multiple frames, the |
| 931 // frame whose size is image_size is returned. If the image doesn't | 919 // frame whose size is image_size is returned. If the image doesn't |
| 932 // have a frame at the specified size, the first is returned. | 920 // have a frame at the specified size, the first is returned. |
| 933 bool DownloadFavicon(int id, const GURL& image_url, int image_size); | 921 bool DownloadFavicon(int id, const GURL& image_url, int image_size); |
| 934 | 922 |
| 935 GURL GetAlternateErrorPageURL(const GURL& failed_url, | 923 GURL GetAlternateErrorPageURL(const GURL& failed_url, |
| 936 ErrorPageType error_type); | 924 ErrorPageType error_type); |
| 937 | 925 |
| 938 // Locates a sub frame with given xpath | 926 // Locates a sub frame with given xpath |
| 939 WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; | 927 WebKit::WebFrame* GetChildFrame(const std::wstring& frame_xpath) const; |
| 940 | 928 |
| 941 // Gets the focused node. If no such node exists then the node will be isNull. | |
| 942 WebKit::WebNode GetFocusedNode() const; | |
| 943 | |
| 944 WebUIBindings* GetWebUIBindings(); | 929 WebUIBindings* GetWebUIBindings(); |
| 945 | 930 |
| 946 ExternalHostBindings* GetExternalHostBindings(); | 931 ExternalHostBindings* GetExternalHostBindings(); |
| 947 | 932 |
| 948 // Should only be called if this object wraps a PluginDocument. | 933 // Should only be called if this object wraps a PluginDocument. |
| 949 WebKit::WebPlugin* GetWebPluginFromPluginDocument(); | 934 WebKit::WebPlugin* GetWebPluginFromPluginDocument(); |
| 950 | 935 |
| 951 // Decodes a data: URL image or returns an empty image in case of failure. | 936 // Decodes a data: URL image or returns an empty image in case of failure. |
| 952 SkBitmap ImageFromDataUrl(const GURL&) const; | 937 SkBitmap ImageFromDataUrl(const GURL&) const; |
| 953 | 938 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 983 #if defined(OS_LINUX) | 968 #if defined(OS_LINUX) |
| 984 void UpdateFontRenderingFromRendererPrefs(); | 969 void UpdateFontRenderingFromRendererPrefs(); |
| 985 #else | 970 #else |
| 986 void UpdateFontRenderingFromRendererPrefs() {} | 971 void UpdateFontRenderingFromRendererPrefs() {} |
| 987 #endif | 972 #endif |
| 988 | 973 |
| 989 // Update the target url and tell the browser that the target URL has changed. | 974 // Update the target url and tell the browser that the target URL has changed. |
| 990 // If |url| is empty, show |fallback_url|. | 975 // If |url| is empty, show |fallback_url|. |
| 991 void UpdateTargetURL(const GURL& url, const GURL& fallback_url); | 976 void UpdateTargetURL(const GURL& url, const GURL& fallback_url); |
| 992 | 977 |
| 993 // Updates the state of the toggle spell check command in the browser process. | |
| 994 void UpdateToggleSpellCheckCommandState(); | |
| 995 | |
| 996 // Helper to add an error message to the root frame's console. | |
| 997 void AddErrorToRootConsole(const string16& message); | |
| 998 | |
| 999 // --------------------------------------------------------------------------- | 978 // --------------------------------------------------------------------------- |
| 1000 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put | 979 // ADDING NEW FUNCTIONS? Please keep private functions alphabetized and put |
| 1001 // it in the same order in the .cc file as it was in the header. | 980 // it in the same order in the .cc file as it was in the header. |
| 1002 // --------------------------------------------------------------------------- | 981 // --------------------------------------------------------------------------- |
| 1003 | 982 |
| 1004 // Settings ------------------------------------------------------------------ | 983 // Settings ------------------------------------------------------------------ |
| 1005 | 984 |
| 1006 WebPreferences webkit_preferences_; | 985 WebPreferences webkit_preferences_; |
| 1007 RendererPreferences renderer_preferences_; | 986 RendererPreferences renderer_preferences_; |
| 1008 | 987 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 struct PendingFileChooser; | 1218 struct PendingFileChooser; |
| 1240 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; | 1219 std::deque< linked_ptr<PendingFileChooser> > file_chooser_completions_; |
| 1241 | 1220 |
| 1242 // The current directory enumeration callback | 1221 // The current directory enumeration callback |
| 1243 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_; | 1222 std::map<int, WebKit::WebFileChooserCompletion*> enumeration_completions_; |
| 1244 int enumeration_completion_id_; | 1223 int enumeration_completion_id_; |
| 1245 | 1224 |
| 1246 // ImageResourceFetchers schedule via DownloadImage. | 1225 // ImageResourceFetchers schedule via DownloadImage. |
| 1247 ImageResourceFetcherList image_fetchers_; | 1226 ImageResourceFetcherList image_fetchers_; |
| 1248 | 1227 |
| 1249 // The app info that we are processing. This is used when installing an app | |
| 1250 // via application definition. The in-progress web app is stored here while | |
| 1251 // its manifest and icons are downloaded. | |
| 1252 scoped_ptr<WebApplicationInfo> pending_app_info_; | |
| 1253 | |
| 1254 // Used to download the application definition file. | |
| 1255 scoped_ptr<webkit_glue::ResourceFetcher> app_definition_fetcher_; | |
| 1256 | |
| 1257 // Used to download the icons for an application. | |
| 1258 ImageResourceFetcherList app_icon_fetchers_; | |
| 1259 | |
| 1260 // The number of app icon requests outstanding. When this reaches zero, we're | |
| 1261 // done processing an app definition file. | |
| 1262 int pending_app_icon_requests_; | |
| 1263 | |
| 1264 // The SessionStorage namespace that we're assigned to has an ID, and that ID | 1228 // The SessionStorage namespace that we're assigned to has an ID, and that ID |
| 1265 // is passed to us upon creation. WebKit asks for this ID upon first use and | 1229 // is passed to us upon creation. WebKit asks for this ID upon first use and |
| 1266 // uses it whenever asking the browser process to allocate new storage areas. | 1230 // uses it whenever asking the browser process to allocate new storage areas. |
| 1267 int64 session_storage_namespace_id_; | 1231 int64 session_storage_namespace_id_; |
| 1268 | 1232 |
| 1269 // The total number of unrequested popups that exist and can be followed back | 1233 // The total number of unrequested popups that exist and can be followed back |
| 1270 // to a common opener. This count is shared among all RenderViews created | 1234 // to a common opener. This count is shared among all RenderViews created |
| 1271 // with createView(). All popups are treated as unrequested until | 1235 // with createView(). All popups are treated as unrequested until |
| 1272 // specifically instructed otherwise by the Browser process. | 1236 // specifically instructed otherwise by the Browser process. |
| 1273 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_; | 1237 scoped_refptr<SharedRenderViewCounter> shared_popup_counter_; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 // 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 |
| 1316 // 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 |
| 1317 // the Observer interface to filter IPC messages and receive frame change | 1281 // the Observer interface to filter IPC messages and receive frame change |
| 1318 // notifications. | 1282 // notifications. |
| 1319 // --------------------------------------------------------------------------- | 1283 // --------------------------------------------------------------------------- |
| 1320 | 1284 |
| 1321 DISALLOW_COPY_AND_ASSIGN(RenderView); | 1285 DISALLOW_COPY_AND_ASSIGN(RenderView); |
| 1322 }; | 1286 }; |
| 1323 | 1287 |
| 1324 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ | 1288 #endif // CONTENT_RENDERER_RENDER_VIEW_H_ |
| OLD | NEW |