summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 20:51:10 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 20:51:10 +0000
commit14690295cad9266c1c17d202dcd8239f03c48785 (patch)
tree3ce3962da7d7d459332c01ac4929d782e48a111f /chrome
parentacbb3dcb1c117965ad74843cad2ddbad7c15da4e (diff)
downloadchromium_src-14690295cad9266c1c17d202dcd8239f03c48785.zip
chromium_src-14690295cad9266c1c17d202dcd8239f03c48785.tar.gz
chromium_src-14690295cad9266c1c17d202dcd8239f03c48785.tar.bz2
Add button number to page action event reply object. Fix outdated page action docs.
Review URL: http://codereview.chromium.org/194082 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc6
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.h3
-rw-r--r--chrome/browser/extensions/extension_page_actions_module_constants.cc1
-rw-r--r--chrome/browser/extensions/extension_page_actions_module_constants.h1
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc3
-rw-r--r--chrome/browser/views/location_bar_view.cc9
-rwxr-xr-xchrome/common/extensions/docs/pageActions.html13
7 files changed, 26 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 9e09da4..c1bce54 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/extension_event_names.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
+#include "chrome/browser/extensions/extension_page_actions_module_constants.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
@@ -18,6 +19,7 @@
namespace events = extension_event_names;
namespace tab_keys = extension_tabs_module_constants;
+namespace page_action_keys = extension_page_actions_module_constants;
ExtensionBrowserEventRouter::TabEntry::TabEntry()
: state_(ExtensionTabUtil::TAB_COMPLETE),
@@ -345,7 +347,8 @@ void ExtensionBrowserEventRouter::PageActionExecuted(
const std::string& extension_id,
const std::string& page_action_id,
int tab_id,
- const std::string& url) {
+ const std::string& url,
+ int button) {
ListValue args;
args.Append(Value::CreateStringValue(page_action_id));
@@ -353,6 +356,7 @@ void ExtensionBrowserEventRouter::PageActionExecuted(
DictionaryValue* data = new DictionaryValue();
data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id));
data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url));
+ data->Set(page_action_keys::kButtonKey, Value::CreateIntegerValue(button));
args.Append(data);
diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h
index 059fae3..c7aa3e9 100644
--- a/chrome/browser/extensions/extension_browser_event_router.h
+++ b/chrome/browser/extensions/extension_browser_event_router.h
@@ -53,7 +53,8 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver,
const std::string& extension_id,
const std::string& page_action_id,
int tab_id,
- const std::string& url);
+ const std::string& url,
+ int button);
// NotificationObserver.
void Observe(NotificationType type,
diff --git a/chrome/browser/extensions/extension_page_actions_module_constants.cc b/chrome/browser/extensions/extension_page_actions_module_constants.cc
index bda4d37..cf43d78 100644
--- a/chrome/browser/extensions/extension_page_actions_module_constants.cc
+++ b/chrome/browser/extensions/extension_page_actions_module_constants.cc
@@ -10,6 +10,7 @@ const wchar_t kTabIdKey[] = L"tabId";
const wchar_t kUrlKey[] = L"url";
const wchar_t kTitleKey[] = L"title";
const wchar_t kIconIdKey[] = L"iconId";
+const wchar_t kButtonKey[] = L"button";
const char kNoExtensionError[] = "No extension with id: *.";
const char kNoTabError[] = "No tab with id: *.";
diff --git a/chrome/browser/extensions/extension_page_actions_module_constants.h b/chrome/browser/extensions/extension_page_actions_module_constants.h
index 91db0d8..0d31175 100644
--- a/chrome/browser/extensions/extension_page_actions_module_constants.h
+++ b/chrome/browser/extensions/extension_page_actions_module_constants.h
@@ -14,6 +14,7 @@ extern const wchar_t kTabIdKey[];
extern const wchar_t kUrlKey[];
extern const wchar_t kTitleKey[];
extern const wchar_t kIconIdKey[];
+extern const wchar_t kButtonKey[];
// Error messages.
extern const char kNoExtensionError[];
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index aaf2fe4..c2b85a2 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -752,6 +752,7 @@ gboolean LocationBarViewGtk::PageActionViewGtk::OnButtonPressed(
page_action_view->page_action_->extension_id(),
page_action_view->page_action_->id(),
page_action_view->current_tab_id_,
- page_action_view->current_url_.spec());
+ page_action_view->current_url_.spec(),
+ event->button);
return true;
}
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 310ba52..d33d68d 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -1224,10 +1224,17 @@ LocationBarView::PageActionImageView::~PageActionImageView() {
bool LocationBarView::PageActionImageView::OnMousePressed(
const views::MouseEvent& event) {
+ int button = -1;
+ if (event.IsLeftMouseButton())
+ button = 1;
+ else if (event.IsMiddleMouseButton())
+ button = 2;
+ else if (event.IsRightMouseButton())
+ button = 3;
// Our PageAction icon was clicked on, notify proper authorities.
ExtensionBrowserEventRouter::GetInstance()->PageActionExecuted(
profile_, page_action_->extension_id(), page_action_->id(),
- current_tab_id_, current_url_.spec());
+ current_tab_id_, current_url_.spec(), button);
return true;
}
diff --git a/chrome/common/extensions/docs/pageActions.html b/chrome/common/extensions/docs/pageActions.html
index 26450dc..a68e095 100755
--- a/chrome/common/extensions/docs/pageActions.html
+++ b/chrome/common/extensions/docs/pageActions.html
@@ -240,22 +240,23 @@ the RSS feed for the current page.
<pre>chrome.pageActions["foo"].addListener(function(object reply) {
console.log(reply.pageActionId); // Display the id of the page action.
- console.log(reply.data.tabId); // Display the id of the tab for which the page action event applies.
- console.log(reply.data.tabUrl); // Display the URL of the page for which the page action event applies.
+ console.log(reply.tabId); // Display the id of the tab for which the page action event applies.
+ console.log(reply.tabUrl); // Display the URL of the page for which the page action event applies.
+ console.log(reply.button); // Display the number of the button which the user clicked with.
});</pre>
<p style="margin-left:25px;"><strong>Parameters</strong></p>
-<p style="margin-left:25px;"><i>reply ( object )</i><br>
-&nbsp;&nbsp;&nbsp;An object containing the information about the event. Contains the following properties:</p>
<p style="margin-left:50px;"><i>pageActionId ( string )</i><br>
&nbsp;&nbsp;&nbsp;The id of the page action that triggered the event.</p>
-<p style="margin-left:50px;"><i>data ( object )</i><br>
-&nbsp;&nbsp;&nbsp;An object specifying what tab and which page the event applies to. Contains the following properties:</p>
+<p style="margin-left:25px;"><i>reply ( object )</i><br>
+&nbsp;&nbsp;&nbsp;An object containing the information about the event and what tab and page the event applies to. Contains the following properties:</p>
<p style="margin-left:75px;"><i>tabId ( string )</i><br>
&nbsp;&nbsp;&nbsp;The id of the tab that was active when the event was triggered.</p>
<p style="margin-left:75px;"><i>tabUrl ( string )</i><br>
&nbsp;&nbsp;&nbsp;The url of the page for which the page action applies to.</p>
+<p style="margin-left:75px;"><i>button ( integer )</i><br>
+&nbsp;&nbsp;&nbsp;The mouse button which was pressed. The left button is 1, middle button is 2, and right button is 3.</p>
<!-- END AUTHORED CONTENT -->
</div>