| OLD | NEW |
| 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/browser_event_router.h" | 5 #include "chrome/browser/extensions/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/api/extension_action/extension_page_actions_
api_constants.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 void BrowserEventRouter::CommandExecuted(Profile* profile, | 562 void BrowserEventRouter::CommandExecuted(Profile* profile, |
| 563 const std::string& extension_id, | 563 const std::string& extension_id, |
| 564 const std::string& command) { | 564 const std::string& command) { |
| 565 ListValue args; | 565 ListValue args; |
| 566 args.Append(Value::CreateStringValue(command)); | 566 args.Append(Value::CreateStringValue(command)); |
| 567 std::string json_args; | 567 std::string json_args; |
| 568 base::JSONWriter::Write(&args, &json_args); | 568 base::JSONWriter::Write(&args, &json_args); |
| 569 | 569 |
| 570 DispatchEventToExtension(profile, | 570 DispatchEventToExtension(profile, |
| 571 extension_id, | 571 extension_id, |
| 572 "experimental.keybinding.onCommand", | 572 "experimental.commands.onCommand", |
| 573 json_args); | 573 json_args); |
| 574 } | 574 } |
| 575 | 575 |
| 576 void BrowserEventRouter::ExtensionActionExecuted( | 576 void BrowserEventRouter::ExtensionActionExecuted( |
| 577 Profile* profile, | 577 Profile* profile, |
| 578 const ExtensionAction& extension_action, | 578 const ExtensionAction& extension_action, |
| 579 TabContents* tab_contents) { | 579 TabContents* tab_contents) { |
| 580 const char* event_name = NULL; | 580 const char* event_name = NULL; |
| 581 switch (extension_action.action_type()) { | 581 switch (extension_action.action_type()) { |
| 582 case ExtensionAction::TYPE_BROWSER: | 582 case ExtensionAction::TYPE_BROWSER: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 593 if (event_name) { | 593 if (event_name) { |
| 594 DispatchEventWithTab(profile, | 594 DispatchEventWithTab(profile, |
| 595 extension_action.extension_id(), | 595 extension_action.extension_id(), |
| 596 event_name, | 596 event_name, |
| 597 tab_contents->web_contents(), | 597 tab_contents->web_contents(), |
| 598 true); | 598 true); |
| 599 } | 599 } |
| 600 } | 600 } |
| 601 | 601 |
| 602 } // namespace extensions | 602 } // namespace extensions |
| OLD | NEW |