summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 20:19:55 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-30 20:19:55 +0000
commit163f82413015e71e0cf99bfa60e8a0c1adeefa2c (patch)
treec46e95032ad49363dba4947518279243a194c4c7 /chrome
parent6d98bcf2015ef0bd8ce67f79afe9d48225e59ed7 (diff)
downloadchromium_src-163f82413015e71e0cf99bfa60e8a0c1adeefa2c.zip
chromium_src-163f82413015e71e0cf99bfa60e8a0c1adeefa2c.tar.gz
chromium_src-163f82413015e71e0cf99bfa60e8a0c1adeefa2c.tar.bz2
Show status bubble for links that have keyboard focus.
I tried to just piggy-back off of existing chrome client calls (particularly focus()), but that didn't handle blurs. webkit side is here: http://codereview.chromium.org/328034/show BUG=453 original review: http://codereview.chromium.org/337032/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/print_web_view_helper.h1
-rw-r--r--chrome/renderer/render_view.cc15
-rw-r--r--chrome/renderer/render_view.h14
3 files changed, 26 insertions, 4 deletions
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index 87a7ca6..11da15f 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -191,6 +191,7 @@ class PrintWebViewHelper : public WebKit::WebViewClient {
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data) {}
virtual void setStatusText(const WebKit::WebString& text) {}
virtual void setMouseOverURL(const WebKit::WebURL& url) {}
+ virtual void setKeyboardFocusURL(const WebKit::WebURL& url) {}
virtual void setToolTipText(
const WebKit::WebString& text, WebKit::WebTextDirection hint) {}
virtual void startDragging(
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index b57d3ce..f89e8960 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -1612,10 +1612,11 @@ void RenderView::showContextMenu(
void RenderView::setStatusText(const WebString& text) {
}
-void RenderView::setMouseOverURL(const WebURL& url) {
- GURL latest_url(url);
+void RenderView::UpdateTargetURL(const GURL& url, const GURL& fallback_url) {
+ GURL latest_url = url.spec().empty() ? fallback_url : url;
if (latest_url == target_url_)
return;
+
// Tell the browser to display a destination link.
if (target_url_status_ == TARGET_INFLIGHT ||
target_url_status_ == TARGET_PENDING) {
@@ -1631,6 +1632,16 @@ void RenderView::setMouseOverURL(const WebURL& url) {
}
}
+void RenderView::setMouseOverURL(const WebURL& url) {
+ mouse_over_url_ = GURL(url);
+ UpdateTargetURL(mouse_over_url_, focus_url_);
+}
+
+void RenderView::setKeyboardFocusURL(const WebURL& url) {
+ focus_url_ = GURL(url);
+ UpdateTargetURL(focus_url_, mouse_over_url_);
+}
+
void RenderView::setToolTipText(const WebString& text, WebTextDirection hint) {
Send(new ViewHostMsg_SetTooltipText(routing_id_, UTF16ToWideHack(text),
hint));
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 2aa3167..900cb2c 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -241,6 +241,7 @@ class RenderView : public RenderWidget,
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
virtual void setStatusText(const WebKit::WebString& text);
virtual void setMouseOverURL(const WebKit::WebURL& url);
+ virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
virtual void setToolTipText(
const WebKit::WebString& text, WebKit::WebTextDirection hint);
virtual void startDragging(
@@ -738,6 +739,10 @@ class RenderView : public RenderWidget,
// Initializes the document_tag_ member if necessary.
void EnsureDocumentTag();
+ // Update the target url and tell the browser that the target URL has changed.
+ // If |url| is empty, show |fallback_url|.
+ void UpdateTargetURL(const GURL& url, const GURL& fallback_url);
+
// Bitwise-ORed set of extra bindings that have been enabled. See
// BindingsPolicy for details.
int enabled_bindings_;
@@ -754,10 +759,15 @@ class RenderView : public RenderWidget,
// The last gotten main frame's encoding.
std::string last_encoding_name_;
- // The URL we think the user's mouse is hovering over. We use this to
+ // The URL we show the user in the status bar. We use this to
// determine if we want to send a new one (we do not need to send
- // duplicates).
+ // duplicates). It will be equal to either |mouse_over_url_| or |focus_url_|,
+ // depending on which was updated last.
GURL target_url_;
+ // The URL the user's mouse is hovering over.
+ GURL mouse_over_url_;
+ // The URL that has keyboard focus.
+ GURL focus_url_;
// The state of our target_url transmissions. When we receive a request to
// send a URL to the browser, we set this to TARGET_INFLIGHT until an ACK