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

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

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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
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/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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 690
691 // Note: web_contents are NULL in unit tests :( 691 // Note: web_contents are NULL in unit tests :(
692 if (web_contents && extensions::TabHelper::FromWebContents(web_contents)) { 692 if (web_contents && extensions::TabHelper::FromWebContents(web_contents)) {
693 extensions::TabHelper::FromWebContents(web_contents)-> 693 extensions::TabHelper::FromWebContents(web_contents)->
694 active_tab_permission_granter()->GrantIfRequested(extension); 694 active_tab_permission_granter()->GrantIfRequested(extension);
695 } 695 }
696 696
697 { 697 {
698 // Dispatch to menu item's .onclick handler. 698 // Dispatch to menu item's .onclick handler.
699 scoped_ptr<Event> event( 699 scoped_ptr<Event> event(
700 new Event(webview_guest ? kOnWebviewContextMenus 700 new Event(events::UNKNOWN,
701 : kOnContextMenus, 701 webview_guest ? kOnWebviewContextMenus : kOnContextMenus,
702 scoped_ptr<base::ListValue>(args->DeepCopy()))); 702 scoped_ptr<base::ListValue>(args->DeepCopy())));
703 event->restrict_to_browser_context = context; 703 event->restrict_to_browser_context = context;
704 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; 704 event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
705 event_router->DispatchEventToExtension(item->extension_id(), event.Pass()); 705 event_router->DispatchEventToExtension(item->extension_id(), event.Pass());
706 } 706 }
707 { 707 {
708 // Dispatch to .contextMenus.onClicked handler. 708 // Dispatch to .contextMenus.onClicked handler.
709 scoped_ptr<Event> event( 709 scoped_ptr<Event> event(new Event(
710 new Event(webview_guest ? chrome_web_view::OnClicked::kEventName 710 events::UNKNOWN, webview_guest ? chrome_web_view::OnClicked::kEventName
711 : context_menus::OnClicked::kEventName, 711 : context_menus::OnClicked::kEventName,
712 args.Pass())); 712 args.Pass()));
713 event->restrict_to_browser_context = context; 713 event->restrict_to_browser_context = context;
714 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; 714 event->user_gesture = EventRouter::USER_GESTURE_ENABLED;
715 if (webview_guest) 715 if (webview_guest)
716 event->filter_info.SetInstanceID(webview_guest->view_instance_id()); 716 event->filter_info.SetInstanceID(webview_guest->view_instance_id());
717 event_router->DispatchEventToExtension(item->extension_id(), event.Pass()); 717 event_router->DispatchEventToExtension(item->extension_id(), event.Pass());
718 } 718 }
719 } 719 }
720 720
721 void MenuManager::SanitizeRadioList(const MenuItem::List& item_list) { 721 void MenuManager::SanitizeRadioList(const MenuItem::List& item_list) {
722 MenuItem::List::const_iterator i = item_list.begin(); 722 MenuItem::List::const_iterator i = item_list.begin();
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 if (uid < other.uid) 940 if (uid < other.uid)
941 return true; 941 return true;
942 if (uid == other.uid) 942 if (uid == other.uid)
943 return string_uid < other.string_uid; 943 return string_uid < other.string_uid;
944 } 944 }
945 } 945 }
946 return false; 946 return false;
947 } 947 }
948 948
949 } // namespace extensions 949 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webui_apitest.cc ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698