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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 switch (extension_action.action_type()) { | 576 switch (extension_action.action_type()) { |
577 case Extension::ActionInfo::TYPE_BROWSER: | 577 case Extension::ActionInfo::TYPE_BROWSER: |
578 event_name = "browserAction.onClicked"; | 578 event_name = "browserAction.onClicked"; |
579 break; | 579 break; |
580 case Extension::ActionInfo::TYPE_PAGE: | 580 case Extension::ActionInfo::TYPE_PAGE: |
581 event_name = "pageAction.onClicked"; | 581 event_name = "pageAction.onClicked"; |
582 break; | 582 break; |
583 case Extension::ActionInfo::TYPE_SCRIPT_BADGE: | 583 case Extension::ActionInfo::TYPE_SCRIPT_BADGE: |
584 event_name = "scriptBadge.onClicked"; | 584 event_name = "scriptBadge.onClicked"; |
585 break; | 585 break; |
| 586 case Extension::ActionInfo::TYPE_SYSTEM_INDICATOR: |
| 587 // The System Indicator handles its own clicks. |
| 588 break; |
586 } | 589 } |
587 | 590 |
588 if (event_name) { | 591 if (event_name) { |
589 scoped_ptr<ListValue> args(new ListValue()); | 592 scoped_ptr<ListValue> args(new ListValue()); |
590 DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue( | 593 DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue( |
591 web_contents, | 594 web_contents, |
592 ExtensionTabUtil::INCLUDE_PRIVACY_SENSITIVE_FIELDS); | 595 ExtensionTabUtil::INCLUDE_PRIVACY_SENSITIVE_FIELDS); |
593 args->Append(tab_value); | 596 args->Append(tab_value); |
594 | 597 |
595 DispatchEventToExtension(profile, | 598 DispatchEventToExtension(profile, |
596 extension_action.extension_id(), | 599 extension_action.extension_id(), |
597 event_name, | 600 event_name, |
598 args.Pass(), | 601 args.Pass(), |
599 EventRouter::USER_GESTURE_ENABLED); | 602 EventRouter::USER_GESTURE_ENABLED); |
600 } | 603 } |
601 } | 604 } |
602 | 605 |
603 } // namespace extensions | 606 } // namespace extensions |
OLD | NEW |