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