summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 18:24:56 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 18:24:56 +0000
commit1dda4022a94ea32b79de8880541bce53d30a89a7 (patch)
tree7d6eb946ae1c1dd0d8f2d3b6798615d6bcdecdea
parent468d0a051ed14b487321ff3535f2adc9b47f62a1 (diff)
downloadchromium_src-1dda4022a94ea32b79de8880541bce53d30a89a7.zip
chromium_src-1dda4022a94ea32b79de8880541bce53d30a89a7.tar.gz
chromium_src-1dda4022a94ea32b79de8880541bce53d30a89a7.tar.bz2
Added a "Reload Frame" command to context menu of a frame in the html page.
It was nessessary to add a IPC Message with no Paramter for the reload frame request to the webkit renderer and to add a menu string. The command should only reload the frame clicked in for opening the context menu and let the other parts of the webpage unmodified and unrefreshed. BUG=3858 TEST=Try to click on "Reload Frame" in the context menu of a frame and see if that frame reloads. Review URL: http://codereview.chromium.org/552126 Patch from alexander@sulfrian.net. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37414 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS1
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_view_host.h3
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc6
-rw-r--r--chrome/common/render_messages_internal.h3
-rw-r--r--chrome/renderer/render_view.cc7
-rw-r--r--chrome/renderer/render_view.h1
8 files changed, 31 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index e674ca2..7fe06be 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -60,3 +60,4 @@ Clemens Fruhwirth <clemens@endorphin.org>
Kevin Lee Helpingstine <sig11@reprehensible.net>
Bernard Cafarelli <voyageur@gentoo.org>
Vernon Tang <vt@foilhead.net>
+Alexander Sulfrian <alexander@sulfrian.net>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index c2674b8..b9acb02 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -346,6 +346,9 @@ each locale. -->
Re&amp;load
</message>
+ <message name="IDS_CONTENT_CONTEXT_RELOADFRAME" desc="The name of the Reload Frame command in the content area context menu">
+ Reload frame
+ </message>
<message name="IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW" desc="The name of the Open Frame in New Window command in the content area context menu">
Open frame in new &amp;window
</message>
@@ -525,6 +528,9 @@ each locale. -->
Re&amp;load
</message>
+ <message name="IDS_CONTENT_CONTEXT_RELOADFRAME" desc="In Title Case: The name of the Reload Frame command in the content area context menu">
+ Reload Frame
+ </message>
<message name="IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW" desc="In Title Case: The name of the Open Frame in New Window command in the content area context menu">
Open Frame in New &amp;Window
</message>
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index bdda310..a227ffa 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -370,6 +370,10 @@ void RenderViewHost::Stop() {
Send(new ViewMsg_Stop(routing_id()));
}
+void RenderViewHost::ReloadFrame() {
+ Send(new ViewMsg_ReloadFrame(routing_id()));
+}
+
bool RenderViewHost::PrintPages() {
return Send(new ViewMsg_PrintPages(routing_id()));
}
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 9a37a39..4a3966d 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -192,6 +192,9 @@ class RenderViewHost : public RenderWidgetHost {
// Stops the current load.
void Stop();
+ // Reloads the current frame.
+ void ReloadFrame();
+
// Asks the renderer to "render" printed pages and initiate printing on our
// behalf.
bool PrintPages();
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 4be28b5..aa25c83 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -215,6 +215,7 @@ void RenderViewContextMenu::AppendFrameItems() {
AppendMenuItem(IDS_CONTENT_CONTEXT_BACK);
AppendMenuItem(IDS_CONTENT_CONTEXT_FORWARD);
AppendSeparator();
+ AppendMenuItem(IDS_CONTENT_CONTEXT_RELOADFRAME);
AppendMenuItem(IDS_CONTENT_CONTEXT_OPENFRAMENEWTAB);
AppendMenuItem(IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW);
AppendMenuItem(IDS_CONTENT_CONTEXT_OPENFRAMEOFFTHERECORD);
@@ -458,6 +459,7 @@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const {
(active_entry) ? active_entry->url() : GURL());
}
+ case IDS_CONTENT_CONTEXT_RELOADFRAME:
case IDS_CONTENT_CONTEXT_OPENFRAMENEWTAB:
case IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW:
return params_.frame_url.is_valid();
@@ -695,6 +697,10 @@ void RenderViewContextMenu::ExecuteItemCommand(int id) {
break;
}
+ case IDS_CONTENT_CONTEXT_RELOADFRAME:
+ source_tab_contents_->render_view_host()->ReloadFrame();
+ break;
+
case IDS_CONTENT_CONTEXT_OPENFRAMENEWTAB:
OpenURL(params_.frame_url, NEW_BACKGROUND_TAB, PageTransition::LINK);
break;
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 22f4a0f..d243a21 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -190,6 +190,9 @@ IPC_BEGIN_MESSAGES(View)
IPC_MESSAGE_ROUTED0(ViewMsg_Stop)
+ // Tells the renderer to reload the current focused frame
+ IPC_MESSAGE_ROUTED0(ViewMsg_ReloadFrame)
+
// Tells the renderer to load the specified html text and report a navigation
// to display_url if passing true for new navigation.
IPC_MESSAGE_ROUTED4(ViewMsg_LoadAlternateHTMLText,
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4c74a61..ce5520b 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -472,6 +472,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
+ IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame)
IPC_MESSAGE_HANDLER(ViewMsg_LoadAlternateHTMLText, OnLoadAlternateHTMLText)
IPC_MESSAGE_HANDLER(ViewMsg_StopFinding, OnStopFinding)
IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
@@ -889,6 +890,12 @@ void RenderView::OnStop() {
webview()->mainFrame()->stopLoading();
}
+// Reload current focused frame
+void RenderView::OnReloadFrame() {
+ if (webview() && webview()->focusedFrame())
+ webview()->focusedFrame()->reload();
+}
+
void RenderView::OnLoadAlternateHTMLText(const std::string& html,
bool new_navigation,
const GURL& display_url,
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index d1b4989..2845601 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -547,6 +547,7 @@ class RenderView : public RenderWidget,
void OnPrintingDone(int document_cookie, bool success);
void OnNavigate(const ViewMsg_Navigate_Params& params);
void OnStop();
+ void OnReloadFrame();
void OnLoadAlternateHTMLText(const std::string& html_contents,
bool new_navigation,
const GURL& display_url,