[email protected] | 91854cd | 2012-01-10 19:43:57 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 | #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 10 | #include <functional> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 11 | #include <map> |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 12 | #include <memory> |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 13 | #include <set> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 14 | #include <string> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 15 | |
[email protected] | 01d6517 | 2011-12-25 04:39:30 | [diff] [blame] | 16 | #include "base/compiler_specific.h" |
[email protected] | c9e3b20 | 2014-08-08 08:24:42 | [diff] [blame] | 17 | #include "base/containers/scoped_ptr_hash_map.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 18 | #include "base/gtest_prod_util.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 19 | #include "base/macros.h" |
[email protected] | 6eac57a | 2011-07-12 21:15:09 | [diff] [blame] | 20 | #include "base/observer_list.h" |
[email protected] | fa20e00 | 2013-07-23 21:20:54 | [diff] [blame] | 21 | #include "base/process/process.h" |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 22 | #include "base/values.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 23 | #include "build/build_config.h" |
[email protected] | d4a8ca48 | 2013-10-30 21:06:40 | [diff] [blame] | 24 | #include "content/browser/frame_host/frame_tree.h" |
| 25 | #include "content/browser/frame_host/navigation_controller_delegate.h" |
| 26 | #include "content/browser/frame_host/navigation_controller_impl.h" |
[email protected] | 190b8c5 | 2013-11-09 01:35:44 | [diff] [blame] | 27 | #include "content/browser/frame_host/navigator_delegate.h" |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 28 | #include "content/browser/frame_host/render_frame_host_delegate.h" |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 29 | #include "content/browser/frame_host/render_frame_host_manager.h" |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 30 | #include "content/browser/media/audio_stream_monitor.h" |
[email protected] | 2e3bf99 | 2012-05-24 17:36:24 | [diff] [blame] | 31 | #include "content/browser/renderer_host/render_view_host_delegate.h" |
creis | c014b40 | 2015-04-23 16:41:45 | [diff] [blame] | 32 | #include "content/browser/renderer_host/render_view_host_impl.h" |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 33 | #include "content/browser/renderer_host/render_widget_host_delegate.h" |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 34 | #include "content/common/accessibility_mode_enums.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 35 | #include "content/common/content_export.h" |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 36 | #include "content/public/browser/color_chooser.h" |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 37 | #include "content/public/browser/notification_observer.h" |
| 38 | #include "content/public/browser/notification_registrar.h" |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 39 | #include "content/public/browser/web_contents.h" |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 40 | #include "content/public/browser/web_contents_observer.h" |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 41 | #include "content/public/common/page_importance_signals.h" |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 42 | #include "content/public/common/renderer_preferences.h" |
[email protected] | 7491ad0 | 2014-07-05 19:10:07 | [diff] [blame] | 43 | #include "content/public/common/resource_type.h" |
[email protected] | 818915cd | 2012-11-20 13:14:11 | [diff] [blame] | 44 | #include "content/public/common/three_d_api_types.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 45 | #include "net/base/load_states.h" |
[email protected] | 6f2ac77 | 2014-07-24 22:22:08 | [diff] [blame] | 46 | #include "net/http/http_response_headers.h" |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 47 | #include "ppapi/features/features.h" |
esprehn | fbba129 | 2016-04-15 17:59:56 | [diff] [blame] | 48 | #include "third_party/WebKit/public/platform/WebDragOperation.h" |
Sylvain Defresne | c6ccc77d | 2014-09-19 10:19:35 | [diff] [blame] | 49 | #include "ui/base/page_transition_types.h" |
tfarina | 3b0452d | 2014-12-31 15:20:09 | [diff] [blame] | 50 | #include "ui/gfx/geometry/rect_f.h" |
tfarina | ebe974f0 | 2015-01-03 04:25:32 | [diff] [blame] | 51 | #include "ui/gfx/geometry/size.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 52 | |
[email protected] | 1ff42797 | 2013-02-07 21:14:07 | [diff] [blame] | 53 | struct ViewHostMsg_DateTimeDialogValue_Params; |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 54 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 55 | namespace service_manager { |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 56 | class InterfaceProvider; |
| 57 | } |
| 58 | |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 59 | namespace content { |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 60 | class BrowserPluginEmbedder; |
| 61 | class BrowserPluginGuest; |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 62 | class DateTimeChooserAndroid; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 63 | class FindRequestManager; |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 64 | class HostZoomMapObserver; |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 65 | class InterstitialPageImpl; |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 66 | class JavaScriptDialogManager; |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 67 | class LoaderIOThreadNotifier; |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 68 | class ManifestManagerHost; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 69 | class MediaWebContentsObserver; |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 70 | class PluginContentOriginWhitelist; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 71 | class RenderViewHost; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 72 | class RenderViewHostDelegateView; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 73 | class RenderWidgetHostImpl; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 74 | class RenderWidgetHostInputEventRouter; |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 75 | class SavePackage; |
lunalu | d4a2cc8 | 2016-11-22 00:27:23 | [diff] [blame] | 76 | class ScreenOrientation; |
| 77 | class ScreenOrientationProvider; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 78 | class SiteInstance; |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 79 | class TestWebContents; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 80 | class TextInputManager; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 81 | class WakeLockServiceContext; |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 82 | class WebContentsAudioMuter; |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 83 | class WebContentsBindingSet; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 84 | class WebContentsDelegate; |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 85 | class WebContentsImpl; |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 86 | class WebContentsView; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 87 | class WebContentsViewDelegate; |
[email protected] | 31a71eaf | 2014-03-13 01:47:36 | [diff] [blame] | 88 | struct AXEventNotificationDetails; |
[email protected] | 8bc5ff0 | 2013-11-29 06:34:03 | [diff] [blame] | 89 | struct ColorSuggestion; |
[email protected] | 795c2897 | 2012-12-06 06:13:39 | [diff] [blame] | 90 | struct FaviconURL; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 91 | struct LoadNotificationDetails; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 92 | struct MHTMLGenerationParams; |
[email protected] | d60f370 | 2013-12-26 16:30:24 | [diff] [blame] | 93 | struct ResourceRedirectDetails; |
| 94 | struct ResourceRequestDetails; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 95 | |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 96 | namespace mojom { |
| 97 | class CreateNewWindowParams; |
| 98 | } |
| 99 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 100 | #if defined(OS_ANDROID) |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 101 | class WebContentsAndroid; |
| 102 | #endif |
| 103 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 104 | #if BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 105 | class PepperPlaybackObserver; |
| 106 | #endif |
| 107 | |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 108 | // Factory function for the implementations that content knows about. Takes |
| 109 | // ownership of |delegate|. |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 110 | WebContentsView* CreateWebContentsView( |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 111 | WebContentsImpl* web_contents, |
| 112 | WebContentsViewDelegate* delegate, |
| 113 | RenderViewHostDelegateView** render_view_host_delegate_view); |
[email protected] | 97714c8 | 2012-06-06 10:15:13 | [diff] [blame] | 114 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 115 | class CONTENT_EXPORT WebContentsImpl |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 116 | : public NON_EXPORTED_BASE(WebContents), |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 117 | public NON_EXPORTED_BASE(RenderFrameHostDelegate), |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 118 | public RenderViewHostDelegate, |
| 119 | public RenderWidgetHostDelegate, |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 120 | public RenderFrameHostManager::Delegate, |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 121 | public NotificationObserver, |
[email protected] | 190b8c5 | 2013-11-09 01:35:44 | [diff] [blame] | 122 | public NON_EXPORTED_BASE(NavigationControllerDelegate), |
| 123 | public NON_EXPORTED_BASE(NavigatorDelegate) { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 124 | public: |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 125 | class FriendZone; |
| 126 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 127 | ~WebContentsImpl() override; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 128 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 129 | static WebContentsImpl* CreateWithOpener( |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 130 | const WebContents::CreateParams& params, |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 131 | FrameTreeNode* opener); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 132 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 133 | static std::vector<WebContentsImpl*> GetAllWebContents(); |
| 134 | |
clamy | a16aa817 | 2015-05-26 13:07:25 | [diff] [blame] | 135 | static WebContentsImpl* FromFrameTreeNode(FrameTreeNode* frame_tree_node); |
clamy | 0d32d6d | 2015-11-24 11:16:26 | [diff] [blame] | 136 | static WebContents* FromRenderFrameHostID(int render_process_host_id, |
| 137 | int render_frame_host_id); |
ananta | 4b7467a5 | 2016-09-23 01:42:38 | [diff] [blame] | 138 | static WebContents* FromFrameTreeNodeId(int frame_tree_node_id); |
clamy | a16aa817 | 2015-05-26 13:07:25 | [diff] [blame] | 139 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 140 | // Complex initialization here. Specifically needed to avoid having |
| 141 | // members call back into our virtual functions in the constructor. |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 142 | virtual void Init(const WebContents::CreateParams& params); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 143 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 144 | // Returns the SavePackage which manages the page saving job. May be NULL. |
| 145 | SavePackage* save_package() const { return save_package_.get(); } |
| 146 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 147 | #if defined(OS_ANDROID) |
[email protected] | 7d244f1 | 2013-08-22 21:41:51 | [diff] [blame] | 148 | // In Android WebView, the RenderView needs created even there is no |
| 149 | // navigation entry, this allows Android WebViews to use |
| 150 | // javascript: URLs that load into the DOMWindow before the first page |
| 151 | // load. This is not safe to do in any context that a web page could get a |
| 152 | // reference to the DOMWindow before the first page load. |
| 153 | bool CreateRenderViewForInitialEmptyDocument(); |
[email protected] | 4cc1ab5 | 2013-01-21 19:24:34 | [diff] [blame] | 154 | #endif |
[email protected] | 276b37a2 | 2011-11-08 20:45:46 | [diff] [blame] | 155 | |
[email protected] | 76518718 | 2012-01-11 23:59:28 | [diff] [blame] | 156 | // Expose the render manager for testing. |
[email protected] | ee87c8be | 2014-03-05 00:35:38 | [diff] [blame] | 157 | // TODO(creis): Remove this now that we can get to it via FrameTreeNode. |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 158 | RenderFrameHostManager* GetRenderManagerForTesting(); |
[email protected] | 76518718 | 2012-01-11 23:59:28 | [diff] [blame] | 159 | |
lazyboy | 8e16ddfd | 2015-09-28 03:41:56 | [diff] [blame] | 160 | // Returns the outer WebContents of this WebContents if any. |
| 161 | // Note that without --site-per-process, this will return the WebContents |
| 162 | // of the BrowserPluginEmbedder, if |this| is a guest. |
| 163 | WebContentsImpl* GetOuterWebContents(); |
| 164 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 165 | // Returns guest browser plugin object, or NULL if this WebContents is not a |
| 166 | // guest. |
[email protected] | f849734 | 2013-02-05 22:15:02 | [diff] [blame] | 167 | BrowserPluginGuest* GetBrowserPluginGuest() const; |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 168 | |
| 169 | // Sets a BrowserPluginGuest object for this WebContents. If this WebContents |
| 170 | // has a BrowserPluginGuest then that implies that it is being hosted by |
| 171 | // a BrowserPlugin object in an embedder renderer process. |
| 172 | void SetBrowserPluginGuest(BrowserPluginGuest* guest); |
| 173 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 174 | // Returns embedder browser plugin object, or NULL if this WebContents is not |
| 175 | // an embedder. |
[email protected] | f849734 | 2013-02-05 22:15:02 | [diff] [blame] | 176 | BrowserPluginEmbedder* GetBrowserPluginEmbedder() const; |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 177 | |
fsamuel | 60b4228 | 2015-03-10 03:29:14 | [diff] [blame] | 178 | // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't |
| 179 | // already exist. |
| 180 | void CreateBrowserPluginEmbedderIfNecessary(); |
| 181 | |
creis | 89a0f78 | 2015-05-27 16:13:17 | [diff] [blame] | 182 | // Cancels modal dialogs in this WebContents, as well as in any browser |
| 183 | // plugins it is hosting. |
| 184 | void CancelActiveAndPendingDialogs(); |
| 185 | |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 186 | // Informs the render view host and the BrowserPluginEmbedder, if present, of |
| 187 | // a Drag Source End. |
paulmeyer | 8fc8ea9 | 2016-11-15 05:12:21 | [diff] [blame] | 188 | void DragSourceEndedAt(int client_x, |
| 189 | int client_y, |
| 190 | int screen_x, |
| 191 | int screen_y, |
Paul Meyer | 0c58c371 | 2016-11-17 22:59:51 | [diff] [blame] | 192 | blink::WebDragOperation operation, |
| 193 | RenderWidgetHost* source_rwh); |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 194 | |
jam | 73f89264 | 2016-09-11 06:04:06 | [diff] [blame] | 195 | // Notification that the RenderViewHost's load state changed. |
| 196 | void LoadStateChanged(const GURL& url, |
| 197 | const net::LoadStateWithParam& load_state, |
| 198 | uint64_t upload_position, |
| 199 | uint64_t upload_size); |
| 200 | |
[email protected] | d60f370 | 2013-12-26 16:30:24 | [diff] [blame] | 201 | // A response has been received for a resource request. |
| 202 | void DidGetResourceResponseStart( |
| 203 | const ResourceRequestDetails& details); |
| 204 | |
| 205 | // A redirect was received while requesting a resource. |
| 206 | void DidGetRedirectForResourceRequest( |
[email protected] | d60f370 | 2013-12-26 16:30:24 | [diff] [blame] | 207 | const ResourceRedirectDetails& details); |
| 208 | |
calamity | 7fe55ce | 2015-04-10 03:59:37 | [diff] [blame] | 209 | // Notify observers that the web contents has been focused. |
| 210 | void NotifyWebContentsFocused(); |
| 211 | |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 212 | WebContentsView* GetView() const; |
| 213 | |
[email protected] | 16620a9 | 2014-05-24 01:05:51 | [diff] [blame] | 214 | bool should_normally_be_visible() { return should_normally_be_visible_; } |
| 215 | |
ccameron | 8807c38f | 2015-01-17 00:29:19 | [diff] [blame] | 216 | // Indicate if the window has been occluded, and pass this to the views, only |
| 217 | // if there is no active capture going on (otherwise it is dropped on the |
| 218 | // floor). |
| 219 | void WasOccluded(); |
| 220 | void WasUnOccluded(); |
| 221 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 222 | // Broadcasts the mode change to all frames. |
| 223 | void SetAccessibilityMode(AccessibilityMode mode); |
| 224 | |
| 225 | // Adds the given accessibility mode to the current accessibility mode |
| 226 | // bitmap. |
| 227 | void AddAccessibilityMode(AccessibilityMode mode); |
| 228 | |
| 229 | // Removes the given accessibility mode from the current accessibility |
| 230 | // mode bitmap, managing the bits that are shared with other modes such |
| 231 | // that a bit will only be turned off when all modes that depend on it |
| 232 | // have been removed. |
| 233 | void RemoveAccessibilityMode(AccessibilityMode mode); |
| 234 | |
dmazzoni | 83ba5c8 | 2015-04-14 07:11:51 | [diff] [blame] | 235 | // Request a one-time snapshot of the accessibility tree without changing |
| 236 | // the accessibility mode. |
dmazzoni | ac6cdd0 | 2015-08-04 21:07:06 | [diff] [blame] | 237 | using AXTreeSnapshotCallback = |
dmazzoni | 329fd01 | 2015-10-22 20:05:35 | [diff] [blame] | 238 | base::Callback<void( |
| 239 | const ui::AXTreeUpdate&)>; |
dmazzoni | 83ba5c8 | 2015-04-14 07:11:51 | [diff] [blame] | 240 | void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback); |
| 241 | |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 242 | // Set a temporary zoom level for the frames associated with this WebContents. |
| 243 | // If |is_temporary| is true, we are setting a new temporary zoom level, |
| 244 | // otherwise we are clearing a previously set temporary zoom level. |
| 245 | void SetTemporaryZoomLevel(double level, bool temporary_zoom_enabled); |
| 246 | |
| 247 | // Sets the zoom level for frames associated with this WebContents. |
| 248 | void UpdateZoom(double level); |
| 249 | |
| 250 | // Sets the zoom level for frames associated with this WebContents if it |
| 251 | // matches |host| and (if non-empty) |scheme|. Matching is done on the |
| 252 | // last committed entry. |
| 253 | void UpdateZoomIfNecessary(const std::string& scheme, |
| 254 | const std::string& host, |
| 255 | double level); |
| 256 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 257 | // Adds a new binding set to the WebContents. Returns a closure which may be |
| 258 | // used to remove the binding set at any time. The closure is safe to call |
| 259 | // even after WebContents destruction. |
| 260 | // |
| 261 | // |binding_set| is not owned and must either outlive this WebContents or be |
| 262 | // explicitly removed before being destroyed. |
| 263 | base::Closure AddBindingSet(const std::string& interface_name, |
| 264 | WebContentsBindingSet* binding_set); |
| 265 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 266 | // WebContents ------------------------------------------------------ |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 267 | WebContentsDelegate* GetDelegate() override; |
| 268 | void SetDelegate(WebContentsDelegate* delegate) override; |
| 269 | NavigationControllerImpl& GetController() override; |
| 270 | const NavigationControllerImpl& GetController() const override; |
| 271 | BrowserContext* GetBrowserContext() const override; |
| 272 | const GURL& GetURL() const override; |
| 273 | const GURL& GetVisibleURL() const override; |
| 274 | const GURL& GetLastCommittedURL() const override; |
| 275 | RenderProcessHost* GetRenderProcessHost() const override; |
clamy | df1975e | 2015-02-05 19:12:24 | [diff] [blame] | 276 | RenderFrameHostImpl* GetMainFrame() override; |
nick | 53d5cbf | 2015-04-23 22:50:14 | [diff] [blame] | 277 | RenderFrameHostImpl* GetFocusedFrame() override; |
rob | 3e2a073 | 2016-01-06 21:22:09 | [diff] [blame] | 278 | RenderFrameHostImpl* FindFrameByFrameTreeNodeId( |
| 279 | int frame_tree_node_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 280 | void ForEachFrame( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 281 | const base::Callback<void(RenderFrameHost*)>& on_frame) override; |
dcheng | afb53e2 | 2016-02-04 08:11:08 | [diff] [blame] | 282 | std::vector<RenderFrameHost*> GetAllFrames() override; |
lukasza | cbdf52e | 2016-01-15 21:19:51 | [diff] [blame] | 283 | int SendToAllFrames(IPC::Message* message) override; |
creis | c014b40 | 2015-04-23 16:41:45 | [diff] [blame] | 284 | RenderViewHostImpl* GetRenderViewHost() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 285 | RenderWidgetHostView* GetRenderWidgetHostView() const override; |
lfg | 265a267 | 2016-04-23 03:11:02 | [diff] [blame] | 286 | RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override; |
nasko | c0fceff | 2015-04-30 15:53:52 | [diff] [blame] | 287 | void ClosePage() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 288 | RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const override; |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 289 | SkColor GetThemeColor() const override; |
avi | e865b1d | 2016-10-24 19:42:59 | [diff] [blame] | 290 | std::unique_ptr<WebUI> CreateSubframeWebUI( |
| 291 | const GURL& url, |
| 292 | const std::string& frame_name) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 293 | WebUI* GetWebUI() const override; |
| 294 | WebUI* GetCommittedWebUI() const override; |
| 295 | void SetUserAgentOverride(const std::string& override) override; |
| 296 | const std::string& GetUserAgentOverride() const override; |
| 297 | void EnableTreeOnlyAccessibilityMode() override; |
| 298 | bool IsTreeOnlyAccessibilityModeForTesting() const override; |
| 299 | bool IsFullAccessibilityModeForTesting() const override; |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 300 | const PageImportanceSignals& GetPageImportanceSignals() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 301 | const base::string16& GetTitle() const override; |
afakhry | 6f0c1ec2 | 2016-07-14 13:55:13 | [diff] [blame] | 302 | void UpdateTitleForEntry(NavigationEntry* entry, |
| 303 | const base::string16& title) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 304 | SiteInstanceImpl* GetSiteInstance() const override; |
| 305 | SiteInstanceImpl* GetPendingSiteInstance() const override; |
| 306 | bool IsLoading() const override; |
| 307 | bool IsLoadingToDifferentDocument() const override; |
| 308 | bool IsWaitingForResponse() const override; |
| 309 | const net::LoadStateWithParam& GetLoadState() const override; |
| 310 | const base::string16& GetLoadStateHost() const override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 311 | uint64_t GetUploadSize() const override; |
| 312 | uint64_t GetUploadPosition() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 313 | const std::string& GetEncoding() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 314 | void IncrementCapturerCount(const gfx::Size& capture_size) override; |
| 315 | void DecrementCapturerCount() override; |
| 316 | int GetCapturerCount() const override; |
| 317 | bool IsAudioMuted() const override; |
| 318 | void SetAudioMuted(bool mute) override; |
ortuno | df4d798 | 2016-04-08 02:33:35 | [diff] [blame] | 319 | bool IsConnectedToBluetoothDevice() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 320 | bool IsCrashed() const override; |
| 321 | void SetIsCrashed(base::TerminationStatus status, int error_code) override; |
| 322 | base::TerminationStatus GetCrashedStatus() const override; |
afakhry | 9824183 | 2016-03-11 19:27:47 | [diff] [blame] | 323 | int GetCrashedErrorCode() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 324 | bool IsBeingDestroyed() const override; |
| 325 | void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; |
altimin | ec87fd1f | 2016-11-17 20:22:49 | [diff] [blame] | 326 | void OnAudioStateChanged(bool is_audible) override; |
gab | 0dccfef | 2015-05-20 18:43:39 | [diff] [blame] | 327 | base::TimeTicks GetLastActiveTime() const override; |
georgesak | 5582cbe | 2015-05-22 22:08:07 | [diff] [blame] | 328 | void SetLastActiveTime(base::TimeTicks last_active_time) override; |
hajimehoshi | c4f226a | 2016-10-21 09:01:57 | [diff] [blame] | 329 | base::TimeTicks GetLastHiddenTime() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 330 | void WasShown() override; |
| 331 | void WasHidden() override; |
| 332 | bool NeedToFireBeforeUnload() override; |
nasko | 148bb0b9 | 2016-05-10 21:03:19 | [diff] [blame] | 333 | void DispatchBeforeUnload() override; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 334 | void AttachToOuterWebContentsFrame( |
| 335 | WebContents* outer_web_contents, |
| 336 | RenderFrameHost* outer_contents_frame) override; |
dalecurtis | 6c58ed0 | 2016-10-28 23:02:37 | [diff] [blame] | 337 | void DidChangeVisibleSecurityState() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 338 | void Stop() override; |
| 339 | WebContents* Clone() override; |
toyoshim | 24a4c7ab | 2016-04-05 09:24:14 | [diff] [blame] | 340 | void ReloadFocusedFrame(bool bypass_cache) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 341 | void Undo() override; |
| 342 | void Redo() override; |
| 343 | void Cut() override; |
| 344 | void Copy() override; |
| 345 | void CopyToFindPboard() override; |
| 346 | void Paste() override; |
| 347 | void PasteAndMatchStyle() override; |
| 348 | void Delete() override; |
| 349 | void SelectAll() override; |
| 350 | void Unselect() override; |
| 351 | void Replace(const base::string16& word) override; |
| 352 | void ReplaceMisspelling(const base::string16& word) override; |
| 353 | void NotifyContextMenuClosed( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 354 | const CustomContextMenuContext& context) override; |
megjablon | 3f594107 | 2016-02-04 23:27:52 | [diff] [blame] | 355 | void ReloadLoFiImages() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 356 | void ExecuteCustomContextMenuCommand( |
| 357 | int action, |
| 358 | const CustomContextMenuContext& context) override; |
| 359 | gfx::NativeView GetNativeView() override; |
| 360 | gfx::NativeView GetContentNativeView() override; |
| 361 | gfx::NativeWindow GetTopLevelNativeWindow() override; |
| 362 | gfx::Rect GetContainerBounds() override; |
| 363 | gfx::Rect GetViewBounds() override; |
| 364 | DropData* GetDropData() override; |
| 365 | void Focus() override; |
| 366 | void SetInitialFocus() override; |
| 367 | void StoreFocus() override; |
| 368 | void RestoreFocus() override; |
| 369 | void FocusThroughTabTraversal(bool reverse) override; |
| 370 | bool ShowingInterstitialPage() const override; |
| 371 | InterstitialPage* GetInterstitialPage() const override; |
| 372 | bool IsSavable() override; |
| 373 | void OnSavePage() override; |
| 374 | bool SavePage(const base::FilePath& main_file, |
| 375 | const base::FilePath& dir_path, |
| 376 | SavePageType save_type) override; |
| 377 | void SaveFrame(const GURL& url, const Referrer& referrer) override; |
kundaji | 6c7f969 | 2015-03-09 18:00:37 | [diff] [blame] | 378 | void SaveFrameWithHeaders(const GURL& url, |
| 379 | const Referrer& referrer, |
| 380 | const std::string& headers) override; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 381 | void GenerateMHTML(const MHTMLGenerationParams& params, |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 382 | const base::Callback<void(int64_t)>& callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 383 | const std::string& GetContentsMimeType() const override; |
| 384 | bool WillNotifyDisconnection() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 385 | RendererPreferences* GetMutableRendererPrefs() override; |
| 386 | void Close() override; |
Paul Meyer | 0c58c371 | 2016-11-17 22:59:51 | [diff] [blame] | 387 | void SystemDragEnded(RenderWidgetHost* source_rwh) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 388 | void UserGestureDone() override; |
| 389 | void SetClosedByUserGesture(bool value) override; |
| 390 | bool GetClosedByUserGesture() const override; |
| 391 | void ViewSource() override; |
| 392 | void ViewFrameSource(const GURL& url, const PageState& page_state) override; |
| 393 | int GetMinimumZoomPercent() const override; |
| 394 | int GetMaximumZoomPercent() const override; |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 395 | void SetPageScale(float page_scale_factor) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 396 | gfx::Size GetPreferredSize() const override; |
| 397 | bool GotResponseToLockMouseRequest(bool allowed) override; |
| 398 | bool HasOpener() const override; |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 399 | WebContentsImpl* GetOpener() const override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 400 | void DidChooseColorInColorChooser(SkColor color) override; |
| 401 | void DidEndColorChooser() override; |
| 402 | int DownloadImage(const GURL& url, |
| 403 | bool is_favicon, |
| 404 | uint32_t max_bitmap_size, |
pkotwicz | fd77355 | 2015-03-16 00:29:14 | [diff] [blame] | 405 | bool bypass_cache, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 406 | const ImageDownloadCallback& callback) override; |
| 407 | bool IsSubframe() const override; |
| 408 | void Find(int request_id, |
| 409 | const base::string16& search_text, |
| 410 | const blink::WebFindOptions& options) override; |
| 411 | void StopFinding(StopFindAction action) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 412 | bool WasRecentlyAudible() override; |
dominickn | 6919ce3 | 2015-10-15 01:52:28 | [diff] [blame] | 413 | void GetManifest(const GetManifestCallback& callback) override; |
bokan | ece34a8 | 2016-01-28 19:49:46 | [diff] [blame] | 414 | void ExitFullscreen(bool will_cause_resize) override; |
mariakhomenko | 44bdc473 | 2015-04-29 01:55:38 | [diff] [blame] | 415 | void ResumeLoadingCreatedWebContents() override; |
estark | 703f1b4 | 2016-10-10 21:37:15 | [diff] [blame] | 416 | void OnPasswordInputShownOnHttp() override; |
estark | fae6b587 | 2016-11-04 05:20:31 | [diff] [blame] | 417 | void OnAllPasswordInputsHiddenOnHttp() override; |
estark | 703f1b4 | 2016-10-10 21:37:15 | [diff] [blame] | 418 | void OnCreditCardInputShownOnHttp() override; |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 419 | void SetIsOverlayContent(bool is_overlay_content) override; |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 420 | |
mlamouri | 91873409 | 2016-03-12 04:47:52 | [diff] [blame] | 421 | #if defined(OS_ANDROID) |
dcheng | 48d97c5 | 2015-02-04 20:03:20 | [diff] [blame] | 422 | base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 423 | virtual WebContentsAndroid* GetWebContentsAndroid(); |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 424 | void ActivateNearestFindResult(float x, float y) override; |
| 425 | void RequestFindMatchRects(int current_version) override; |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 426 | service_manager::InterfaceProvider* GetJavaInterfaces() override; |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 427 | #elif defined(OS_MACOSX) |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 428 | void SetAllowOtherViews(bool allow) override; |
| 429 | bool GetAllowOtherViews() override; |
[email protected] | 155c7f2 | 2013-12-09 17:07:18 | [diff] [blame] | 430 | #endif |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 431 | |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 432 | // Implementation of PageNavigator. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 433 | WebContents* OpenURL(const OpenURLParams& params) override; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 434 | |
[email protected] | 6b618e6 | 2012-08-16 12:59:18 | [diff] [blame] | 435 | // Implementation of IPC::Sender. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 436 | bool Send(IPC::Message* message) override; |
[email protected] | 6b618e6 | 2012-08-16 12:59:18 | [diff] [blame] | 437 | |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 438 | // RenderFrameHostDelegate --------------------------------------------------- |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 439 | bool OnMessageReceived(RenderFrameHost* render_frame_host, |
| 440 | const IPC::Message& message) override; |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 441 | void OnAssociatedInterfaceRequest( |
| 442 | RenderFrameHost* render_frame_host, |
| 443 | const std::string& interface_name, |
| 444 | mojo::ScopedInterfaceEndpointHandle handle) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 445 | const GURL& GetMainFrameLastCommittedURL() const override; |
| 446 | void RenderFrameCreated(RenderFrameHost* render_frame_host) override; |
| 447 | void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 448 | void ShowContextMenu(RenderFrameHost* render_frame_host, |
| 449 | const ContextMenuParams& params) override; |
| 450 | void RunJavaScriptMessage(RenderFrameHost* render_frame_host, |
| 451 | const base::string16& message, |
| 452 | const base::string16& default_prompt, |
| 453 | const GURL& frame_url, |
| 454 | JavaScriptMessageType type, |
| 455 | IPC::Message* reply_msg) override; |
| 456 | void RunBeforeUnloadConfirm(RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 457 | bool is_reload, |
| 458 | IPC::Message* reply_msg) override; |
nasko | ada75b2 | 2016-06-11 16:09:46 | [diff] [blame] | 459 | void RunFileChooser(RenderFrameHost* render_frame_host, |
| 460 | const FileChooserParams& params) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 461 | void DidAccessInitialDocument() override; |
alexmos | be2f4c3 | 2015-03-10 02:30:23 | [diff] [blame] | 462 | void DidChangeName(RenderFrameHost* render_frame_host, |
| 463 | const std::string& name) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 464 | void DocumentOnLoadCompleted(RenderFrameHost* render_frame_host) override; |
creis | 8eb8ef2 | 2015-11-04 22:51:38 | [diff] [blame] | 465 | void UpdateStateForFrame(RenderFrameHost* render_frame_host, |
| 466 | const PageState& page_state) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 467 | void UpdateTitle(RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 468 | const base::string16& title, |
| 469 | base::i18n::TextDirection title_direction) override; |
| 470 | void UpdateEncoding(RenderFrameHost* render_frame_host, |
| 471 | const std::string& encoding) override; |
| 472 | WebContents* GetAsWebContents() override; |
| 473 | bool IsNeverVisible() override; |
| 474 | AccessibilityMode GetAccessibilityMode() const override; |
| 475 | void AccessibilityEventReceived( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 476 | const std::vector<AXEventNotificationDetails>& details) override; |
dmazzoni | 2400c46 | 2016-08-23 15:07:13 | [diff] [blame] | 477 | void AccessibilityLocationChangesReceived( |
| 478 | const std::vector<AXLocationChangeNotificationDetails>& details) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 479 | RenderFrameHost* GetGuestByInstanceID( |
fsamuel | 833ee7c | 2015-02-13 23:40:40 | [diff] [blame] | 480 | RenderFrameHost* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 481 | int browser_plugin_instance_id) override; |
mcasas | 4e216e7 | 2016-07-28 21:28:38 | [diff] [blame] | 482 | device::GeolocationServiceContext* GetGeolocationServiceContext() override; |
blundell | d46e883 | 2016-10-07 10:34:27 | [diff] [blame] | 483 | device::WakeLockServiceContext* GetWakeLockServiceContext() override; |
lunalu | d4a2cc8 | 2016-11-22 00:27:23 | [diff] [blame] | 484 | ScreenOrientationProvider* GetScreenOrientationProvider() override; |
mlamouri | 7a78d6fd | 2015-01-17 13:23:53 | [diff] [blame] | 485 | void EnterFullscreenMode(const GURL& origin) override; |
bokan | ece34a8 | 2016-01-28 19:49:46 | [diff] [blame] | 486 | void ExitFullscreenMode(bool will_cause_resize) override; |
alexmos | e7da5a1 | 2015-04-09 02:22:16 | [diff] [blame] | 487 | bool ShouldRouteMessageEvent( |
| 488 | RenderFrameHost* target_rfh, |
| 489 | SiteInstance* source_site_instance) const override; |
alexmos | 5872904 | 2015-06-18 23:20:00 | [diff] [blame] | 490 | void EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) override; |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 491 | std::unique_ptr<WebUIImpl> CreateWebUIForRenderFrameHost( |
| 492 | const GURL& url) override; |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 493 | void SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) override; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 494 | |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 495 | // RenderViewHostDelegate ---------------------------------------------------- |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 496 | RenderViewHostDelegateView* GetDelegateView() override; |
| 497 | bool OnMessageReceived(RenderViewHost* render_view_host, |
| 498 | const IPC::Message& message) override; |
[email protected] | a86c0e96 | 2013-12-17 17:10:39 | [diff] [blame] | 499 | // RenderFrameHostDelegate has the same method, so list it there because this |
| 500 | // interface is going away. |
nick | 5120892 | 2015-04-24 21:38:37 | [diff] [blame] | 501 | // WebContents* GetAsWebContents() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 502 | void RenderViewCreated(RenderViewHost* render_view_host) override; |
| 503 | void RenderViewReady(RenderViewHost* render_view_host) override; |
| 504 | void RenderViewTerminated(RenderViewHost* render_view_host, |
| 505 | base::TerminationStatus status, |
| 506 | int error_code) override; |
| 507 | void RenderViewDeleted(RenderViewHost* render_view_host) override; |
| 508 | void UpdateState(RenderViewHost* render_view_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 509 | const PageState& page_state) override; |
sky | 8b00392d | 2015-01-10 00:30:28 | [diff] [blame] | 510 | void UpdateTargetURL(RenderViewHost* render_view_host, |
| 511 | const GURL& url) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 512 | void Close(RenderViewHost* render_view_host) override; |
| 513 | void RequestMove(const gfx::Rect& new_bounds) override; |
| 514 | void DidCancelLoading() override; |
| 515 | void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) override; |
| 516 | void RouteCloseEvent(RenderViewHost* rvh) override; |
avi | a90ae4e | 2016-11-11 20:49:33 | [diff] [blame] | 517 | bool DidAddMessageToConsole(int32_t level, |
| 518 | const base::string16& message, |
| 519 | int32_t line_no, |
| 520 | const base::string16& source_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 521 | RendererPreferences GetRendererPrefs( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 522 | BrowserContext* browser_context) const override; |
dominickn | 9c7ceaa3 | 2016-02-27 01:52:53 | [diff] [blame] | 523 | void OnUserInteraction(RenderWidgetHostImpl* render_widget_host, |
| 524 | const blink::WebInputEvent::Type type) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 525 | void OnIgnoredUIEvent() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 526 | void Activate() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 527 | void UpdatePreferredSize(const gfx::Size& pref_size) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 528 | void CreateNewWindow( |
alexmos | 4cf2aa3 | 2015-07-15 23:40:43 | [diff] [blame] | 529 | SiteInstance* source_site_instance, |
dcheng | 3ce04b6 | 2015-10-26 23:30:55 | [diff] [blame] | 530 | int32_t route_id, |
| 531 | int32_t main_frame_route_id, |
| 532 | int32_t main_frame_widget_route_id, |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 533 | const mojom::CreateNewWindowParams& params, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 534 | SessionStorageNamespace* session_storage_namespace) override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 535 | void CreateNewWidget(int32_t render_process_id, |
| 536 | int32_t route_id, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 537 | blink::WebPopupType popup_type) override; |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 538 | void CreateNewFullscreenWidget(int32_t render_process_id, |
| 539 | int32_t route_id) override; |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 540 | void ShowCreatedWindow(int process_id, |
| 541 | int route_id, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 542 | WindowOpenDisposition disposition, |
bokan | 107a47f | 2015-02-03 23:23:39 | [diff] [blame] | 543 | const gfx::Rect& initial_rect, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 544 | bool user_gesture) override; |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 545 | void ShowCreatedWidget(int process_id, |
| 546 | int route_id, |
| 547 | const gfx::Rect& initial_rect) override; |
| 548 | void ShowCreatedFullscreenWidget(int process_id, int route_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 549 | void RequestMediaAccessPermission( |
[email protected] | 33662e5 | 2013-01-07 21:31:09 | [diff] [blame] | 550 | const MediaStreamRequest& request, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 551 | const MediaResponseCallback& callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 552 | bool CheckMediaAccessPermission(const GURL& security_origin, |
| 553 | MediaStreamType type) override; |
| 554 | SessionStorageNamespace* GetSessionStorageNamespace( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 555 | SiteInstance* instance) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 556 | SessionStorageNamespaceMap GetSessionStorageNamespaceMap() override; |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 557 | double GetPendingPageZoomLevel() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 558 | FrameTree* GetFrameTree() override; |
luken | dc35e7f | 2014-11-10 19:06:14 | [diff] [blame] | 559 | void SetIsVirtualKeyboardRequested(bool requested) override; |
| 560 | bool IsVirtualKeyboardRequested() override; |
aelias | 5252baa | 2016-04-10 01:18:02 | [diff] [blame] | 561 | bool IsOverridingUserAgent() override; |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 562 | bool IsJavaScriptDialogShowing() const override; |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 563 | bool HideDownloadUI() const override; |
luken | dc35e7f | 2014-11-10 19:06:14 | [diff] [blame] | 564 | |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 565 | // NavigatorDelegate --------------------------------------------------------- |
| 566 | |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 567 | void DidStartNavigation(NavigationHandle* navigation_handle) override; |
| 568 | void DidRedirectNavigation(NavigationHandle* navigation_handle) override; |
clamy | efca29e | 2015-09-17 00:22:11 | [diff] [blame] | 569 | void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 570 | void DidFinishNavigation(NavigationHandle* navigation_handle) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 571 | void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host, |
| 572 | const GURL& validated_url, |
arthursonzogni | ee7f43b | 2016-12-06 10:52:29 | [diff] [blame] | 573 | bool is_error_page) override; |
lazyboy | 552a938 | 2016-07-14 20:38:37 | [diff] [blame] | 574 | void DidFailProvisionalLoadWithError(RenderFrameHostImpl* render_frame_host, |
| 575 | const GURL& validated_url, |
| 576 | int error_code, |
| 577 | const base::string16& error_description, |
| 578 | bool was_ignored_by_handler) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 579 | void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host, |
| 580 | const GURL& url, |
| 581 | int error_code, |
gsennton | 6fbb3869 | 2015-06-24 19:23:55 | [diff] [blame] | 582 | const base::string16& error_description, |
| 583 | bool was_ignored_by_handler) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 584 | void DidCommitProvisionalLoad(RenderFrameHostImpl* render_frame_host, |
| 585 | const GURL& url, |
| 586 | ui::PageTransition transition_type) override; |
| 587 | void DidNavigateMainFramePreCommit(bool navigation_is_within_page) override; |
| 588 | void DidNavigateMainFramePostCommit( |
sky | 8b00392d | 2015-01-10 00:30:28 | [diff] [blame] | 589 | RenderFrameHostImpl* render_frame_host, |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 590 | const LoadCommittedDetails& details, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 591 | const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 592 | void DidNavigateAnyFramePostCommit( |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 593 | RenderFrameHostImpl* render_frame_host, |
| 594 | const LoadCommittedDetails& details, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 595 | const FrameHostMsg_DidCommitProvisionalLoad_Params& params) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 596 | void SetMainFrameMimeType(const std::string& mime_type) override; |
| 597 | bool CanOverscrollContent() const override; |
| 598 | void NotifyChangedNavigationState(InvalidateTypes changed_flags) override; |
toyoshim | 0df1d3a | 2016-09-09 09:52:48 | [diff] [blame] | 599 | void DidStartNavigationToPendingEntry(const GURL& url, |
| 600 | ReloadType reload_type) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 601 | void RequestOpenURL(RenderFrameHostImpl* render_frame_host, |
| 602 | const OpenURLParams& params) override; |
lukasza | 1d02573 | 2016-09-28 21:36:08 | [diff] [blame] | 603 | bool ShouldTransferNavigation(bool is_main_frame_navigation) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 604 | bool ShouldPreserveAbortedURLs() override; |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 605 | void DidStartLoading(FrameTreeNode* frame_tree_node, |
| 606 | bool to_different_document) override; |
| 607 | void DidStopLoading() override; |
| 608 | void DidChangeLoadProgress() override; |
clamy | cbf524d4 | 2016-09-27 12:48:35 | [diff] [blame] | 609 | ScopedVector<NavigationThrottle> CreateThrottlesForNavigation( |
| 610 | NavigationHandle* navigation_handle) override; |
clamy | 1e5574e | 2016-09-29 16:48:44 | [diff] [blame] | 611 | std::unique_ptr<NavigationUIData> GetNavigationUIData( |
| 612 | NavigationHandle* navigation_handle) override; |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 613 | |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 614 | // RenderWidgetHostDelegate -------------------------------------------------- |
| 615 | |
lazyboy | 63f5b31 | 2015-11-23 20:19:52 | [diff] [blame] | 616 | void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 617 | void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override; |
miu | 9e14e49 | 2014-10-25 02:39:04 | [diff] [blame] | 618 | void RenderWidgetGotFocus(RenderWidgetHostImpl* render_widget_host) override; |
rouslan | 2f5993f | 2015-01-29 00:18:31 | [diff] [blame] | 619 | void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host, |
| 620 | bool width_changed) override; |
avi | c3aa842 | 2015-11-09 20:57:22 | [diff] [blame] | 621 | void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host, |
| 622 | const gfx::Size& new_size) override; |
paulmeyer | 9ef6e446 | 2015-02-24 19:15:10 | [diff] [blame] | 623 | void ScreenInfoChanged() override; |
wjmaclean | 8a795f3 | 2016-08-11 23:49:58 | [diff] [blame] | 624 | void UpdateDeviceScaleFactor(double device_scale_factor) override; |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 625 | void GetScreenInfo(ScreenInfo* screen_info) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 626 | bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 627 | bool* is_keyboard_shortcut) override; |
| 628 | void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) override; |
| 629 | bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override; |
| 630 | bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 631 | BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() override; |
| 632 | BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager() |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 633 | override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 634 | // The following 4 functions are already listed under WebContents overrides: |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 635 | // void Cut() override; |
| 636 | // void Copy() override; |
| 637 | // void Paste() override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 638 | // void SelectAll() override; |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 639 | void MoveRangeSelectionExtent(const gfx::Point& extent) override; |
| 640 | void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; |
aurimas | ab031902 | 2015-07-10 21:57:38 | [diff] [blame] | 641 | void AdjustSelectionByCharacterOffset(int start_adjust, int end_adjust) |
| 642 | override; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 643 | RenderWidgetHostInputEventRouter* GetInputEventRouter() override; |
alexmos | 3fcd0ca | 2015-10-23 18:18:33 | [diff] [blame] | 644 | void ReplicatePageFocus(bool is_focused) override; |
alexmos | c4cbacb | 2015-11-21 01:29:22 | [diff] [blame] | 645 | RenderWidgetHostImpl* GetFocusedRenderWidgetHost( |
| 646 | RenderWidgetHostImpl* receiving_widget) override; |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 647 | RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override; |
| 648 | void FocusOwningWebContents( |
| 649 | RenderWidgetHostImpl* render_widget_host) override; |
dtapuska | e99ec6e5 | 2016-10-18 00:15:42 | [diff] [blame] | 650 | void RendererUnresponsive(RenderWidgetHostImpl* render_widget_host, |
| 651 | RendererUnresponsiveType type) override; |
avi | c3aa842 | 2015-11-09 20:57:22 | [diff] [blame] | 652 | void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override; |
| 653 | void RequestToLockMouse(RenderWidgetHostImpl* render_widget_host, |
| 654 | bool user_gesture, |
lfg | ad824435 | 2016-07-13 16:55:51 | [diff] [blame] | 655 | bool last_unlocked_by_target, |
| 656 | bool privileged) override; |
alexmos | 5dd617d | 2016-06-07 04:21:15 | [diff] [blame] | 657 | bool IsFullscreenForCurrentTab() const override; |
avi | bf58fa0c | 2015-11-11 01:45:52 | [diff] [blame] | 658 | blink::WebDisplayMode GetDisplayMode( |
| 659 | RenderWidgetHostImpl* render_widget_host) const override; |
avi | 3e4b851 | 2015-11-11 01:55:49 | [diff] [blame] | 660 | void LostCapture(RenderWidgetHostImpl* render_widget_host) override; |
| 661 | void LostMouseLock(RenderWidgetHostImpl* render_widget_host) override; |
lfg | ad824435 | 2016-07-13 16:55:51 | [diff] [blame] | 662 | bool HasMouseLock(RenderWidgetHostImpl* render_widget_host) override; |
dtrainor | 5ef644e | 2015-11-19 00:12:47 | [diff] [blame] | 663 | void ForwardCompositorProto(RenderWidgetHostImpl* render_widget_host, |
| 664 | const std::vector<uint8_t>& proto) override; |
ekaramad | a4f4269 | 2016-02-11 19:48:37 | [diff] [blame] | 665 | void OnRenderFrameProxyVisibilityChanged(bool visible) override; |
lfg | bb9c28a | 2016-03-01 03:19:49 | [diff] [blame] | 666 | void SendScreenRects() override; |
khushalsagar | f3b62b6 | 2016-05-26 21:54:23 | [diff] [blame] | 667 | void OnFirstPaintAfterLoad(RenderWidgetHostImpl* render_widget_host) override; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 668 | TextInputManager* GetTextInputManager() override; |
paulmeyer | 7f6f1d4f | 2016-11-15 00:00:27 | [diff] [blame] | 669 | bool OnUpdateDragCursor() override; |
nzolghadr | d87a308d | 2016-12-07 15:45:56 | [diff] [blame^] | 670 | bool AddDomainInfoToRapporSample(rappor::Sample* sample) override; |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 671 | |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 672 | // RenderFrameHostManager::Delegate ------------------------------------------ |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 673 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 674 | bool CreateRenderViewForRenderManager( |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 675 | RenderViewHost* render_view_host, |
alexmos | 5ac402d | 2015-07-09 07:51:10 | [diff] [blame] | 676 | int opener_frame_routing_id, |
[email protected] | 5a7100d | 2014-05-19 01:29:04 | [diff] [blame] | 677 | int proxy_routing_id, |
lfg | bede639 | 2015-09-11 21:54:06 | [diff] [blame] | 678 | const FrameReplicationState& replicated_frame_state) override; |
| 679 | void CreateRenderWidgetHostViewForRenderManager( |
| 680 | RenderViewHost* render_view_host) override; |
alexmos | a181efc | 2015-09-03 00:39:04 | [diff] [blame] | 681 | bool CreateRenderFrameForRenderManager( |
| 682 | RenderFrameHost* render_frame_host, |
| 683 | int proxy_routing_id, |
| 684 | int opener_routing_id, |
| 685 | int parent_routing_id, |
| 686 | int previous_sibling_routing_id) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 687 | void BeforeUnloadFiredFromRenderManager( |
| 688 | bool proceed, |
| 689 | const base::TimeTicks& proceed_time, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 690 | bool* proceed_to_fire_unload) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 691 | void RenderProcessGoneFromRenderManager( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 692 | RenderViewHost* render_view_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 693 | void UpdateRenderViewSizeForRenderManager() override; |
| 694 | void CancelModalDialogsForRenderManager() override; |
| 695 | void NotifySwappedFromRenderManager(RenderFrameHost* old_host, |
| 696 | RenderFrameHost* new_host, |
| 697 | bool is_main_frame) override; |
nasko | f5940b9f | 2015-03-02 23:04:05 | [diff] [blame] | 698 | void NotifyMainFrameSwappedFromRenderManager( |
| 699 | RenderViewHost* old_host, |
| 700 | RenderViewHost* new_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 701 | NavigationControllerImpl& GetControllerForRenderManager() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 702 | NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() override; |
| 703 | bool FocusLocationBarByDefault() override; |
| 704 | void SetFocusToLocationBar(bool select_all) override; |
| 705 | bool IsHidden() override; |
rob | 9725074 | 2015-12-10 17:45:15 | [diff] [blame] | 706 | int GetOuterDelegateFrameTreeNodeId() override; |
ekaramad | aeb3c5c | 2016-11-09 03:22:35 | [diff] [blame] | 707 | RenderWidgetHostImpl* GetFullscreenRenderWidgetHost() const override; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 708 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 709 | // NotificationObserver ------------------------------------------------------ |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 710 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 711 | void Observe(int type, |
| 712 | const NotificationSource& source, |
| 713 | const NotificationDetails& details) override; |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 714 | |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 715 | // NavigationControllerDelegate ---------------------------------------------- |
| 716 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 717 | WebContents* GetWebContents() override; |
| 718 | void NotifyNavigationEntryCommitted( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 719 | const LoadCommittedDetails& load_details) override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 720 | |
| 721 | // Invoked before a form repost warning is shown. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 722 | void NotifyBeforeFormRepostWarningShow() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 723 | |
| 724 | // Activate this WebContents and show a form repost warning. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 725 | void ActivateAndShowRepostFormWarningDialog() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 726 | |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 727 | // Whether the initial empty page of this view has been accessed by another |
| 728 | // page, making it unsafe to show the pending URL. Always false after the |
| 729 | // first commit. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 730 | bool HasAccessedInitialDocument() override; |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 731 | |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 732 | // Sets the history for this WebContentsImpl to |history_length| entries, with |
alexmos | 136fd6e6 | 2016-08-15 20:58:41 | [diff] [blame] | 733 | // an offset of |history_offset|. This notifies all renderers involved in |
| 734 | // rendering the current page about the new offset and length. |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 735 | void SetHistoryOffsetAndLength(int history_offset, |
| 736 | int history_length) override; |
[email protected] | 553602e1 | 2011-04-05 17:01:18 | [diff] [blame] | 737 | |
[email protected] | a86c0e96 | 2013-12-17 17:10:39 | [diff] [blame] | 738 | // Called by InterstitialPageImpl when it creates a RenderFrameHost. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 739 | void RenderFrameForInterstitialPageCreated( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 740 | RenderFrameHost* render_frame_host) override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 741 | |
| 742 | // Sets the passed interstitial as the currently showing interstitial. |
| 743 | // No interstitial page should already be attached. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 744 | void AttachInterstitialPage(InterstitialPageImpl* interstitial_page) override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 745 | |
| 746 | // Unsets the currently showing interstitial. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 747 | void DetachInterstitialPage() override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 748 | |
aelias | 5252baa | 2016-04-10 01:18:02 | [diff] [blame] | 749 | void UpdateOverridingUserAgent() override; |
| 750 | |
clamy | 44e84ce | 2016-02-22 15:38:25 | [diff] [blame] | 751 | // Unpause the throbber if it was paused. |
| 752 | void DidProceedOnInterstitial() override; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 753 | |
[email protected] | e4abd3b4 | 2013-11-12 18:28:47 | [diff] [blame] | 754 | typedef base::Callback<void(WebContents*)> CreatedCallback; |
[email protected] | 561628ce | 2013-10-25 00:56:47 | [diff] [blame] | 755 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 756 | // Forces overscroll to be disabled (used by touch emulation). |
| 757 | void SetForceDisableOverscrollContent(bool force_disable); |
| 758 | |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 759 | AudioStreamMonitor* audio_stream_monitor() { |
| 760 | return &audio_stream_monitor_; |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 761 | } |
| 762 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 763 | // Called by MediaWebContentsObserver when playback starts or stops. See the |
| 764 | // WebContentsObserver function stubs for more details. |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 765 | void MediaStartedPlaying( |
| 766 | const WebContentsObserver::MediaPlayerInfo& media_info, |
| 767 | const WebContentsObserver::MediaPlayerId& id); |
| 768 | void MediaStoppedPlaying( |
| 769 | const WebContentsObserver::MediaPlayerInfo& media_info, |
| 770 | const WebContentsObserver::MediaPlayerId& id); |
| 771 | int GetCurrentlyPlayingVideoCount() override; |
| 772 | |
| 773 | bool IsFullscreen() override; |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 774 | |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 775 | MediaWebContentsObserver* media_web_contents_observer() { |
| 776 | return media_web_contents_observer_.get(); |
| 777 | } |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 778 | |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 779 | // Update the web contents visibility. |
| 780 | void UpdateWebContentsVisibility(bool visible); |
| 781 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 782 | // Called by FindRequestManager when find replies come in from a renderer |
| 783 | // process. |
| 784 | void NotifyFindReply(int request_id, |
| 785 | int number_of_matches, |
| 786 | const gfx::Rect& selection_rect, |
| 787 | int active_match_ordinal, |
| 788 | bool final_update); |
| 789 | |
ortuno | 467e579 | 2016-06-10 04:32:39 | [diff] [blame] | 790 | // Modify the counter of connected devices for this WebContents. |
| 791 | void IncrementBluetoothConnectedDeviceCount(); |
| 792 | void DecrementBluetoothConnectedDeviceCount(); |
| 793 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 794 | #if defined(OS_ANDROID) |
| 795 | // Called by FindRequestManager when all of the find match rects are in. |
| 796 | void NotifyFindMatchRectsReply(int version, |
| 797 | const std::vector<gfx::RectF>& rects, |
| 798 | const gfx::RectF& active_rect); |
| 799 | #endif |
| 800 | |
lof84 | 501da08 | 2016-05-23 21:22:54 | [diff] [blame] | 801 | private: |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 802 | friend class WebContentsObserver; |
| 803 | friend class WebContents; // To implement factory methods. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 804 | |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 805 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 806 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
[email protected] | 45a22ad | 2013-02-21 03:25:00 | [diff] [blame] | 807 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 808 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 809 | CrossSiteCantPreemptAfterUnload); |
[email protected] | ceee8cd | 2013-03-08 04:59:51 | [diff] [blame] | 810 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); |
[email protected] | 5090445 | 2013-05-09 02:05:12 | [diff] [blame] | 811 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); |
[email protected] | 9a89045 | 2014-02-13 22:21:02 | [diff] [blame] | 812 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTime); |
estark | a5635c4 | 2015-07-14 00:06:53 | [diff] [blame] | 813 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 814 | LoadResourceFromMemoryCacheWithBadSecurityInfo); |
jww | f4684d1 | 2015-09-02 06:12:52 | [diff] [blame] | 815 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
jam | 91dd24e | 2016-08-12 17:16:42 | [diff] [blame] | 816 | LoadResourceWithEmptySecurityInfo); |
avi | d53461d | 2016-02-25 17:15:04 | [diff] [blame] | 817 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 818 | ResetJavaScriptDialogOnUserNavigate); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 819 | FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 820 | FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 821 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 822 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 823 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 824 | TwoSubframesCreatePopupsSimultaneously); |
| 825 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 826 | TwoSubframesCreatePopupMenuWidgetsSimultaneously); |
dmazzoni | 0b5d248 | 2014-09-10 19:45:57 | [diff] [blame] | 827 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, |
| 828 | CrossSiteIframeAccessibility); |
avi | c529387b | 2016-04-06 16:14:53 | [diff] [blame] | 829 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 830 | JavaScriptDialogsInMainAndSubframes); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 831 | |
paulmeyer | a41de3b | 2016-05-05 16:30:18 | [diff] [blame] | 832 | // So |find_request_manager_| can be accessed for testing. |
| 833 | friend class FindRequestManagerTest; |
| 834 | |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 835 | // TODO(brettw) TestWebContents shouldn't exist! |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 836 | friend class TestWebContents; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 837 | |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 838 | class DestructionObserver; |
| 839 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 840 | // Represents a WebContents node in a tree of WebContents structure. |
| 841 | // |
| 842 | // Two WebContents with separate FrameTrees can be connected by |
| 843 | // outer/inner relationship using this class. Note that their FrameTrees |
| 844 | // still remain disjoint. |
| 845 | // The parent is referred to as "outer WebContents" and the descendents are |
| 846 | // referred to as "inner WebContents". |
| 847 | // For each inner WebContents, the outer WebContents will have a |
| 848 | // corresponding FrameTreeNode. |
| 849 | struct WebContentsTreeNode { |
| 850 | public: |
| 851 | WebContentsTreeNode(); |
| 852 | ~WebContentsTreeNode(); |
| 853 | |
| 854 | typedef std::set<WebContentsTreeNode*> ChildrenSet; |
| 855 | |
| 856 | void ConnectToOuterWebContents(WebContentsImpl* outer_web_contents, |
| 857 | RenderFrameHostImpl* outer_contents_frame); |
| 858 | |
| 859 | WebContentsImpl* outer_web_contents() { return outer_web_contents_; } |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 860 | int outer_contents_frame_tree_node_id() const { |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 861 | return outer_contents_frame_tree_node_id_; |
| 862 | } |
| 863 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 864 | WebContentsImpl* focused_web_contents() { return focused_web_contents_; } |
| 865 | void SetFocusedWebContents(WebContentsImpl* web_contents); |
| 866 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 867 | private: |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 868 | // The outer WebContents. |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 869 | WebContentsImpl* outer_web_contents_; |
| 870 | // The ID of the FrameTreeNode in outer WebContents that is hosting us. |
| 871 | int outer_contents_frame_tree_node_id_; |
| 872 | // List of inner WebContents that we host. |
| 873 | ChildrenSet inner_web_contents_tree_nodes_; |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 874 | // Only the root node should have this set. This indicates the WebContents |
| 875 | // whose frame tree has the focused frame. The WebContents tree could be |
| 876 | // arbitrarily deep. |
| 877 | WebContentsImpl* focused_web_contents_; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 878 | }; |
| 879 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 880 | // See WebContents::Create for a description of these parameters. |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 881 | WebContentsImpl(BrowserContext* browser_context); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 882 | |
[email protected] | e2225bf | 2013-11-15 16:09:38 | [diff] [blame] | 883 | // Add and remove observers for page navigation notifications. The order in |
| 884 | // which notifications are sent to observers is undefined. Clients must be |
| 885 | // sure to remove the observer before they go away. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 886 | void AddObserver(WebContentsObserver* observer); |
| 887 | void RemoveObserver(WebContentsObserver* observer); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 888 | |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 889 | // Clears a pending contents that has been closed before being shown. |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 890 | void OnWebContentsDestroyed(WebContentsImpl* web_contents); |
| 891 | |
| 892 | // Creates and adds to the map a destruction observer watching |web_contents|. |
| 893 | // No-op if such an observer already exists. |
| 894 | void AddDestructionObserver(WebContentsImpl* web_contents); |
| 895 | |
| 896 | // Deletes and removes from the map a destruction observer |
| 897 | // watching |web_contents|. No-op if there is no such observer. |
| 898 | void RemoveDestructionObserver(WebContentsImpl* web_contents); |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 899 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 900 | // Traverses all the RenderFrameHosts in the FrameTree and creates a set |
[email protected] | 948481d | 2014-06-11 18:32:22 | [diff] [blame] | 901 | // all the unique RenderWidgetHostViews. |
| 902 | std::set<RenderWidgetHostView*> GetRenderWidgetHostViewsInTree(); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 903 | |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 904 | // Called with the result of a DownloadImage() request. |
| 905 | void OnDidDownloadImage(const ImageDownloadCallback& callback, |
| 906 | int id, |
| 907 | const GURL& image_url, |
leon.han | cbc4bc3c | 2016-02-26 07:08:52 | [diff] [blame] | 908 | int32_t http_status_code, |
leon.han | c222853 | 2016-08-16 05:59:18 | [diff] [blame] | 909 | const std::vector<SkBitmap>& images, |
| 910 | const std::vector<gfx::Size>& original_image_sizes); |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 911 | |
[email protected] | 6fba26d | 2014-04-29 09:38:28 | [diff] [blame] | 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 |
| 914 | // possible for the RenderFrameHost to be deleted by the time this is called. |
| 915 | void OnDialogClosed(int render_process_id, |
| 916 | int render_frame_id, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 917 | IPC::Message* reply_msg, |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 918 | bool dialog_was_suppressed, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 919 | bool success, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 920 | const base::string16& user_input); |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 921 | |
[email protected] | f114fa4 | 2013-12-06 17:06:44 | [diff] [blame] | 922 | bool OnMessageReceived(RenderViewHost* render_view_host, |
| 923 | RenderFrameHost* render_frame_host, |
| 924 | const IPC::Message& message); |
| 925 | |
nasko | 907fcb6 | 2015-01-28 04:24:11 | [diff] [blame] | 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 | |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 930 | // IPC message handlers. |
[email protected] | 37b64c5 | 2014-07-11 21:14:05 | [diff] [blame] | 931 | void OnThemeColorChanged(SkColor theme_color); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 932 | void OnDidLoadResourceFromMemoryCache(const GURL& url, |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 933 | const std::string& http_request, |
[email protected] | 6d6cfb3a | 2012-05-23 22:53:18 | [diff] [blame] | 934 | const std::string& mime_type, |
[email protected] | 6c1e0521 | 2014-07-31 00:59:40 | [diff] [blame] | 935 | ResourceType resource_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 936 | void OnDidDisplayInsecureContent(); |
estark | 910b457 | 2015-12-09 20:55:41 | [diff] [blame] | 937 | void OnDidRunInsecureContent(const GURL& security_origin, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 938 | const GURL& target_url); |
jam | a385e11 | 2016-07-22 00:07:58 | [diff] [blame] | 939 | void OnDidDisplayContentWithCertificateErrors(const GURL& url); |
| 940 | void OnDidRunContentWithCertificateErrors(const GURL& url); |
[email protected] | 501052ff | 2014-02-21 22:19:07 | [diff] [blame] | 941 | void OnDocumentLoadedInFrame(); |
[email protected] | 61ac9e24 | 2014-03-21 20:55:26 | [diff] [blame] | 942 | void OnDidFinishLoad(const GURL& url); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 943 | void OnGoToEntryAtOffset(int offset); |
[email protected] | 21681395 | 2011-05-19 22:21:26 | [diff] [blame] | 944 | void OnUpdateZoomLimits(int minimum_percent, |
[email protected] | fce82322 | 2014-05-30 16:24:30 | [diff] [blame] | 945 | int maximum_percent); |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 946 | void OnPageScaleFactorChanged(float page_scale_factor); |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 947 | void OnEnumerateDirectory(int request_id, const base::FilePath& path); |
[email protected] | b7a756d4 | 2012-01-23 18:08:17 | [diff] [blame] | 948 | |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 949 | void OnRegisterProtocolHandler(const std::string& protocol, |
| 950 | const GURL& url, |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 951 | const base::string16& title, |
[email protected] | 3a3b75a | 2012-06-01 08:38:36 | [diff] [blame] | 952 | bool user_gesture); |
[email protected] | f5273e5 | 2014-07-14 16:30:20 | [diff] [blame] | 953 | void OnUnregisterProtocolHandler(const std::string& protocol, |
| 954 | const GURL& url, |
| 955 | bool user_gesture); |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 956 | void OnFindReply(int request_id, |
| 957 | int number_of_matches, |
| 958 | const gfx::Rect& selection_rect, |
| 959 | int active_match_ordinal, |
[email protected] | b888919c | 2011-09-02 00:32:16 | [diff] [blame] | 960 | bool final_update); |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 961 | #if defined(OS_ANDROID) |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 962 | void OnFindMatchRectsReply(int version, |
| 963 | const std::vector<gfx::RectF>& rects, |
| 964 | const gfx::RectF& active_rect); |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 965 | void OnGetNearestFindResultReply(int request_id, float distance); |
[email protected] | 1ff42797 | 2013-02-07 21:14:07 | [diff] [blame] | 966 | void OnOpenDateTimeDialog( |
| 967 | const ViewHostMsg_DateTimeDialogValue_Params& value); |
[email protected] | 59363fc9 | 2012-09-05 03:46:31 | [diff] [blame] | 968 | #endif |
avi | 60bd490 | 2015-09-23 20:39:24 | [diff] [blame] | 969 | void OnDomOperationResponse(const std::string& json_string); |
[email protected] | 7fc4bbb | 2011-09-08 21:23:10 | [diff] [blame] | 970 | void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
[email protected] | 8bc5ff0 | 2013-11-29 06:34:03 | [diff] [blame] | 971 | void OnOpenColorChooser(int color_chooser_id, |
| 972 | SkColor color, |
| 973 | const std::vector<ColorSuggestion>& suggestions); |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 974 | void OnEndColorChooser(int color_chooser_id); |
[email protected] | 55578b0a | 2012-04-18 14:31:32 | [diff] [blame] | 975 | void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 976 | void OnWebUISend(const GURL& source_url, |
| 977 | const std::string& name, |
| 978 | const base::ListValue& args); |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 979 | void OnUpdatePageImportanceSignals(const PageImportanceSignals& signals); |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 980 | #if BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 981 | void OnPepperInstanceCreated(int32_t pp_instance); |
| 982 | void OnPepperInstanceDeleted(int32_t pp_instance); |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 983 | void OnPepperPluginHung(int plugin_child_id, |
| 984 | const base::FilePath& path, |
| 985 | bool is_hung); |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 986 | void OnPepperStartsPlayback(int32_t pp_instance); |
| 987 | void OnPepperStopsPlayback(int32_t pp_instance); |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 988 | void OnPluginCrashed(const base::FilePath& plugin_path, |
| 989 | base::ProcessId plugin_pid); |
[email protected] | ea0309c | 2013-08-06 19:35:44 | [diff] [blame] | 990 | void OnRequestPpapiBrokerPermission(int routing_id, |
[email protected] | d8415ad9 | 2012-08-23 14:40:50 | [diff] [blame] | 991 | const GURL& url, |
[email protected] | 2dec8ec | 2013-02-07 19:20:34 | [diff] [blame] | 992 | const base::FilePath& plugin_path); |
tommycli | e6633ca7 | 2014-10-31 00:40:42 | [diff] [blame] | 993 | |
| 994 | // Callback function when requesting permission to access the PPAPI broker. |
| 995 | // |result| is true if permission was granted. |
| 996 | void OnPpapiBrokerPermissionResult(int routing_id, bool result); |
| 997 | |
fsamuel | 833ee7c | 2015-02-13 23:40:40 | [diff] [blame] | 998 | void OnBrowserPluginMessage(RenderFrameHost* render_frame_host, |
| 999 | const IPC::Message& message); |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1000 | #endif // BUILDFLAG(ENABLE_PLUGINS) |
[email protected] | 5027949 | 2014-05-05 23:24:29 | [diff] [blame] | 1001 | void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates); |
| 1002 | void OnFirstVisuallyNonEmptyPaint(); |
[email protected] | edc3af8 | 2013-12-12 21:24:07 | [diff] [blame] | 1003 | void OnShowValidationMessage(const gfx::Rect& anchor_in_root_view, |
[email protected] | 6ff9c8f | 2013-12-20 09:05:29 | [diff] [blame] | 1004 | const base::string16& main_text, |
| 1005 | const base::string16& sub_text); |
[email protected] | edc3af8 | 2013-12-12 21:24:07 | [diff] [blame] | 1006 | void OnHideValidationMessage(); |
| 1007 | void OnMoveValidationMessage(const gfx::Rect& anchor_in_root_view); |
| 1008 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1009 | // 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 |
| 1011 | // up at the next animation step if the throbber is going. |
| 1012 | void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 1013 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1014 | // Inner WebContents Helpers ------------------------------------------------- |
| 1015 | // |
| 1016 | // These functions are helpers in managing a hierarchy of WebContents |
| 1017 | // involved in rendering inner WebContents. |
| 1018 | |
| 1019 | // When multiple WebContents are present within a tab or window, a single one |
| 1020 | // is focused and will route keyboard events in most cases to a RenderWidget |
| 1021 | // contained within it. |GetFocusedWebContents()|'s main frame widget will |
| 1022 | // receive page focus and blur events when the containing window changes focus |
| 1023 | // state. |
| 1024 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1025 | // Returns the focused WebContents. |
| 1026 | // If there are multiple inner/outer WebContents (when embedding <webview>, |
| 1027 | // <guestview>, ...) returns the single one containing the currently focused |
| 1028 | // frame. Otherwise, returns this WebContents. |
| 1029 | WebContentsImpl* GetFocusedWebContents(); |
| 1030 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1031 | // Returns true if |this| is the focused WebContents or an ancestor of the |
| 1032 | // focused WebContents. |
| 1033 | bool ContainsOrIsFocusedWebContents(); |
| 1034 | |
| 1035 | // When inner or outer WebContents are present, become the focused |
| 1036 | // WebContentsImpl. This will activate this content's main frame RenderWidget |
| 1037 | // and indirectly all its subframe widgets. GetFocusedRenderWidgetHost will |
| 1038 | // search this WebContentsImpl for a focused RenderWidgetHost. The previously |
| 1039 | // focused WebContentsImpl, if any, will have its RenderWidgetHosts |
| 1040 | // deactivated. |
| 1041 | void SetAsFocusedWebContentsIfNecessary(); |
| 1042 | |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1043 | // Returns the root of the WebContents tree. |
| 1044 | WebContentsImpl* GetOutermostWebContents(); |
| 1045 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1046 | // Navigation helpers -------------------------------------------------------- |
| 1047 | // |
| 1048 | // These functions are helpers for Navigate() and DidNavigate(). |
| 1049 | |
| 1050 | // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 1051 | // committed to the navigation controller. Note that the navigation entry is |
| 1052 | // not provided since it may be invalid/changed after being committed. The |
| 1053 | // current navigation entry is in the NavigationController at this point. |
[email protected] | 2f7b3c5a | 2013-06-21 04:59:25 | [diff] [blame] | 1054 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1055 | // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 1056 | void CreateNewWidget(int32_t render_process_id, |
| 1057 | int32_t route_id, |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1058 | bool is_fullscreen, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 1059 | blink::WebPopupType popup_type); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1060 | |
| 1061 | // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1062 | void ShowCreatedWidget(int process_id, |
| 1063 | int route_id, |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1064 | bool is_fullscreen, |
bokan | 107a47f | 2015-02-03 23:23:39 | [diff] [blame] | 1065 | const gfx::Rect& initial_rect); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1066 | |
| 1067 | // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| 1068 | // called once as this call also removes it from the internal map. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1069 | RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1070 | |
| 1071 | // Finds the new WebContentsImpl by route_id, initializes it for |
| 1072 | // renderer-initiated creation, and returns it. Note that this can only be |
| 1073 | // called once as this call also removes it from the internal map. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1074 | WebContentsImpl* GetCreatedWindow(int process_id, int route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1075 | |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 1076 | // Sends a Page message IPC. |
| 1077 | void SendPageMessage(IPC::Message* msg); |
| 1078 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1079 | // Tracking loading progress ------------------------------------------------- |
| 1080 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 1081 | // Resets the tracking state of the current load progress. |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1082 | void ResetLoadProgressState(); |
| 1083 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 1084 | // Notifies the delegate that the load progress was updated. |
| 1085 | void SendChangeLoadProgress(); |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1086 | |
clamy | 44e84ce | 2016-02-22 15:38:25 | [diff] [blame] | 1087 | // Notifies the delegate of a change in loading state. |
| 1088 | // |details| is used to provide details on the load that just finished |
| 1089 | // (but can be null if not applicable). |
| 1090 | // |due_to_interstitial| is true if the change in load state occurred because |
| 1091 | // an interstitial page started showing/proceeded. |
| 1092 | void LoadingStateChanged(bool to_different_document, |
| 1093 | bool due_to_interstitial, |
| 1094 | LoadNotificationDetails* details); |
| 1095 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1096 | // Misc non-view stuff ------------------------------------------------------- |
| 1097 | |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 1098 | // Sets the history for a specified RenderViewHost to |history_length| |
| 1099 | // entries, with an offset of |history_offset|. |
| 1100 | void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host, |
| 1101 | int history_offset, |
| 1102 | int history_length); |
| 1103 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1104 | // Helper functions for sending notifications. |
[email protected] | 02d7b6e | 2014-06-24 21:01:50 | [diff] [blame] | 1105 | void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host); |
| 1106 | void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1107 | void NotifyDisconnected(); |
| 1108 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 1109 | void SetEncoding(const std::string& encoding); |
| 1110 | |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1111 | // TODO(creis): This should take in a FrameTreeNode to know which node's |
| 1112 | // render manager to return. For now, we just return the root's. |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 1113 | RenderFrameHostManager* GetRenderManager() const; |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1114 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1115 | // Removes browser plugin embedder if there is one. |
| 1116 | void RemoveBrowserPluginEmbedder(); |
| 1117 | |
[email protected] | dc0fd43 | 2013-08-27 15:29:21 | [diff] [blame] | 1118 | // Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView(). |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 1119 | gfx::Size GetSizeForNewRenderView(); |
[email protected] | dc0fd43 | 2013-08-27 15:29:21 | [diff] [blame] | 1120 | |
[email protected] | ae7eeda | 2014-07-04 01:53:26 | [diff] [blame] | 1121 | void OnFrameRemoved(RenderFrameHost* render_frame_host); |
[email protected] | 9b159a5 | 2013-10-03 17:24:55 | [diff] [blame] | 1122 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 1123 | // Helper method that's called whenever |preferred_size_| or |
| 1124 | // |preferred_size_for_capture_| changes, to propagate the new value to the |
| 1125 | // |delegate_|. |
| 1126 | void OnPreferredSizeChanged(const gfx::Size& old_size); |
| 1127 | |
dbeam | a1b926a | 2015-08-31 23:17:51 | [diff] [blame] | 1128 | // Internal helper to create WebUI objects associated with |this|. |url| is |
| 1129 | // used to determine which WebUI should be created (if any). |frame_name| |
| 1130 | // corresponds to the name of a frame that the WebUI should be created for (or |
| 1131 | // the main frame if empty). |
avi | e865b1d | 2016-10-24 19:42:59 | [diff] [blame] | 1132 | std::unique_ptr<WebUIImpl> CreateWebUI(const GURL& url, |
| 1133 | const std::string& frame_name); |
dbeam | a1b926a | 2015-08-31 23:17:51 | [diff] [blame] | 1134 | |
avi | d53461d | 2016-02-25 17:15:04 | [diff] [blame] | 1135 | void SetJavaScriptDialogManagerForTesting( |
| 1136 | JavaScriptDialogManager* dialog_manager); |
| 1137 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1138 | // Returns the FindRequestManager, or creates one if it doesn't already exist. |
| 1139 | FindRequestManager* GetOrCreateFindRequestManager(); |
| 1140 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 1141 | // Removes a registered WebContentsBindingSet by interface name. |
| 1142 | void RemoveBindingSet(const std::string& interface_name); |
| 1143 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1144 | // Data for core operation --------------------------------------------------- |
| 1145 | |
| 1146 | // Delegate for notifying our owner about stuff. Not owned by us. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1147 | WebContentsDelegate* delegate_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1148 | |
| 1149 | // Handles the back/forward list and loading. |
[email protected] | d202a7c | 2012-01-04 07:53:47 | [diff] [blame] | 1150 | NavigationControllerImpl controller_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1151 | |
| 1152 | // The corresponding view. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1153 | std::unique_ptr<WebContentsView> view_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1154 | |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 1155 | // The view of the RVHD. Usually this is our WebContentsView implementation, |
| 1156 | // but if an embedder uses a different WebContentsView, they'll need to |
| 1157 | // provide this. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1158 | RenderViewHostDelegateView* render_view_host_delegate_view_; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 1159 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1160 | // Tracks created WebContentsImpl objects that have not been shown yet. They |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1161 | // are identified by the process ID and routing ID passed to CreateNewWindow. |
| 1162 | typedef std::pair<int, int> ProcessRoutingIdPair; |
| 1163 | std::map<ProcessRoutingIdPair, WebContentsImpl*> pending_contents_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1164 | |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1165 | // This map holds widgets that were created on behalf of the renderer but |
| 1166 | // haven't been shown yet. |
| 1167 | std::map<ProcessRoutingIdPair, RenderWidgetHostView*> pending_widget_views_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1168 | |
avi | a8cf8198 | 2016-08-12 20:28:46 | [diff] [blame] | 1169 | std::map<WebContentsImpl*, std::unique_ptr<DestructionObserver>> |
| 1170 | destruction_observers_; |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1171 | |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1172 | // A list of observers notified when page state changes. Weak references. |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1173 | // This MUST be listed above frame_tree_ since at destruction time the |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1174 | // latter might cause RenderViewHost's destructor to call us and we might use |
| 1175 | // the observer list then. |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 1176 | base::ObserverList<WebContentsObserver> observers_; |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 1177 | |
rockot | f62002a | 2016-09-15 00:08:59 | [diff] [blame] | 1178 | // Associated interface binding sets attached to this WebContents. |
| 1179 | std::map<std::string, WebContentsBindingSet*> binding_sets_; |
| 1180 | |
[email protected] | c7c0d82 | 2014-04-16 20:19:49 | [diff] [blame] | 1181 | // True if this tab was opened by another tab. This is not unset if the opener |
| 1182 | // is closed. |
| 1183 | bool created_with_opener_; |
| 1184 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1185 | // Helper classes ------------------------------------------------------------ |
| 1186 | |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 1187 | // Manages the frame tree of the page and process swaps in each node. |
[email protected] | 9b159a5 | 2013-10-03 17:24:55 | [diff] [blame] | 1188 | FrameTree frame_tree_; |
| 1189 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1190 | // If this WebContents is part of a "tree of WebContents", then this contains |
| 1191 | // information about the structure. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1192 | std::unique_ptr<WebContentsTreeNode> node_; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1193 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 1194 | // SavePackage, lazily created. |
| 1195 | scoped_refptr<SavePackage> save_package_; |
| 1196 | |
paulmeyer | c8cb7cb | 2016-06-07 01:14:19 | [diff] [blame] | 1197 | // Manages/coordinates multi-process find-in-page requests. Created lazily. |
dcheng | 18ec0b54 | 2016-04-26 19:28:53 | [diff] [blame] | 1198 | std::unique_ptr<FindRequestManager> find_request_manager_; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1199 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1200 | // Data for loading state ---------------------------------------------------- |
| 1201 | |
[email protected] | 6dfed69 | 2014-05-22 04:18:03 | [diff] [blame] | 1202 | // Indicates whether the current load is to a different document. Only valid |
| 1203 | // if is_loading_ is true. |
| 1204 | bool is_load_to_different_document_; |
| 1205 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1206 | // Indicates if the tab is considered crashed. |
| 1207 | base::TerminationStatus crashed_status_; |
| 1208 | int crashed_error_code_; |
| 1209 | |
[email protected] | ca13a44 | 2012-04-17 14:00:12 | [diff] [blame] | 1210 | // Whether this WebContents is waiting for a first-response for the |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 1211 | // main resource of the page. This controls whether the throbber state is |
| 1212 | // "waiting" or "loading." |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1213 | bool waiting_for_response_; |
| 1214 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1215 | // The current load state and the URL associated with it. |
[email protected] | 9c235f04 | 2011-08-10 22:28:21 | [diff] [blame] | 1216 | net::LoadStateWithParam load_state_; |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1217 | base::string16 load_state_host_; |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1218 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 1219 | base::TimeTicks loading_last_progress_update_; |
| 1220 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1221 | // Upload progress, for displaying in the status bar. |
| 1222 | // Set to zero when there is no significant upload happening. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 1223 | uint64_t upload_size_; |
| 1224 | uint64_t upload_position_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1225 | |
dfalcantara | e6b7b4675 | 2015-07-10 18:14:16 | [diff] [blame] | 1226 | // Tracks that this WebContents needs to unblock requests to the renderer. |
| 1227 | // See ResumeLoadingCreatedWebContents. |
| 1228 | bool is_resume_pending_; |
| 1229 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1230 | // Data for current page ----------------------------------------------------- |
| 1231 | |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 1232 | // When a title cannot be taken from any entry, this title will be used. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 1233 | base::string16 page_title_when_no_navigation_entry_; |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 1234 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1235 | // When a navigation occurs, we record its contents MIME type. It can be |
| 1236 | // used to check whether we can do something for some special contents. |
| 1237 | std::string contents_mime_type_; |
| 1238 | |
[email protected] | ef3adfc | 2014-05-11 00:04:54 | [diff] [blame] | 1239 | // The last reported character encoding, not canonicalized. |
| 1240 | std::string last_reported_encoding_; |
| 1241 | |
| 1242 | // The canonicalized character encoding. |
| 1243 | std::string canonical_encoding_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1244 | |
[email protected] | b4c8401 | 2014-04-28 19:51:10 | [diff] [blame] | 1245 | // Whether the initial empty page has been accessed by another page, making it |
| 1246 | // unsafe to show the pending URL. Usually false unless another window tries |
| 1247 | // to modify the blank page. Always false after the first commit. |
| 1248 | bool has_accessed_initial_document_; |
| 1249 | |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 1250 | // The theme color for the underlying document as specified |
| 1251 | // by theme-color meta tag. |
| 1252 | SkColor theme_color_; |
| 1253 | |
| 1254 | // The last published theme color. |
| 1255 | SkColor last_sent_theme_color_; |
| 1256 | |
peter | 90afaba | 2015-06-01 12:05:29 | [diff] [blame] | 1257 | // Whether the first visually non-empty paint has occurred. |
| 1258 | bool did_first_visually_non_empty_paint_; |
| 1259 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1260 | // Data for misc internal state ---------------------------------------------- |
| 1261 | |
[email protected] | 5459798 | 2013-02-06 01:59:55 | [diff] [blame] | 1262 | // When > 0, the WebContents is currently being captured (e.g., for |
| 1263 | // screenshots or mirroring); and the underlying RenderWidgetHost should not |
| 1264 | // be told it is hidden. |
| 1265 | int capturer_count_; |
| 1266 | |
| 1267 | // Tracks whether RWHV should be visible once capturer_count_ becomes zero. |
| 1268 | bool should_normally_be_visible_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1269 | |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 1270 | // Tracks whether this WebContents was ever set to be visible. Used to |
| 1271 | // facilitate WebContents being loaded in the background by setting |
| 1272 | // |should_normally_be_visible_|. Ensures WasShown() will trigger when first |
| 1273 | // becoming visible to the user, and prevents premature unloading. |
| 1274 | bool did_first_set_visible_; |
| 1275 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1276 | // See getter above. |
| 1277 | bool is_being_destroyed_; |
| 1278 | |
| 1279 | // Indicates whether we should notify about disconnection of this |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1280 | // WebContentsImpl. This is used to ensure disconnection notifications only |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1281 | // happen if a connection notification has happened and that they happen only |
| 1282 | // once. |
| 1283 | bool notify_disconnection_; |
| 1284 | |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 1285 | // Pointer to the JavaScript dialog manager, lazily assigned. Used because the |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1286 | // delegate of this WebContentsImpl is nulled before its destructor is called. |
[email protected] | 71a88bb | 2013-02-01 22:05:15 | [diff] [blame] | 1287 | JavaScriptDialogManager* dialog_manager_; |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 1288 | |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 1289 | // Set to true when there is an active JavaScript dialog showing. |
| 1290 | bool is_showing_javascript_dialog_ = false; |
| 1291 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1292 | // Set to true when there is an active "before unload" dialog. When true, |
| 1293 | // we've forced the throbber to start in Navigate, and we need to remember to |
| 1294 | // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 1295 | bool is_showing_before_unload_dialog_; |
| 1296 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1297 | // Settings that get passed to the renderer process. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1298 | RendererPreferences renderer_preferences_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1299 | |
[email protected] | 9a89045 | 2014-02-13 22:21:02 | [diff] [blame] | 1300 | // The time that this WebContents was last made active. The initial value is |
| 1301 | // the WebContents creation time. |
gab | 0dccfef | 2015-05-20 18:43:39 | [diff] [blame] | 1302 | base::TimeTicks last_active_time_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1303 | |
hajimehoshi | c4f226a | 2016-10-21 09:01:57 | [diff] [blame] | 1304 | // The time that this WebContents was last made hidden. The initial value is |
| 1305 | // zero. |
| 1306 | base::TimeTicks last_hidden_time_; |
| 1307 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1308 | // See description above setter. |
| 1309 | bool closed_by_user_gesture_; |
| 1310 | |
| 1311 | // Minimum/maximum zoom percent. |
| 1312 | int minimum_zoom_percent_; |
| 1313 | int maximum_zoom_percent_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1314 | |
w.shackleton | 49bcd39 | 2016-01-06 17:38:22 | [diff] [blame] | 1315 | // Used to correctly handle integer zooming through a smooth scroll device. |
| 1316 | float zoom_scroll_remainder_; |
| 1317 | |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 1318 | // The intrinsic size of the page. |
| 1319 | gfx::Size preferred_size_; |
| 1320 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 1321 | // The preferred size for content screen capture. When |capturer_count_| > 0, |
| 1322 | // this overrides |preferred_size_|. |
| 1323 | gfx::Size preferred_size_for_capture_; |
| 1324 | |
mfomitchev | 2b8b066a | 2016-01-28 19:23:15 | [diff] [blame] | 1325 | #if defined(OS_ANDROID) |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 1326 | // Date time chooser opened by this tab. |
| 1327 | // Only used in Android since all other platforms use a multi field UI. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1328 | std::unique_ptr<DateTimeChooserAndroid> date_time_chooser_; |
[email protected] | 583418cc | 2013-01-17 14:01:10 | [diff] [blame] | 1329 | #endif |
| 1330 | |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 1331 | // Holds information about a current color chooser dialog, if one is visible. |
| 1332 | struct ColorChooserInfo { |
| 1333 | ColorChooserInfo(int render_process_id, |
| 1334 | int render_frame_id, |
| 1335 | ColorChooser* chooser, |
| 1336 | int identifier); |
| 1337 | ~ColorChooserInfo(); |
[email protected] | cb80545 | 2013-05-22 15:16:21 | [diff] [blame] | 1338 | |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 1339 | int render_process_id; |
| 1340 | int render_frame_id; |
| 1341 | |
| 1342 | // Color chooser that was opened by this tab. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1343 | std::unique_ptr<ColorChooser> chooser; |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 1344 | |
| 1345 | // A unique identifier for the current color chooser. Identifiers are |
| 1346 | // unique across a renderer process. This avoids race conditions in |
| 1347 | // synchronizing the browser and renderer processes. For example, if a |
| 1348 | // renderer closes one chooser and opens another, and simultaneously the |
| 1349 | // user picks a color in the first chooser, the IDs can be used to drop the |
| 1350 | // "chose a color" message rather than erroneously tell the renderer that |
| 1351 | // the user picked a color in the second chooser. |
| 1352 | int identifier; |
| 1353 | }; |
| 1354 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1355 | std::unique_ptr<ColorChooserInfo> color_chooser_info_; |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 1356 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1357 | // Manages the embedder state for browser plugins, if this WebContents is an |
| 1358 | // embedder; NULL otherwise. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1359 | std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_; |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1360 | // Manages the guest state for browser plugin, if this WebContents is a guest; |
| 1361 | // NULL otherwise. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1362 | std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_; |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 1363 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1364 | #if BUILDFLAG(ENABLE_PLUGINS) |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 1365 | // Manages the whitelist of plugin content origins exempt from power saving. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1366 | std::unique_ptr<PluginContentOriginWhitelist> |
| 1367 | plugin_content_origin_whitelist_; |
tommycli | eb25b2a | 2014-11-03 19:45:09 | [diff] [blame] | 1368 | #endif |
| 1369 | |
[email protected] | f53a9f87 | 2012-05-24 02:07:06 | [diff] [blame] | 1370 | // This must be at the end, or else we might get notifications and use other |
| 1371 | // member variables that are gone. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1372 | NotificationRegistrar registrar_; |
[email protected] | f53a9f87 | 2012-05-24 02:07:06 | [diff] [blame] | 1373 | |
[email protected] | 1d62cf7 | 2014-02-07 21:31:57 | [diff] [blame] | 1374 | // Used during IPC message dispatching from the RenderView/RenderFrame so that |
| 1375 | // the handlers can get a pointer to the RVH through which the message was |
[email protected] | f114fa4 | 2013-12-06 17:06:44 | [diff] [blame] | 1376 | // received. |
| 1377 | RenderViewHost* render_view_message_source_; |
[email protected] | 1d62cf7 | 2014-02-07 21:31:57 | [diff] [blame] | 1378 | RenderFrameHost* render_frame_message_source_; |
[email protected] | 7bb76189 | 2012-07-20 09:32:47 | [diff] [blame] | 1379 | |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 1380 | // All live RenderWidgetHostImpls that are created by this object and may |
| 1381 | // outlive it. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1382 | std::set<RenderWidgetHostImpl*> created_widgets_; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 1383 | |
alexmos | c9e76ec | 2016-05-16 22:59:37 | [diff] [blame] | 1384 | // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is |
| 1385 | // no fullscreen widget. |
| 1386 | int fullscreen_widget_process_id_; |
| 1387 | |
[email protected] | 44470a2 | 2013-01-24 01:21:54 | [diff] [blame] | 1388 | // Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise. |
| 1389 | int fullscreen_widget_routing_id_; |
| 1390 | |
[email protected] | 0b43199 | 2014-06-24 00:08:03 | [diff] [blame] | 1391 | // At the time the fullscreen widget was being shut down, did it have focus? |
| 1392 | // This is used to restore focus to the WebContentsView after both: 1) the |
| 1393 | // fullscreen widget is destroyed, and 2) the WebContentsDelegate has |
| 1394 | // completed making layout changes to effect an exit from fullscreen mode. |
| 1395 | bool fullscreen_widget_had_focus_at_shutdown_; |
| 1396 | |
[email protected] | 0e584b5f | 2013-12-30 17:28:23 | [diff] [blame] | 1397 | // Whether this WebContents is responsible for displaying a subframe in a |
[email protected] | 5dcaf8e | 2013-12-28 01:31:42 | [diff] [blame] | 1398 | // different process from its parent page. |
| 1399 | bool is_subframe_; |
| 1400 | |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 1401 | // When a new tab is created asynchronously, stores the OpenURLParams needed |
| 1402 | // to continue loading the page once the tab is ready. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1403 | std::unique_ptr<OpenURLParams> delayed_open_url_params_; |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 1404 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 1405 | // Whether overscroll should be unconditionally disabled. |
| 1406 | bool force_disable_overscroll_content_; |
[email protected] | e85165c64 | 2014-06-10 14:34:31 | [diff] [blame] | 1407 | |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 1408 | // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
| 1409 | bool last_dialog_suppressed_; |
| 1410 | |
mcasas | 4e216e7 | 2016-07-28 21:28:38 | [diff] [blame] | 1411 | std::unique_ptr<device::GeolocationServiceContext> |
| 1412 | geolocation_service_context_; |
blundell | c57b93f | 2014-10-29 13:19:57 | [diff] [blame] | 1413 | |
blundell | d46e883 | 2016-10-07 10:34:27 | [diff] [blame] | 1414 | std::unique_ptr<device::WakeLockServiceContext> wake_lock_service_context_; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 1415 | |
lunalu | d4a2cc8 | 2016-11-22 00:27:23 | [diff] [blame] | 1416 | std::unique_ptr<ScreenOrientation> screen_orientation_; |
[email protected] | 01f83f9 | 2014-06-17 14:41:54 | [diff] [blame] | 1417 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1418 | std::unique_ptr<ManifestManagerHost> manifest_manager_host_; |
mlamouri | efdca9d | 2014-09-16 16:55:40 | [diff] [blame] | 1419 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 1420 | // The accessibility mode for all frames. This is queried when each frame |
| 1421 | // is created, and broadcast to all frames when it changes. |
| 1422 | AccessibilityMode accessibility_mode_; |
| 1423 | |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 1424 | // Monitors power levels for audio streams associated with this WebContents. |
| 1425 | AudioStreamMonitor audio_stream_monitor_; |
| 1426 | |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 1427 | // Created on-demand to mute all audio output from this WebContents. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1428 | std::unique_ptr<WebContentsAudioMuter> audio_muter_; |
miu | 50f9789 | 2014-09-22 22:49:52 | [diff] [blame] | 1429 | |
ortuno | df4d798 | 2016-04-08 02:33:35 | [diff] [blame] | 1430 | size_t bluetooth_connected_device_count_; |
ortuno | 32e7db3c | 2016-03-29 16:14:20 | [diff] [blame] | 1431 | |
luken | dc35e7f | 2014-11-10 19:06:14 | [diff] [blame] | 1432 | bool virtual_keyboard_requested_; |
| 1433 | |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 1434 | // Notifies ResourceDispatcherHostImpl of various events related to loading. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1435 | std::unique_ptr<LoaderIOThreadNotifier> loader_io_thread_notifier_; |
csharrison | a2280cd | 2016-02-03 23:21:15 | [diff] [blame] | 1436 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 1437 | // Manages media players, CDMs, and power save blockers for media. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1438 | std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 1439 | |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1440 | #if BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 1441 | // Observes pepper playback changes, and notifies MediaSession. |
| 1442 | std::unique_ptr<PepperPlaybackObserver> pepper_playback_observer_; |
brettw | 4b46108 | 2016-11-19 18:55:16 | [diff] [blame] | 1443 | #endif // BUILDFLAG(ENABLE_PLUGINS) |
zqzhang | 181047e6 | 2016-07-01 13:37:17 | [diff] [blame] | 1444 | |
scottmg | 276753cf | 2016-10-27 18:25:22 | [diff] [blame] | 1445 | std::unique_ptr<HostZoomMapObserver> host_zoom_map_observer_; |
| 1446 | |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 1447 | std::unique_ptr<RenderWidgetHostInputEventRouter> rwh_input_event_router_; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 1448 | |
kouhei | 40f03cb | 2015-09-24 07:47:01 | [diff] [blame] | 1449 | PageImportanceSignals page_importance_signals_; |
| 1450 | |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 1451 | bool page_scale_factor_is_one_; |
| 1452 | |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 1453 | // TextInputManager tracks the IME-related state for all the |
| 1454 | // RenderWidgetHostViews on this WebContents. Only exists on the outermost |
| 1455 | // WebContents and is automatically destroyed when a WebContents becomes an |
| 1456 | // inner WebContents by attaching to an outer WebContents. Then the |
| 1457 | // IME-related state for RenderWidgetHosts on the inner WebContents is tracked |
| 1458 | // by the TextInputManager in the outer WebContents. |
| 1459 | std::unique_ptr<TextInputManager> text_input_manager_; |
| 1460 | |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 1461 | // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if |
| 1462 | // there's no RenderWidgetHost holding a lock. |
| 1463 | RenderWidgetHostImpl* mouse_lock_widget_; |
| 1464 | |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 1465 | #if defined(OS_ANDROID) |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 1466 | std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 1467 | #endif |
| 1468 | |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 1469 | // Whether this WebContents is for content overlay. |
| 1470 | bool is_overlay_content_; |
| 1471 | |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1472 | int currently_playing_video_count_ = 0; |
| 1473 | |
mohan.reddy | aae039a | 2014-11-21 17:39:50 | [diff] [blame] | 1474 | base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_; |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1475 | base::WeakPtrFactory<WebContentsImpl> weak_factory_; |
mohan.reddy | aae039a | 2014-11-21 17:39:50 | [diff] [blame] | 1476 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 1477 | DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1478 | }; |
| 1479 | |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 1480 | // Dangerous methods which should never be made part of the public API, so we |
| 1481 | // grant their use only to an explicit friend list (c++ attorney/client idiom). |
| 1482 | class CONTENT_EXPORT WebContentsImpl::FriendZone { |
| 1483 | private: |
| 1484 | friend class TestNavigationObserver; |
| 1485 | friend class WebContentsAddedObserver; |
| 1486 | friend class ContentBrowserSanityChecker; |
| 1487 | |
| 1488 | FriendZone(); // Not instantiable. |
| 1489 | |
| 1490 | // Adds/removes a callback called on creation of each new WebContents. |
| 1491 | static void AddCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1492 | static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); |
| 1493 | |
| 1494 | DISALLOW_COPY_AND_ASSIGN(FriendZone); |
| 1495 | }; |
| 1496 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1497 | } // namespace content |
| 1498 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 1499 | #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |