OLD | NEW |
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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/id_map.h" | 16 #include "base/id_map.h" |
17 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "base/values.h" |
21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
22 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
23 #include "content/common/edit_command.h" | 24 #include "content/common/edit_command.h" |
24 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 25 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
25 #include "content/common/navigation_gesture.h" | 26 #include "content/common/navigation_gesture.h" |
26 #include "content/common/view_message_enums.h" | 27 #include "content/common/view_message_enums.h" |
27 #include "content/public/common/javascript_message_type.h" | 28 #include "content/public/common/javascript_message_type.h" |
28 #include "content/public/common/page_zoom.h" | 29 #include "content/public/common/page_zoom.h" |
29 #include "content/public/common/referrer.h" | 30 #include "content/public/common/referrer.h" |
30 #include "content/public/common/renderer_preferences.h" | 31 #include "content/public/common/renderer_preferences.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 WebKit::WebFrame* frame, | 521 WebKit::WebFrame* frame, |
521 WebKit::WebMediaPlayerClient* client); | 522 WebKit::WebMediaPlayerClient* client); |
522 virtual WebKit::WebMediaPlayer* createMediaPlayer( | 523 virtual WebKit::WebMediaPlayer* createMediaPlayer( |
523 WebKit::WebFrame* frame, | 524 WebKit::WebFrame* frame, |
524 const WebKit::WebURL& url, | 525 const WebKit::WebURL& url, |
525 WebKit::WebMediaPlayerClient* client); | 526 WebKit::WebMediaPlayerClient* client); |
526 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( | 527 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( |
527 WebKit::WebFrame* frame, | 528 WebKit::WebFrame* frame, |
528 WebKit::WebApplicationCacheHostClient* client); | 529 WebKit::WebApplicationCacheHostClient* client); |
529 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame); | 530 virtual WebKit::WebCookieJar* cookieJar(WebKit::WebFrame* frame); |
| 531 virtual void didCreateFrame(WebKit::WebFrame* parent, |
| 532 WebKit::WebFrame* child); |
530 virtual void frameDetached(WebKit::WebFrame* frame); | 533 virtual void frameDetached(WebKit::WebFrame* frame); |
531 virtual void willClose(WebKit::WebFrame* frame); | 534 virtual void willClose(WebKit::WebFrame* frame); |
532 virtual void loadURLExternally(WebKit::WebFrame* frame, | 535 virtual void loadURLExternally(WebKit::WebFrame* frame, |
533 const WebKit::WebURLRequest& request, | 536 const WebKit::WebURLRequest& request, |
534 WebKit::WebNavigationPolicy policy); | 537 WebKit::WebNavigationPolicy policy); |
535 virtual void loadURLExternally(WebKit::WebFrame* frame, | 538 virtual void loadURLExternally(WebKit::WebFrame* frame, |
536 const WebKit::WebURLRequest& request, | 539 const WebKit::WebURLRequest& request, |
537 WebKit::WebNavigationPolicy policy, | 540 WebKit::WebNavigationPolicy policy, |
538 const WebKit::WebString& suggested_name); | 541 const WebKit::WebString& suggested_name); |
539 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation( | 542 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 unsigned long long requested_size, | 661 unsigned long long requested_size, |
659 WebKit::WebStorageQuotaCallbacks* callbacks); | 662 WebKit::WebStorageQuotaCallbacks* callbacks); |
660 virtual void registerIntentService( | 663 virtual void registerIntentService( |
661 WebKit::WebFrame* frame, | 664 WebKit::WebFrame* frame, |
662 const WebKit::WebIntentServiceInfo& service); | 665 const WebKit::WebIntentServiceInfo& service); |
663 virtual void dispatchIntent(WebKit::WebFrame* frame, | 666 virtual void dispatchIntent(WebKit::WebFrame* frame, |
664 const WebKit::WebIntentRequest& intentRequest); | 667 const WebKit::WebIntentRequest& intentRequest); |
665 virtual void willOpenSocketStream( | 668 virtual void willOpenSocketStream( |
666 WebKit::WebSocketStreamHandle* handle); | 669 WebKit::WebSocketStreamHandle* handle); |
667 virtual bool willCheckAndDispatchMessageEvent( | 670 virtual bool willCheckAndDispatchMessageEvent( |
668 WebKit::WebFrame* source, | 671 WebKit::WebFrame* sourceFrame, |
| 672 WebKit::WebFrame* targetFrame, |
669 WebKit::WebSecurityOrigin targetOrigin, | 673 WebKit::WebSecurityOrigin targetOrigin, |
670 WebKit::WebDOMMessageEvent event) OVERRIDE; | 674 WebKit::WebDOMMessageEvent event) OVERRIDE; |
671 virtual WebKit::WebString userAgentOverride( | 675 virtual WebKit::WebString userAgentOverride( |
672 WebKit::WebFrame* frame, | 676 WebKit::WebFrame* frame, |
673 const WebKit::WebURL& url) OVERRIDE; | 677 const WebKit::WebURL& url) OVERRIDE; |
674 | 678 |
675 // WebKit::WebPageSerializerClient implementation ---------------------------- | 679 // WebKit::WebPageSerializerClient implementation ---------------------------- |
676 | 680 |
677 virtual void didSerializeDataForFrame( | 681 virtual void didSerializeDataForFrame( |
678 const WebKit::WebURL& frame_url, | 682 const WebKit::WebURL& frame_url, |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 #endif | 1024 #endif |
1021 | 1025 |
1022 void OnZoom(content::PageZoom zoom); | 1026 void OnZoom(content::PageZoom zoom); |
1023 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x, | 1027 void OnZoomFactor(content::PageZoom zoom, int zoom_center_x, |
1024 int zoom_center_y); | 1028 int zoom_center_y); |
1025 | 1029 |
1026 void OnEnableViewSourceMode(); | 1030 void OnEnableViewSourceMode(); |
1027 | 1031 |
1028 void OnJavaBridgeInit(); | 1032 void OnJavaBridgeInit(); |
1029 | 1033 |
| 1034 void OnFrameTree(int process_id, int route_id, const std::string& frame_tree); |
| 1035 |
1030 // Adding a new message handler? Please add it in alphabetical order above | 1036 // Adding a new message handler? Please add it in alphabetical order above |
1031 // and put it in the same position in the .cc file. | 1037 // and put it in the same position in the .cc file. |
1032 | 1038 |
1033 // Misc private functions ---------------------------------------------------- | 1039 // Misc private functions ---------------------------------------------------- |
1034 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x, | 1040 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x, |
1035 int zoom_center_y, float scaling_increment); | 1041 int zoom_center_y, float scaling_increment); |
1036 | 1042 |
1037 void AltErrorPageFinished(WebKit::WebFrame* frame, | 1043 void AltErrorPageFinished(WebKit::WebFrame* frame, |
1038 const WebKit::WebURLError& original_error, | 1044 const WebKit::WebURLError& original_error, |
1039 const std::string& html); | 1045 const std::string& html); |
1040 | 1046 |
1041 // Check whether the preferred size has changed. | 1047 // Check whether the preferred size has changed. |
1042 void CheckPreferredSize(); | 1048 void CheckPreferredSize(); |
1043 | 1049 |
1044 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( | 1050 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( |
1045 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 1051 const WebKit::WebGraphicsContext3D::Attributes& attributes); |
1046 | 1052 |
| 1053 // This method walks the entire frame tree for the |frame| specified and |
| 1054 // returns a JSON serialized version of the tree including the name and id |
| 1055 // of each frame. |
| 1056 std::string ConstructFrameTree(WebKit::WebFrame* frame, bool exclude); |
| 1057 |
| 1058 // Walks the frame hierarchy and returns the frame which corresponds to the |
| 1059 // |remote_frame_id|. |
| 1060 WebKit::WebFrame* GetFrameByRemoteID(int remote_frame_id); |
| 1061 |
1047 void EnsureMediaStreamImpl(); | 1062 void EnsureMediaStreamImpl(); |
1048 | 1063 |
1049 // This callback is triggered when DownloadFavicon completes, either | 1064 // This callback is triggered when DownloadFavicon completes, either |
1050 // succesfully or with a failure. See DownloadFavicon for more | 1065 // succesfully or with a failure. See DownloadFavicon for more |
1051 // details. | 1066 // details. |
1052 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | 1067 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, |
1053 const SkBitmap& image); | 1068 const SkBitmap& image); |
1054 | 1069 |
1055 // Requests to download a favicon image. When done, the RenderView is notified | 1070 // Requests to download a favicon image. When done, the RenderView is notified |
1056 // by way of DidDownloadFavicon. Returns true if the request was successfully | 1071 // by way of DidDownloadFavicon. Returns true if the request was successfully |
(...skipping 23 matching lines...) Expand all Loading... |
1080 // Returns true if the |params| navigation is to an entry that has been | 1095 // Returns true if the |params| navigation is to an entry that has been |
1081 // cropped due to a recent navigation the browser did not know about. | 1096 // cropped due to a recent navigation the browser did not know about. |
1082 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params, | 1097 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params, |
1083 bool is_reload); | 1098 bool is_reload); |
1084 | 1099 |
1085 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, | 1100 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, |
1086 const WebKit::WebURLError& error, | 1101 const WebKit::WebURLError& error, |
1087 bool replace); | 1102 bool replace); |
1088 | 1103 |
1089 // Make this RenderView show an empty, unscriptable page. | 1104 // Make this RenderView show an empty, unscriptable page. |
1090 void NavigateToSwappedOutURL(); | 1105 void NavigateToSwappedOutURL(WebKit::WebFrame* frame, |
| 1106 DictionaryValue* frame_tree); |
1091 | 1107 |
1092 // If we initiated a navigation, this function will populate |document_state| | 1108 // If we initiated a navigation, this function will populate |document_state| |
1093 // with the navigation information saved in OnNavigate(). | 1109 // with the navigation information saved in OnNavigate(). |
1094 void PopulateDocumentStateFromPending(content::DocumentState* document_state); | 1110 void PopulateDocumentStateFromPending(content::DocumentState* document_state); |
1095 | 1111 |
1096 // Returns a new NavigationState populated with the navigation information | 1112 // Returns a new NavigationState populated with the navigation information |
1097 // saved in OnNavigate(). | 1113 // saved in OnNavigate(). |
1098 content::NavigationState* CreateNavigationStateFromPending(); | 1114 content::NavigationState* CreateNavigationStateFromPending(); |
1099 | 1115 |
1100 // Processes the command-line flags --enable-viewport and | 1116 // Processes the command-line flags --enable-viewport and |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 // guest RenderView. | 1447 // guest RenderView. |
1432 ppapi::HostResource guest_graphics_resource_; | 1448 ppapi::HostResource guest_graphics_resource_; |
1433 | 1449 |
1434 // This graphics context is initialized once GuestReady() is called. | 1450 // This graphics context is initialized once GuestReady() is called. |
1435 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_; | 1451 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_; |
1436 | 1452 |
1437 // These are the attributes originally passed into createGraphicsContext3D | 1453 // These are the attributes originally passed into createGraphicsContext3D |
1438 // before the guest_to_embedder_channel was ready. | 1454 // before the guest_to_embedder_channel was ready. |
1439 WebKit::WebGraphicsContext3D::Attributes guest_attributes_; | 1455 WebKit::WebGraphicsContext3D::Attributes guest_attributes_; |
1440 | 1456 |
| 1457 // Boolean indicating whether we are in the process of updating the frame |
| 1458 // tree for this renderer. If true, we won't be sending frame tree updates |
| 1459 // back to the browser. |
| 1460 bool updating_frame_tree_; |
| 1461 |
| 1462 // Boolean indicating that the frame tree has changed, but message has not |
| 1463 // been sent to the browser due to loading a resource. |
| 1464 bool pending_frame_tree_update_; |
| 1465 |
| 1466 // If this render view is swapped out mirror of an active render view in a |
| 1467 // different process, we record the process id and route id for the active RV. |
| 1468 int remote_process_id_; |
| 1469 int remote_routing_id_; |
| 1470 |
| 1471 // A mapping of current process frame ids to ids in the remote active render |
| 1472 // view, if this is a swapped out mirror render view. |
| 1473 std::map<int, int> frames_map_; |
| 1474 |
1441 // NOTE: pepper_delegate_ should be last member because its constructor calls | 1475 // NOTE: pepper_delegate_ should be last member because its constructor calls |
1442 // AddObservers method of RenderViewImpl from c-tor. | 1476 // AddObservers method of RenderViewImpl from c-tor. |
1443 content::PepperPluginDelegateImpl pepper_delegate_; | 1477 content::PepperPluginDelegateImpl pepper_delegate_; |
1444 | 1478 |
1445 // --------------------------------------------------------------------------- | 1479 // --------------------------------------------------------------------------- |
1446 // ADDING NEW DATA? Please see if it fits appropriately in one of the above | 1480 // ADDING NEW DATA? Please see if it fits appropriately in one of the above |
1447 // sections rather than throwing it randomly at the end. If you're adding a | 1481 // sections rather than throwing it randomly at the end. If you're adding a |
1448 // bunch of stuff, you should probably create a helper class and put your | 1482 // bunch of stuff, you should probably create a helper class and put your |
1449 // data and methods on that to avoid bloating RenderView more. You can | 1483 // data and methods on that to avoid bloating RenderView more. You can |
1450 // use the Observer interface to filter IPC messages and receive frame change | 1484 // use the Observer interface to filter IPC messages and receive frame change |
1451 // notifications. | 1485 // notifications. |
1452 // --------------------------------------------------------------------------- | 1486 // --------------------------------------------------------------------------- |
1453 | 1487 |
1454 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1488 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1455 }; | 1489 }; |
1456 | 1490 |
1457 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1491 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |