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

Side by Side Diff: chrome/browser/extensions/extension_browser_event_router.cc

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_browser_event_router.h" 5 #include "chrome/browser/extensions/extension_browser_event_router.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_event_names.h" 9 #include "chrome/browser/extensions/extension_event_names.h"
10 #include "chrome/browser/extensions/extension_event_router.h" 10 #include "chrome/browser/extensions/extension_event_router.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 void ExtensionBrowserEventRouter::BrowserActionExecuted( 647 void ExtensionBrowserEventRouter::BrowserActionExecuted(
648 Profile* profile, const std::string& extension_id, Browser* browser) { 648 Profile* profile, const std::string& extension_id, Browser* browser) {
649 TabContentsWrapper* tab_contents = NULL; 649 TabContentsWrapper* tab_contents = NULL;
650 int tab_id = 0; 650 int tab_id = 0;
651 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) 651 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
652 return; 652 return;
653 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked", 653 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked",
654 tab_contents->web_contents(), true); 654 tab_contents->web_contents(), true);
655 } 655 }
656
657 void ExtensionBrowserEventRouter::CommandExecuted(
658 Profile* profile,
659 const std::string& extension_id,
660 const std::string& command) {
661 ListValue args;
662 args.Append(Value::CreateStringValue(command));
663 std::string json_args;
664 base::JSONWriter::Write(&args, false, &json_args);
665
666 DispatchEventToExtension(profile,
667 extension_id,
Matt Perry 2012/02/21 23:13:39 nit: indent +2
668 "experimental.keybinding.onCommand",
669 json_args);
670 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698