#include <string>
#include "base/compiler_specific.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "content/browser/frame_host/render_frame_host_manager.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
+#include "content/common/accessibility_mode_enums.h"
#include "content/common/content_export.h"
#include "content/public/browser/color_chooser.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/renderer_preferences.h"
+#include "content/public/common/resource_type.h"
#include "content/public/common/three_d_api_types.h"
#include "net/base/load_states.h"
+#include "net/http/http_response_headers.h"
#include "third_party/WebKit/public/web/WebDragOperation.h"
#include "ui/gfx/rect_f.h"
#include "ui/gfx/size.h"
-#include "webkit/common/resource_type.h"
struct BrowserPluginHostMsg_ResizeGuest_Params;
struct ViewHostMsg_DateTimeDialogValue_Params;
struct ResourceRedirectDetails;
struct ResourceRequestDetails;
+#if defined(OS_ANDROID)
+class WebContentsAndroid;
+#endif
+
// Factory function for the implementations that content knows about. Takes
// ownership of |delegate|.
WebContentsView* CreateWebContentsView(
const WebContents::CreateParams& params,
WebContentsImpl* opener);
+ static std::vector<WebContentsImpl*> GetAllWebContents();
+
// Returns the opener WebContentsImpl, if any. This can be set to null if the
// opener is closed or the page clears its window.opener.
WebContentsImpl* opener() const { return opener_; }
return geolocation_dispatcher_host_.get();
}
+ ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host() {
+ return screen_orientation_dispatcher_host_.get();
+ }
+
bool should_normally_be_visible() { return should_normally_be_visible_; }
+ // Broadcasts the mode change to all frames.
+ void SetAccessibilityMode(AccessibilityMode mode);
+
+ // Adds the given accessibility mode to the current accessibility mode
+ // bitmap.
+ void AddAccessibilityMode(AccessibilityMode mode);
+
+ // Removes the given accessibility mode from the current accessibility
+ // mode bitmap, managing the bits that are shared with other modes such
+ // that a bit will only be turned off when all modes that depend on it
+ // have been removed.
+ void RemoveAccessibilityMode(AccessibilityMode mode);
+
// WebContents ------------------------------------------------------
virtual ScreenOrientationDispatcherHost* GetScreenOrientationDispatcherHost() OVERRIDE;
virtual WebContentsDelegate* GetDelegate() OVERRIDE;
virtual WebUI* GetCommittedWebUI() const OVERRIDE;
virtual void SetUserAgentOverride(const std::string& override) OVERRIDE;
virtual const std::string& GetUserAgentOverride() const OVERRIDE;
+ virtual void EnableTreeOnlyAccessibilityMode() OVERRIDE;
+ virtual bool IsTreeOnlyAccessibilityModeForTesting() const OVERRIDE;
+ virtual bool IsFullAccessibilityModeForTesting() const OVERRIDE;
#if defined(OS_WIN)
virtual void SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) OVERRIDE;
int error_code) OVERRIDE;
virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE;
virtual bool IsBeingDestroyed() const OVERRIDE;
- virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE;
+ virtual void NotifyNavigationStateChanged(
+ InvalidateTypes changed_flags) OVERRIDE;
virtual base::TimeTicks GetLastActiveTime() const OVERRIDE;
virtual void WasShown() OVERRIDE;
virtual void WasHidden() OVERRIDE;
virtual void UserGestureDone() OVERRIDE;
virtual void SetClosedByUserGesture(bool value) OVERRIDE;
virtual bool GetClosedByUserGesture() const OVERRIDE;
- virtual int GetZoomPercent(bool* enable_increment,
- bool* enable_decrement) const OVERRIDE;
virtual void ViewSource() OVERRIDE;
virtual void ViewFrameSource(const GURL& url,
const PageState& page_state) OVERRIDE;
#if defined(OS_ANDROID)
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents()
OVERRIDE;
+ virtual WebContentsAndroid* GetWebContentsAndroid();
#elif defined(OS_MACOSX)
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
virtual bool GetAllowOverlappingViews() OVERRIDE;
- virtual void SetOverlayView(WebContents* overlay,
- const gfx::Point& offset) OVERRIDE;
- virtual void RemoveOverlayView() OVERRIDE;
+ virtual void SetAllowOtherViews(bool allow) OVERRIDE;
+ virtual bool GetAllowOtherViews() OVERRIDE;
#endif
// Implementation of PageNavigator.
virtual void DidStartLoading(RenderFrameHost* render_frame_host,
bool to_different_document) OVERRIDE;
virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
+ virtual void DidDeferAfterResponseStarted(
+ const TransitionLayerData& transition_data) OVERRIDE;
+ virtual bool WillHandleDeferAfterResponseStarted() OVERRIDE;
virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
const ContextMenuParams& params) OVERRIDE;
const std::string& encoding) OVERRIDE;
virtual WebContents* GetAsWebContents() OVERRIDE;
virtual bool IsNeverVisible() OVERRIDE;
+ virtual AccessibilityMode GetAccessibilityMode() const OVERRIDE;
+ virtual void AccessibilityEventReceived(
+ const std::vector<AXEventNotificationDetails>& details) OVERRIDE;
+#if defined(OS_WIN)
+ virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE;
+#endif
// RenderViewHostDelegate ----------------------------------------------------
virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE;
const base::string16& source_id) OVERRIDE;
virtual RendererPreferences GetRendererPrefs(
BrowserContext* browser_context) const OVERRIDE;
- virtual WebPreferences GetWebkitPrefs() OVERRIDE;
+ virtual WebPreferences ComputeWebkitPrefs() OVERRIDE;
virtual void OnUserGesture() OVERRIDE;
virtual void OnIgnoredUIEvent() OVERRIDE;
virtual void RendererUnresponsive(RenderViewHost* render_view_host,
SiteInstance* instance) OVERRIDE;
virtual SessionStorageNamespaceMap GetSessionStorageNamespaceMap() OVERRIDE;
virtual FrameTree* GetFrameTree() OVERRIDE;
- virtual void AccessibilityEventReceived(
- const std::vector<AXEventNotificationDetails>& details) OVERRIDE;
// NavigatorDelegate ---------------------------------------------------------
virtual void DidStartProvisionalLoad(
RenderFrameHostImpl* render_frame_host,
- int parent_routing_id,
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc) OVERRIDE;
+ virtual void DidStartNavigationTransition(
+ RenderFrameHostImpl* render_frame_host) OVERRIDE;
virtual void DidFailProvisionalLoadWithError(
RenderFrameHostImpl* render_frame_host,
const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
const GURL& validated_target_url) OVERRIDE;
virtual void DidCommitProvisionalLoad(
RenderFrameHostImpl* render_frame_host,
- const base::string16& frame_unique_name,
- bool is_main_frame,
const GURL& url,
PageTransition transition_type) OVERRIDE;
virtual void DidNavigateMainFramePreCommit(
- const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
+ bool navigation_is_within_page) OVERRIDE;
virtual void DidNavigateMainFramePostCommit(
const LoadCommittedDetails& details,
const FrameHostMsg_DidCommitProvisionalLoad_Params& params) OVERRIDE;
const blink::WebGestureEvent& event) OVERRIDE;
virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE;
virtual void OnTouchEmulationEnabled(bool enabled) OVERRIDE;
-#if defined(OS_WIN)
- virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE;
-#endif
+ virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager()
+ OVERRIDE;
+ virtual BrowserAccessibilityManager*
+ GetOrCreateRootBrowserAccessibilityManager() OVERRIDE;
// RenderFrameHostManager::Delegate ------------------------------------------
RenderViewHost* render_view_host,
int opener_route_id,
int proxy_routing_id,
- bool for_main_frame) OVERRIDE;
+ bool for_main_frame_navigation) OVERRIDE;
+ virtual bool CreateRenderFrameForRenderManager(
+ RenderFrameHost* render_frame_host,
+ int parent_routing_id) OVERRIDE;
virtual void BeforeUnloadFiredFromRenderManager(
bool proceed, const base::TimeTicks& proceed_time,
bool* proceed_to_fire_unload) OVERRIDE;
RenderViewHost* render_view_host) OVERRIDE;
virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
virtual void CancelModalDialogsForRenderManager() OVERRIDE;
- virtual void NotifySwappedFromRenderManager(
- RenderViewHost* old_host, RenderViewHost* new_host) OVERRIDE;
+ virtual void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
+ RenderFrameHost* new_host,
+ bool is_main_frame) OVERRIDE;
virtual int CreateOpenerRenderViewsForRenderManager(
SiteInstance* instance) OVERRIDE;
virtual NavigationControllerImpl&
// currently focused frame.
void SelectRange(const gfx::Point& start, const gfx::Point& end);
+ // Notifies the main frame that it can continue navigation (if it was deferred
+ // immediately at first response).
+ void ResumeResponseDeferredAtStart();
+
private:
friend class TestNavigationObserver;
friend class WebContentsAddedObserver;
const std::string& security_info,
const std::string& http_request,
const std::string& mime_type,
- ResourceType::Type resource_type);
+ ResourceType resource_type);
void OnDidDisplayInsecureContent();
void OnDidRunInsecureContent(const std::string& security_origin,
const GURL& target_url);
const GURL& url,
const base::string16& title,
bool user_gesture);
+ void OnUnregisterProtocolHandler(const std::string& protocol,
+ const GURL& url,
+ bool user_gesture);
void OnFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
// Misc non-view stuff -------------------------------------------------------
// Helper functions for sending notifications.
- void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
+ void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
+ void NotifyFrameSwapped(RenderFrameHost* old_host, RenderFrameHost* new_host);
void NotifyDisconnected();
void SetEncoding(const std::string& encoding);
// Clear |render_frame_host|'s PowerSaveBlockers.
void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host);
- // Clear all PowerSaveBlockers, leave power_save_blocker_ empty.
+ // Clear all PowerSaveBlockers, leave |power_save_blocker_| empty.
void ClearAllPowerSaveBlockers();
// Helper function to invoke WebContentsDelegate::GetSizeForNewRenderView().
gfx::Size GetSizeForNewRenderView();
- void OnFrameRemoved(RenderViewHostImpl* render_view_host,
- int frame_routing_id);
+ void OnFrameRemoved(RenderFrameHost* render_frame_host);
// Helper method that's called whenever |preferred_size_| or
// |preferred_size_for_capture_| changes, to propagate the new value to the
// Helper classes ------------------------------------------------------------
+#if !defined(OS_CHROMEOS)
// Maps the RenderFrameHost to its media_player_cookie and PowerSaveBlocker
// pairs. Key is the RenderFrameHost, value is the map which maps
// player_cookie on to PowerSaveBlocker.
- typedef std::map<RenderFrameHost*, std::map<int64, PowerSaveBlocker*> >
+ //
+ // ChromeOS does its own detection of audio and video.
+ typedef base::ScopedPtrHashMap<int64, PowerSaveBlocker>
+ PowerSaveBlockerMapEntry;
+ typedef base::ScopedPtrHashMap<uintptr_t, PowerSaveBlockerMapEntry>
PowerSaveBlockerMap;
PowerSaveBlockerMap power_save_blockers_;
+#endif
// Manages the frame tree of the page and process swaps in each node.
FrameTree frame_tree_;
// Routing id of the shown fullscreen widget or MSG_ROUTING_NONE otherwise.
int fullscreen_widget_routing_id_;
+ // At the time the fullscreen widget was being shut down, did it have focus?
+ // This is used to restore focus to the WebContentsView after both: 1) the
+ // fullscreen widget is destroyed, and 2) the WebContentsDelegate has
+ // completed making layout changes to effect an exit from fullscreen mode.
+ bool fullscreen_widget_had_focus_at_shutdown_;
+
// Maps the ids of pending image downloads to their callbacks
typedef std::map<int, ImageDownloadCallback> ImageDownloadMap;
ImageDownloadMap image_download_map_;
scoped_ptr<ScreenOrientationDispatcherHost>
screen_orientation_dispatcher_host_;
+ // The accessibility mode for all frames. This is queried when each frame
+ // is created, and broadcast to all frames when it changes.
+ AccessibilityMode accessibility_mode_;
+
DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
};