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

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 2563233002: WebContentsImpl: IPC_BEGIN_MESSAGE_MAP_WITH_PARAM everywhere (Closed)
Patch Set: Fix typo Created 4 years 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
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_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 bool GetAllowOtherViews() override; 429 bool GetAllowOtherViews() override;
430 #endif 430 #endif
431 431
432 // Implementation of PageNavigator. 432 // Implementation of PageNavigator.
433 WebContents* OpenURL(const OpenURLParams& params) override; 433 WebContents* OpenURL(const OpenURLParams& params) override;
434 434
435 // Implementation of IPC::Sender. 435 // Implementation of IPC::Sender.
436 bool Send(IPC::Message* message) override; 436 bool Send(IPC::Message* message) override;
437 437
438 // RenderFrameHostDelegate --------------------------------------------------- 438 // RenderFrameHostDelegate ---------------------------------------------------
439 bool OnMessageReceived(RenderFrameHost* render_frame_host, 439 bool OnMessageReceived(RenderFrameHostImpl* render_frame_host,
440 const IPC::Message& message) override; 440 const IPC::Message& message) override;
441 void OnAssociatedInterfaceRequest( 441 void OnAssociatedInterfaceRequest(
442 RenderFrameHost* render_frame_host, 442 RenderFrameHost* render_frame_host,
443 const std::string& interface_name, 443 const std::string& interface_name,
444 mojo::ScopedInterfaceEndpointHandle handle) override; 444 mojo::ScopedInterfaceEndpointHandle handle) override;
445 const GURL& GetMainFrameLastCommittedURL() const override; 445 const GURL& GetMainFrameLastCommittedURL() const override;
446 void RenderFrameCreated(RenderFrameHost* render_frame_host) override; 446 void RenderFrameCreated(RenderFrameHost* render_frame_host) override;
447 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; 447 void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
448 void ShowContextMenu(RenderFrameHost* render_frame_host, 448 void ShowContextMenu(RenderFrameHost* render_frame_host,
449 const ContextMenuParams& params) override; 449 const ContextMenuParams& params) override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 bool ShouldRouteMessageEvent( 487 bool ShouldRouteMessageEvent(
488 RenderFrameHost* target_rfh, 488 RenderFrameHost* target_rfh,
489 SiteInstance* source_site_instance) const override; 489 SiteInstance* source_site_instance) const override;
490 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; 490 void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override;
491 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( 491 std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost(
492 const GURL& url) override; 492 const GURL& url) override;
493 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; 493 void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override;
494 494
495 // RenderViewHostDelegate ---------------------------------------------------- 495 // RenderViewHostDelegate ----------------------------------------------------
496 RenderViewHostDelegateView* GetDelegateView() override; 496 RenderViewHostDelegateView* GetDelegateView() override;
497 bool OnMessageReceived(RenderViewHost* render_view_host, 497 bool OnMessageReceived(RenderViewHostImpl* render_view_host,
498 const IPC::Message& message) override; 498 const IPC::Message& message) override;
499 // RenderFrameHostDelegate has the same method, so list it there because this 499 // RenderFrameHostDelegate has the same method, so list it there because this
500 // interface is going away. 500 // interface is going away.
501 // WebContents* GetAsWebContents() override; 501 // WebContents* GetAsWebContents() override;
502 void RenderViewCreated(RenderViewHost* render_view_host) override; 502 void RenderViewCreated(RenderViewHost* render_view_host) override;
503 void RenderViewReady(RenderViewHost* render_view_host) override; 503 void RenderViewReady(RenderViewHost* render_view_host) override;
504 void RenderViewTerminated(RenderViewHost* render_view_host, 504 void RenderViewTerminated(RenderViewHost* render_view_host,
505 base::TerminationStatus status, 505 base::TerminationStatus status,
506 int error_code) override; 506 int error_code) override;
507 void RenderViewDeleted(RenderViewHost* render_view_host) override; 507 void RenderViewDeleted(RenderViewHost* render_view_host) override;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 // Callback function when showing JavaScript dialogs. Takes in a routing ID 912 // Callback function when showing JavaScript dialogs. Takes in a routing ID
913 // pair to identify the RenderFrameHost that opened the dialog, because it's 913 // pair to identify the RenderFrameHost that opened the dialog, because it's
914 // possible for the RenderFrameHost to be deleted by the time this is called. 914 // possible for the RenderFrameHost to be deleted by the time this is called.
915 void OnDialogClosed(int render_process_id, 915 void OnDialogClosed(int render_process_id,
916 int render_frame_id, 916 int render_frame_id,
917 IPC::Message* reply_msg, 917 IPC::Message* reply_msg,
918 bool dialog_was_suppressed, 918 bool dialog_was_suppressed,
919 bool success, 919 bool success,
920 const base::string16& user_input); 920 const base::string16& user_input);
921 921
922 bool OnMessageReceived(RenderViewHost* render_view_host,
923 RenderFrameHost* render_frame_host,
924 const IPC::Message& message);
925
926 // Checks whether render_frame_message_source_ is set to non-null value,
927 // otherwise it terminates the main frame renderer process.
928 bool HasValidFrameSource();
929
930 // IPC message handlers. 922 // IPC message handlers.
931 void OnThemeColorChanged(SkColor theme_color); 923 void OnThemeColorChanged(RenderFrameHostImpl* source, SkColor theme_color);
932 void OnDidLoadResourceFromMemoryCache(const GURL& url, 924 void OnDidLoadResourceFromMemoryCache(RenderFrameHostImpl* source,
925 const GURL& url,
933 const std::string& http_request, 926 const std::string& http_request,
934 const std::string& mime_type, 927 const std::string& mime_type,
935 ResourceType resource_type); 928 ResourceType resource_type);
936 void OnDidDisplayInsecureContent(); 929 void OnDidDisplayInsecureContent(RenderFrameHostImpl* source);
937 void OnDidRunInsecureContent(const GURL& security_origin, 930 void OnDidRunInsecureContent(RenderFrameHostImpl* source,
931 const GURL& security_origin,
938 const GURL& target_url); 932 const GURL& target_url);
939 void OnDidDisplayContentWithCertificateErrors(const GURL& url); 933 void OnDidDisplayContentWithCertificateErrors(RenderFrameHostImpl* source,
940 void OnDidRunContentWithCertificateErrors(const GURL& url); 934 const GURL& url);
941 void OnDocumentLoadedInFrame(); 935 void OnDidRunContentWithCertificateErrors(RenderFrameHostImpl* source,
942 void OnDidFinishLoad(const GURL& url); 936 const GURL& url);
943 void OnGoToEntryAtOffset(int offset); 937 void OnDocumentLoadedInFrame(RenderFrameHostImpl* source);
944 void OnUpdateZoomLimits(int minimum_percent, 938 void OnDidFinishLoad(RenderFrameHostImpl* source, const GURL& url);
939 void OnGoToEntryAtOffset(RenderViewHostImpl* source, int offset);
940 void OnUpdateZoomLimits(RenderViewHostImpl* source,
941 int minimum_percent,
945 int maximum_percent); 942 int maximum_percent);
946 void OnPageScaleFactorChanged(float page_scale_factor); 943 void OnPageScaleFactorChanged(RenderViewHostImpl* source,
947 void OnEnumerateDirectory(int request_id, const base::FilePath& path); 944 float page_scale_factor);
945 void OnEnumerateDirectory(RenderViewHostImpl* source,
946 int request_id,
947 const base::FilePath& path);
948 948
949 void OnRegisterProtocolHandler(const std::string& protocol, 949 void OnRegisterProtocolHandler(RenderFrameHostImpl* source,
950 const std::string& protocol,
950 const GURL& url, 951 const GURL& url,
951 const base::string16& title, 952 const base::string16& title,
952 bool user_gesture); 953 bool user_gesture);
953 void OnUnregisterProtocolHandler(const std::string& protocol, 954 void OnUnregisterProtocolHandler(RenderFrameHostImpl* source,
955 const std::string& protocol,
954 const GURL& url, 956 const GURL& url,
955 bool user_gesture); 957 bool user_gesture);
956 void OnFindReply(int request_id, 958 void OnFindReply(RenderFrameHostImpl* source,
959 int request_id,
957 int number_of_matches, 960 int number_of_matches,
958 const gfx::Rect& selection_rect, 961 const gfx::Rect& selection_rect,
959 int active_match_ordinal, 962 int active_match_ordinal,
960 bool final_update); 963 bool final_update);
961 #if defined(OS_ANDROID) 964 #if defined(OS_ANDROID)
962 void OnFindMatchRectsReply(int version, 965 void OnFindMatchRectsReply(RenderFrameHostImpl* source,
966 int version,
963 const std::vector<gfx::RectF>& rects, 967 const std::vector<gfx::RectF>& rects,
964 const gfx::RectF& active_rect); 968 const gfx::RectF& active_rect);
965 void OnGetNearestFindResultReply(int request_id, float distance); 969 void OnGetNearestFindResultReply(RenderFrameHostImpl* source,
970 int request_id,
971 float distance);
966 void OnOpenDateTimeDialog( 972 void OnOpenDateTimeDialog(
973 RenderViewHostImpl* source,
967 const ViewHostMsg_DateTimeDialogValue_Params& value); 974 const ViewHostMsg_DateTimeDialogValue_Params& value);
968 #endif 975 #endif
969 void OnDomOperationResponse(const std::string& json_string); 976 void OnDomOperationResponse(RenderFrameHostImpl* source,
970 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); 977 const std::string& json_string);
971 void OnOpenColorChooser(int color_chooser_id, 978 void OnAppCacheAccessed(RenderViewHostImpl* source,
979 const GURL& manifest_url,
980 bool blocked_by_policy);
981 void OnOpenColorChooser(RenderFrameHostImpl* source,
982 int color_chooser_id,
972 SkColor color, 983 SkColor color,
973 const std::vector<ColorSuggestion>& suggestions); 984 const std::vector<ColorSuggestion>& suggestions);
974 void OnEndColorChooser(int color_chooser_id); 985 void OnEndColorChooser(RenderFrameHostImpl* source, int color_chooser_id);
975 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); 986 void OnSetSelectedColorInColorChooser(RenderFrameHostImpl* source,
976 void OnWebUISend(const GURL& source_url, 987 int color_chooser_id,
988 SkColor color);
989 void OnWebUISend(RenderViewHostImpl* source,
990 const GURL& source_url,
977 const std::string& name, 991 const std::string& name,
978 const base::ListValue& args); 992 const base::ListValue& args);
979 void OnUpdatePageImportanceSignals(const PageImportanceSignals& signals); 993 void OnUpdatePageImportanceSignals(RenderFrameHostImpl* source,
994 const PageImportanceSignals& signals);
980 #if BUILDFLAG(ENABLE_PLUGINS) 995 #if BUILDFLAG(ENABLE_PLUGINS)
981 void OnPepperInstanceCreated(int32_t pp_instance); 996 void OnPepperInstanceCreated(RenderFrameHostImpl* source,
982 void OnPepperInstanceDeleted(int32_t pp_instance); 997 int32_t pp_instance);
983 void OnPepperPluginHung(int plugin_child_id, 998 void OnPepperInstanceDeleted(RenderFrameHostImpl* source,
999 int32_t pp_instance);
1000 void OnPepperPluginHung(RenderFrameHostImpl* source,
1001 int plugin_child_id,
984 const base::FilePath& path, 1002 const base::FilePath& path,
985 bool is_hung); 1003 bool is_hung);
986 void OnPepperStartsPlayback(int32_t pp_instance); 1004 void OnPepperStartsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
987 void OnPepperStopsPlayback(int32_t pp_instance); 1005 void OnPepperStopsPlayback(RenderFrameHostImpl* source, int32_t pp_instance);
988 void OnPluginCrashed(const base::FilePath& plugin_path, 1006 void OnPluginCrashed(RenderFrameHostImpl* source,
1007 const base::FilePath& plugin_path,
989 base::ProcessId plugin_pid); 1008 base::ProcessId plugin_pid);
990 void OnRequestPpapiBrokerPermission(int routing_id, 1009 void OnRequestPpapiBrokerPermission(RenderViewHostImpl* source,
1010 int ppb_broker_route_id,
991 const GURL& url, 1011 const GURL& url,
992 const base::FilePath& plugin_path); 1012 const base::FilePath& plugin_path);
993 1013
994 // Callback function when requesting permission to access the PPAPI broker. 1014 // Callback function when requesting permission to access the PPAPI broker.
995 // |result| is true if permission was granted. 1015 // |result| is true if permission was granted.
996 void OnPpapiBrokerPermissionResult(int routing_id, bool result); 1016 void SendPpapiBrokerPermissionResult(int process_id,
1017 int ppb_broker_route_id,
1018 bool result);
997 1019
998 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host, 1020 void OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
999 const IPC::Message& message); 1021 const IPC::Message& message);
1000 #endif // BUILDFLAG(ENABLE_PLUGINS) 1022 #endif // BUILDFLAG(ENABLE_PLUGINS)
1001 void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates); 1023 void OnUpdateFaviconURL(RenderViewHostImpl* source,
1002 void OnFirstVisuallyNonEmptyPaint(); 1024 const std::vector<FaviconURL>& candidates);
1003 void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view, 1025 void OnFirstVisuallyNonEmptyPaint(RenderViewHostImpl* source);
1026 void OnShowValidationMessage(RenderViewHostImpl* source,
1027 const gfx::Rect& anchor_in_root_view,
1004 const base::string16& main_text, 1028 const base::string16& main_text,
1005 const base::string16& sub_text); 1029 const base::string16& sub_text);
1006 void OnHideValidationMessage(); 1030 void OnHideValidationMessage(RenderViewHostImpl* source);
1007 void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); 1031 void OnMoveValidationMessage(RenderViewHostImpl* source,
1032 const gfx::Rect& anchor_in_root_view);
1008 1033
1009 // Called by derived classes to indicate that we're no longer waiting for a 1034 // Called by derived classes to indicate that we're no longer waiting for a
1010 // response. This won't actually update the throbber, but it will get picked 1035 // response. This won't actually update the throbber, but it will get picked
1011 // up at the next animation step if the throbber is going. 1036 // up at the next animation step if the throbber is going.
1012 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 1037 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
1013 1038
1014 // Inner WebContents Helpers ------------------------------------------------- 1039 // Inner WebContents Helpers -------------------------------------------------
1015 // 1040 //
1016 // These functions are helpers in managing a hierarchy of WebContents 1041 // These functions are helpers in managing a hierarchy of WebContents
1017 // involved in rendering inner WebContents. 1042 // involved in rendering inner WebContents.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 #endif 1358 #endif
1334 1359
1335 // Holds information about a current color chooser dialog, if one is visible. 1360 // Holds information about a current color chooser dialog, if one is visible.
1336 struct ColorChooserInfo { 1361 struct ColorChooserInfo {
1337 ColorChooserInfo(int render_process_id, 1362 ColorChooserInfo(int render_process_id,
1338 int render_frame_id, 1363 int render_frame_id,
1339 ColorChooser* chooser, 1364 ColorChooser* chooser,
1340 int identifier); 1365 int identifier);
1341 ~ColorChooserInfo(); 1366 ~ColorChooserInfo();
1342 1367
1368 bool Matches(RenderFrameHostImpl* render_frame_host, int id);
Charlie Reis 2016/12/13 19:03:56 color_chooser_id
ncarter (slow) 2016/12/14 18:36:47 Done.
1369
1343 int render_process_id; 1370 int render_process_id;
1344 int render_frame_id; 1371 int render_frame_id;
1345 1372
1346 // Color chooser that was opened by this tab. 1373 // Color chooser that was opened by this tab.
1347 std::unique_ptr<ColorChooser> chooser; 1374 std::unique_ptr<ColorChooser> chooser;
1348 1375
1349 // A unique identifier for the current color chooser. Identifiers are 1376 // A unique identifier for the current color chooser. Identifiers are
1350 // unique across a renderer process. This avoids race conditions in 1377 // unique across a renderer process. This avoids race conditions in
1351 // synchronizing the browser and renderer processes. For example, if a 1378 // synchronizing the browser and renderer processes. For example, if a
1352 // renderer closes one chooser and opens another, and simultaneously the 1379 // renderer closes one chooser and opens another, and simultaneously the
(...skipping 15 matching lines...) Expand all
1368 #if BUILDFLAG(ENABLE_PLUGINS) 1395 #if BUILDFLAG(ENABLE_PLUGINS)
1369 // Manages the whitelist of plugin content origins exempt from power saving. 1396 // Manages the whitelist of plugin content origins exempt from power saving.
1370 std::unique_ptr<PluginContentOriginWhitelist> 1397 std::unique_ptr<PluginContentOriginWhitelist>
1371 plugin_content_origin_whitelist_; 1398 plugin_content_origin_whitelist_;
1372 #endif 1399 #endif
1373 1400
1374 // This must be at the end, or else we might get notifications and use other 1401 // This must be at the end, or else we might get notifications and use other
1375 // member variables that are gone. 1402 // member variables that are gone.
1376 NotificationRegistrar registrar_; 1403 NotificationRegistrar registrar_;
1377 1404
1378 // Used during IPC message dispatching from the RenderView/RenderFrame so that
1379 // the handlers can get a pointer to the RVH through which the message was
1380 // received.
1381 RenderViewHost* render_view_message_source_;
1382 RenderFrameHost* render_frame_message_source_;
1383
1384 // All live RenderWidgetHostImpls that are created by this object and may 1405 // All live RenderWidgetHostImpls that are created by this object and may
1385 // outlive it. 1406 // outlive it.
1386 std::set<RenderWidgetHostImpl*> created_widgets_; 1407 std::set<RenderWidgetHostImpl*> created_widgets_;
1387 1408
1388 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is 1409 // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is
1389 // no fullscreen widget. 1410 // no fullscreen widget.
1390 int fullscreen_widget_process_id_; 1411 int fullscreen_widget_process_id_;
1391 1412
1392 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise. 1413 // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
1393 int fullscreen_widget_routing_id_; 1414 int fullscreen_widget_routing_id_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 // Adds/removes a callback called on creation of each new WebContents. 1515 // Adds/removes a callback called on creation of each new WebContents.
1495 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1516 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1496 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1517 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1497 1518
1498 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1519 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1499 }; 1520 };
1500 1521
1501 } // namespace content 1522 } // namespace content
1502 1523
1503 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1524 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698