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 OnUpdatedFrameTree(int process_id, | |
1035 int route_id, | |
1036 const std::string& frame_tree); | |
1037 | |
1030 // Adding a new message handler? Please add it in alphabetical order above | 1038 // Adding a new message handler? Please add it in alphabetical order above |
1031 // and put it in the same position in the .cc file. | 1039 // and put it in the same position in the .cc file. |
1032 | 1040 |
1033 // Misc private functions ---------------------------------------------------- | 1041 // Misc private functions ---------------------------------------------------- |
1034 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x, | 1042 void ZoomFactorHelper(content::PageZoom zoom, int zoom_center_x, |
1035 int zoom_center_y, float scaling_increment); | 1043 int zoom_center_y, float scaling_increment); |
1036 | 1044 |
1037 void AltErrorPageFinished(WebKit::WebFrame* frame, | 1045 void AltErrorPageFinished(WebKit::WebFrame* frame, |
1038 const WebKit::WebURLError& original_error, | 1046 const WebKit::WebURLError& original_error, |
1039 const std::string& html); | 1047 const std::string& html); |
1040 | 1048 |
1041 // Check whether the preferred size has changed. | 1049 // Check whether the preferred size has changed. |
1042 void CheckPreferredSize(); | 1050 void CheckPreferredSize(); |
1043 | 1051 |
1044 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( | 1052 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( |
1045 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 1053 const WebKit::WebGraphicsContext3D::Attributes& attributes); |
1046 | 1054 |
1055 // This method walks the entire frame tree for the |frame| specified and | |
1056 // sends an update to the browser process as described in the | |
1057 // ViewHostMsg_FrameTreeUpdated comments. | |
1058 void SendUpdatedFrameTree(WebKit::WebFrame* frame, bool exclude); | |
Charlie Reis
2012/08/22 22:08:34
What's |exclude| about?
nasko
2012/08/23 21:55:53
Done.
| |
1059 | |
1060 // Walks the frame hierarchy and returns the frame which corresponds to the | |
1061 // |remote_frame_id|. | |
Charlie Reis
2012/08/22 22:08:34
I don't understand what remote_frame_id is referri
nasko
2012/08/23 21:55:53
I've renamed it from Remote to Mapped. The idea of
| |
1062 WebKit::WebFrame* GetFrameByRemoteID(int remote_frame_id); | |
1063 | |
1047 void EnsureMediaStreamImpl(); | 1064 void EnsureMediaStreamImpl(); |
1048 | 1065 |
1049 // This callback is triggered when DownloadFavicon completes, either | 1066 // This callback is triggered when DownloadFavicon completes, either |
1050 // succesfully or with a failure. See DownloadFavicon for more | 1067 // succesfully or with a failure. See DownloadFavicon for more |
1051 // details. | 1068 // details. |
1052 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, | 1069 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher, |
1053 const SkBitmap& image); | 1070 const SkBitmap& image); |
1054 | 1071 |
1055 // Requests to download a favicon image. When done, the RenderView is notified | 1072 // Requests to download a favicon image. When done, the RenderView is notified |
1056 // by way of DidDownloadFavicon. Returns true if the request was successfully | 1073 // by way of DidDownloadFavicon. Returns true if the request was successfully |
(...skipping 22 matching lines...) Expand all Loading... | |
1079 | 1096 |
1080 // Returns true if the |params| navigation is to an entry that has been | 1097 // 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. | 1098 // cropped due to a recent navigation the browser did not know about. |
1082 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params, | 1099 bool IsBackForwardToStaleEntry(const ViewMsg_Navigate_Params& params, |
1083 bool is_reload); | 1100 bool is_reload); |
1084 | 1101 |
1085 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, | 1102 bool MaybeLoadAlternateErrorPage(WebKit::WebFrame* frame, |
1086 const WebKit::WebURLError& error, | 1103 const WebKit::WebURLError& error, |
1087 bool replace); | 1104 bool replace); |
1088 | 1105 |
1089 // Make this RenderView show an empty, unscriptable page. | 1106 // Make this RenderView show an empty, unscriptable page. |
Charlie Reis
2012/08/22 22:08:34
Please update the comment for what the parameters
nasko
2012/08/23 21:55:53
Done.
| |
1090 void NavigateToSwappedOutURL(); | 1107 void NavigateToSwappedOutURL(WebKit::WebFrame* frame, |
1108 DictionaryValue* frame_tree); | |
1091 | 1109 |
1092 // If we initiated a navigation, this function will populate |document_state| | 1110 // If we initiated a navigation, this function will populate |document_state| |
1093 // with the navigation information saved in OnNavigate(). | 1111 // with the navigation information saved in OnNavigate(). |
1094 void PopulateDocumentStateFromPending(content::DocumentState* document_state); | 1112 void PopulateDocumentStateFromPending(content::DocumentState* document_state); |
1095 | 1113 |
1096 // Returns a new NavigationState populated with the navigation information | 1114 // Returns a new NavigationState populated with the navigation information |
1097 // saved in OnNavigate(). | 1115 // saved in OnNavigate(). |
1098 content::NavigationState* CreateNavigationStateFromPending(); | 1116 content::NavigationState* CreateNavigationStateFromPending(); |
1099 | 1117 |
1100 // Processes the command-line flags --enable-viewport and | 1118 // Processes the command-line flags --enable-viewport and |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1431 // guest RenderView. | 1449 // guest RenderView. |
1432 ppapi::HostResource guest_graphics_resource_; | 1450 ppapi::HostResource guest_graphics_resource_; |
1433 | 1451 |
1434 // This graphics context is initialized once GuestReady() is called. | 1452 // This graphics context is initialized once GuestReady() is called. |
1435 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_; | 1453 WebGraphicsContext3DCommandBufferImpl* guest_uninitialized_context_; |
1436 | 1454 |
1437 // These are the attributes originally passed into createGraphicsContext3D | 1455 // These are the attributes originally passed into createGraphicsContext3D |
1438 // before the guest_to_embedder_channel was ready. | 1456 // before the guest_to_embedder_channel was ready. |
1439 WebKit::WebGraphicsContext3D::Attributes guest_attributes_; | 1457 WebKit::WebGraphicsContext3D::Attributes guest_attributes_; |
1440 | 1458 |
1459 // Boolean indicating whether we are in the process of updating the frame | |
1460 // tree for this renderer. If true, we won't be sending frame tree updates | |
Charlie Reis
2012/08/22 22:08:34
nit: renderer -> RenderView.
"Updating the frame
nasko
2012/08/23 21:55:53
Done.
| |
1461 // back to the browser. | |
1462 bool updating_frame_tree_; | |
1463 | |
1464 // Boolean indicating that the frame tree has changed, but message has not | |
Charlie Reis
2012/08/22 22:08:34
nit: a message
nasko
2012/08/23 21:55:53
Done.
| |
1465 // been sent to the browser because a resource has been loading. | |
Charlie Reis
2012/08/22 22:08:34
Why does a loading resource block us?
nasko
2012/08/23 21:55:53
Loading a resource doesn't block us. This is to av
| |
1466 bool pending_frame_tree_update_; | |
1467 | |
1468 // If this render view is swapped out mirror of an active render view in a | |
Charlie Reis
2012/08/22 22:08:34
nit: is the swapped out "mirror"
nasko
2012/08/23 21:55:53
Done.
| |
1469 // different process, we record the process id and route id for the active RV. | |
1470 // For further details, see the comments on ViewHostMsg_FrameTreeUpdated. | |
1471 int target_process_id_; | |
1472 int target_routing_id_; | |
1473 | |
1474 // A mapping of current process frame ids to ids in the remote active render | |
Charlie Reis
2012/08/22 22:08:34
nit: A map of the current process's
nasko
2012/08/23 21:55:53
Done.
| |
1475 // view, if this is a swapped out mirror render view. | |
Charlie Reis
2012/08/22 22:08:34
nit: We don't need to say mirror here.
nasko
2012/08/23 21:55:53
Done.
| |
1476 std::map<int, int> frames_map_; | |
Charlie Reis
2012/08/22 22:08:34
This name could be more descriptive. active_frame
nasko
2012/08/23 21:55:53
Done.
| |
1477 | |
1441 // NOTE: pepper_delegate_ should be last member because its constructor calls | 1478 // NOTE: pepper_delegate_ should be last member because its constructor calls |
1442 // AddObservers method of RenderViewImpl from c-tor. | 1479 // AddObservers method of RenderViewImpl from c-tor. |
1443 content::PepperPluginDelegateImpl pepper_delegate_; | 1480 content::PepperPluginDelegateImpl pepper_delegate_; |
1444 | 1481 |
1445 // --------------------------------------------------------------------------- | 1482 // --------------------------------------------------------------------------- |
1446 // ADDING NEW DATA? Please see if it fits appropriately in one of the above | 1483 // 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 | 1484 // 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 | 1485 // 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 | 1486 // 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 | 1487 // use the Observer interface to filter IPC messages and receive frame change |
1451 // notifications. | 1488 // notifications. |
1452 // --------------------------------------------------------------------------- | 1489 // --------------------------------------------------------------------------- |
1453 | 1490 |
1454 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); | 1491 DISALLOW_COPY_AND_ASSIGN(RenderViewImpl); |
1455 }; | 1492 }; |
1456 | 1493 |
1457 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ | 1494 #endif // CONTENT_RENDERER_RENDER_VIEW_IMPL_H_ |
OLD | NEW |