Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5470)

Unified Diff: chrome/browser/ui/toolbar/action_box_button_controller.cc

Issue 12262050: Send selected text and page title to pageLauncher.OnClicked. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/action_box_button_controller.cc
diff --git a/chrome/browser/ui/toolbar/action_box_button_controller.cc b/chrome/browser/ui/toolbar/action_box_button_controller.cc
index 030053166b63085ad7d5b68c5af9249392bc78e1..d4517db97673057503be9e4c141457c37813f275 100644
--- a/chrome/browser/ui/toolbar/action_box_button_controller.cc
+++ b/chrome/browser/ui/toolbar/action_box_button_controller.cc
@@ -22,6 +22,7 @@
#include "chrome/common/extensions/extension_set.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
@@ -91,14 +92,17 @@ void ActionBoxButtonController::ExecuteCommand(int command_id) {
if (it != extension_command_ids_.end()) {
WebContents* web_contents =
browser_->tab_strip_model()->GetActiveWebContents();
- // TODO(rfevang): Send page title and selected text.
+
+ std::string page_title = UTF16ToUTF8(web_contents->GetTitle());
+ std::string selected_text =
+ UTF16ToUTF8(web_contents->GetRenderWidgetHostView()->GetSelectedText());
extensions::PageLauncherAPI::DispatchOnClickedEvent(
browser_->profile(),
it->second,
web_contents->GetURL(),
web_contents->GetContentsMimeType(),
- NULL,
- NULL);
+ page_title.empty() ? NULL : &page_title,
+ selected_text.empty() ? NULL : &selected_text);
return;
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698