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/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/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/extension_event_names.h" | 10 #include "chrome/browser/extensions/extension_event_names.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 DispatchEventToExtension(profile, | 669 DispatchEventToExtension(profile, |
670 extension_id, | 670 extension_id, |
671 "experimental.keybinding.onCommand", | 671 "experimental.keybinding.onCommand", |
672 json_args); | 672 json_args); |
673 } | 673 } |
674 | 674 |
675 void ExtensionBrowserEventRouter::ExtensionActionExecuted( | 675 void ExtensionBrowserEventRouter::ExtensionActionExecuted( |
676 Profile* profile, | 676 Profile* profile, |
677 const std::string& extension_id, | 677 const std::string& extension_id, |
678 TabContentsWrapper* tab_contents) { | 678 TabContentsWrapper* tab_contents) { |
679 const Extension* extension = | 679 const extensions::Extension* extension = |
680 profile->GetExtensionService()->GetExtensionById(extension_id, false); | 680 profile->GetExtensionService()->GetExtensionById(extension_id, false); |
681 if (!extension) | 681 if (!extension) |
682 return; | 682 return; |
683 | 683 |
684 const char* event_name = NULL; | 684 const char* event_name = NULL; |
685 switch (extension->declared_action_type()) { | 685 switch (extension->declared_action_type()) { |
686 case ExtensionAction::TYPE_NONE: | 686 case ExtensionAction::TYPE_NONE: |
687 break; | 687 break; |
688 case ExtensionAction::TYPE_BROWSER: | 688 case ExtensionAction::TYPE_BROWSER: |
689 event_name = "browserAction.onClicked"; | 689 event_name = "browserAction.onClicked"; |
690 break; | 690 break; |
691 case ExtensionAction::TYPE_PAGE: | 691 case ExtensionAction::TYPE_PAGE: |
692 event_name = "pageAction.onClicked"; | 692 event_name = "pageAction.onClicked"; |
693 break; | 693 break; |
694 } | 694 } |
695 | 695 |
696 if (event_name) { | 696 if (event_name) { |
697 DispatchEventWithTab(profile, | 697 DispatchEventWithTab(profile, |
698 extension_id, | 698 extension_id, |
699 event_name, | 699 event_name, |
700 tab_contents->web_contents(), | 700 tab_contents->web_contents(), |
701 true); | 701 true); |
702 } | 702 } |
703 } | 703 } |
OLD | NEW |