summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_view_host.cc7
-rw-r--r--content/browser/renderer_host/render_view_host.h1
-rw-r--r--content/browser/renderer_host/render_view_host_delegate.h3
-rw-r--r--content/browser/tab_contents/tab_contents.cc5
-rw-r--r--content/browser/tab_contents/tab_contents.h1
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.cc4
-rw-r--r--content/browser/tab_contents/tab_contents_delegate.h4
-rw-r--r--content/common/view_messages.h8
-rw-r--r--content/renderer/render_view.cc15
-rw-r--r--content/renderer/render_view.h3
10 files changed, 50 insertions, 1 deletions
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index a65e97a..792151a 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -684,6 +684,8 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame,
OnMsgDocumentOnLoadCompletedInMainFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleFullscreen,
+ OnMsgToggleFullscreen)
IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange,
OnMsgDidContentsPreferredSizeChange)
@@ -983,6 +985,11 @@ void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
view->ShowContextMenu(validated_params);
}
+void RenderViewHost::OnMsgToggleFullscreen(bool enter_fullscreen) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ delegate_->ToggleFullscreenMode(enter_fullscreen);
+}
+
void RenderViewHost::OnMsgOpenURL(const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition) {
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index 17f47a6..f403243 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -428,6 +428,7 @@ class RenderViewHost : public RenderWidgetHost {
void OnMsgDocumentAvailableInMainFrame();
void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id);
void OnMsgContextMenu(const ContextMenuParams& params);
+ void OnMsgToggleFullscreen(bool enter_fullscreen);
void OnMsgOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition);
void OnMsgDidContentsPreferredSizeChange(const gfx::Size& new_size);
diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h
index 2dad081..cda683b3 100644
--- a/content/browser/renderer_host/render_view_host_delegate.h
+++ b/content/browser/renderer_host/render_view_host_delegate.h
@@ -372,6 +372,9 @@ class RenderViewHostDelegate : public IPC::Channel::Listener {
RenderViewHost* render_view_host,
const ViewHostMsg_RunFileChooser_Params& params) {}
+ // Notification that the page wants to go into or out of fullscreen mode.
+ virtual void ToggleFullscreenMode(bool enter_fullscreen) {}
+
protected:
virtual ~RenderViewHostDelegate() {}
};
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 6caebbe..e337fe8 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -498,6 +498,11 @@ void TabContents::HandleMouseActivate() {
delegate_->HandleMouseActivate();
}
+void TabContents::ToggleFullscreenMode(bool enter_fullscreen) {
+ if (delegate_)
+ delegate_->ToggleFullscreenModeForTab(this, enter_fullscreen);
+}
+
void TabContents::ShowContents() {
RenderWidgetHostView* rwhv = GetRenderWidgetHostView();
if (rwhv)
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 84f0134..8acf579 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -707,6 +707,7 @@ class TabContents : public PageNavigator,
virtual bool OnMessageReceived(const IPC::Message& message);
virtual void RunFileChooser(RenderViewHost* render_view_host,
const ViewHostMsg_RunFileChooser_Params& params);
+ virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
// RenderViewHostManager::Delegate -------------------------------------------
diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc
index ac03388..eb29c07 100644
--- a/content/browser/tab_contents/tab_contents_delegate.cc
+++ b/content/browser/tab_contents/tab_contents_delegate.cc
@@ -288,6 +288,10 @@ void TabContentsDelegate::EnumerateDirectory(TabContents* tab, int request_id,
const FilePath& path) {
}
+void TabContentsDelegate::ToggleFullscreenModeForTab(TabContents* tab,
+ bool enter_fullscreen) {
+}
+
TabContentsDelegate::~TabContentsDelegate() {
while (!attached_contents_.empty()) {
TabContents* tab_contents = *attached_contents_.begin();
diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h
index 1118cf7..bae80c6 100644
--- a/content/browser/tab_contents/tab_contents_delegate.h
+++ b/content/browser/tab_contents/tab_contents_delegate.h
@@ -310,6 +310,10 @@ class TabContentsDelegate {
virtual void EnumerateDirectory(TabContents* tab, int request_id,
const FilePath& path);
+ // Called when the renderer puts a tab into or out of fullscreen mode.
+ virtual void ToggleFullscreenModeForTab(TabContents* tab,
+ bool enter_fullscreen);
+
protected:
virtual ~TabContentsDelegate();
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 7c81a07..2a7a839 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -1244,6 +1244,9 @@ IPC_MESSAGE_ROUTED2(ViewMsg_SavePageAsMHTML,
int /* job_id */,
IPC::PlatformFileForTransit /* file handle */)
+// Exit fullscreen.
+IPC_MESSAGE_ROUTED0(ViewMsg_ExitFullscreen)
+
// Messages sent from the renderer to the browser.
// Sent by the renderer when it is creating a new window. The browser creates
@@ -2053,6 +2056,11 @@ IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateInspectorSetting,
std::string, /* key */
std::string /* value */)
+// Puts the browser into "tab fullscreen" mode for the sending renderer.
+// See the comment in chrome/browser/ui/browser.h for more details.
+IPC_MESSAGE_ROUTED1(ViewHostMsg_ToggleFullscreen,
+ bool /* enter_fullscreen */)
+
// Send back a string to be recorded by UserMetrics.
IPC_MESSAGE_CONTROL1(ViewHostMsg_UserMetricsRecordAction,
std::string /* action */)
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index f2d7412..f1eef24 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -388,7 +388,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
render_thread_->AddRoute(routing_id_, this);
// Take a reference on behalf of the RenderThread. This will be balanced
- // when we receive ViewMsg_Close.
+ // when we receive ViewMsg_ClosePage.
AddRef();
// If this is a popup, we must wait for the CreatingNew_ACK message before
@@ -631,6 +631,7 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevel, OnSetZoomLevel)
IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForLoadingURL,
OnSetZoomLevelForLoadingURL)
+ IPC_MESSAGE_HANDLER(ViewMsg_ExitFullscreen, OnExitFullscreen)
IPC_MESSAGE_HANDLER(ViewMsg_SetPageEncoding, OnSetPageEncoding)
IPC_MESSAGE_HANDLER(ViewMsg_ResetPageEncodingToDefault,
OnResetPageEncodingToDefault)
@@ -1739,6 +1740,14 @@ void RenderView::exitFullscreenForNode(const WebKit::WebNode& node) {
NOTIMPLEMENTED();
}
+void RenderView::enterFullscreen() {
+ Send(new ViewHostMsg_ToggleFullscreen(routing_id_, true));
+}
+
+void RenderView::exitFullscreen() {
+ Send(new ViewHostMsg_ToggleFullscreen(routing_id_, false));
+}
+
void RenderView::setStatusText(const WebString& text) {
}
@@ -3425,6 +3434,10 @@ void RenderView::OnSetZoomLevelForLoadingURL(const GURL& url,
host_zoom_levels_[url] = zoom_level;
}
+void RenderView::OnExitFullscreen() {
+ webview()->exitFullscreen();
+}
+
void RenderView::OnSetPageEncoding(const std::string& encoding_name) {
webview()->setPageEncoding(WebString::fromUTF8(encoding_name));
}
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index c628858..2a907e3 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -406,6 +406,8 @@ class RenderView : public RenderWidget,
virtual bool supportsFullscreen();
virtual void enterFullscreenForNode(const WebKit::WebNode&);
virtual void exitFullscreenForNode(const WebKit::WebNode&);
+ virtual void enterFullscreen() OVERRIDE;
+ virtual void exitFullscreen() OVERRIDE;
virtual void setStatusText(const WebKit::WebString& text);
virtual void setMouseOverURL(const WebKit::WebURL& url);
virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
@@ -849,6 +851,7 @@ class RenderView : public RenderWidget,
#endif
void OnSetZoomLevel(double zoom_level);
void OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level);
+ void OnExitFullscreen();
void OnShouldClose();
void OnStop();
void OnStopFinding(const ViewMsg_StopFinding_Params& params);