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/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 if (extension) | 668 if (extension) |
669 WriteToStorage(extension); | 669 WriteToStorage(extension); |
670 } | 670 } |
671 | 671 |
672 // Note: web_contents are NULL in unit tests :( | 672 // Note: web_contents are NULL in unit tests :( |
673 if (web_contents && extensions::TabHelper::FromWebContents(web_contents)) { | 673 if (web_contents && extensions::TabHelper::FromWebContents(web_contents)) { |
674 extensions::TabHelper::FromWebContents(web_contents)-> | 674 extensions::TabHelper::FromWebContents(web_contents)-> |
675 active_tab_permission_granter()->GrantIfRequested(extension); | 675 active_tab_permission_granter()->GrantIfRequested(extension); |
676 } | 676 } |
677 | 677 |
678 event_router->DispatchEventToExtension( | 678 { |
679 item->extension_id(), event_names::kOnContextMenus, | 679 scoped_ptr<Event> event(new Event(event_names::kOnContextMenus, |
680 scoped_ptr<ListValue>(args->DeepCopy()), profile, GURL(), | 680 scoped_ptr<ListValue>(args->DeepCopy()))); |
681 EventRouter::USER_GESTURE_ENABLED); | 681 event->restrict_to_profile = profile; |
682 event_router->DispatchEventToExtension( | 682 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
683 item->extension_id(), event_names::kOnContextMenuClicked, | 683 event_router->DispatchEventToExtension(item->extension_id(), event.Pass()); |
684 args.Pass(), profile, GURL(), | 684 } |
685 EventRouter::USER_GESTURE_ENABLED); | 685 { |
| 686 scoped_ptr<Event> event(new Event(event_names::kOnContextMenuClicked, |
| 687 args.Pass())); |
| 688 event->restrict_to_profile = profile; |
| 689 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
| 690 event_router->DispatchEventToExtension(item->extension_id(), event.Pass()); |
| 691 } |
686 } | 692 } |
687 | 693 |
688 void MenuManager::SanitizeRadioList(const MenuItem::List& item_list) { | 694 void MenuManager::SanitizeRadioList(const MenuItem::List& item_list) { |
689 MenuItem::List::const_iterator i = item_list.begin(); | 695 MenuItem::List::const_iterator i = item_list.begin(); |
690 while (i != item_list.end()) { | 696 while (i != item_list.end()) { |
691 if ((*i)->type() != MenuItem::RADIO) { | 697 if ((*i)->type() != MenuItem::RADIO) { |
692 ++i; | 698 ++i; |
693 break; | 699 break; |
694 } | 700 } |
695 | 701 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 if (uid < other.uid) | 867 if (uid < other.uid) |
862 return true; | 868 return true; |
863 if (uid == other.uid) | 869 if (uid == other.uid) |
864 return string_uid < other.string_uid; | 870 return string_uid < other.string_uid; |
865 } | 871 } |
866 } | 872 } |
867 return false; | 873 return false; |
868 } | 874 } |
869 | 875 |
870 } // namespace extensions | 876 } // namespace extensions |
OLD | NEW |