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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 359493005: Extend contextMenus API to support browser/page actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor changes and cleanup Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 sorted_menu_titles.push_back(menu_title); 547 sorted_menu_titles.push_back(menu_title);
548 } 548 }
549 } 549 }
550 if (sorted_menu_titles.empty()) 550 if (sorted_menu_titles.empty())
551 return; 551 return;
552 552
553 const std::string app_locale = g_browser_process->GetApplicationLocale(); 553 const std::string app_locale = g_browser_process->GetApplicationLocale();
554 l10n_util::SortStrings16(app_locale, &sorted_menu_titles); 554 l10n_util::SortStrings16(app_locale, &sorted_menu_titles);
555 555
556 int index = 0; 556 int index = 0;
557 base::TimeTicks begin = base::TimeTicks::Now(); 557 base::TimeTicks begin = base::TimeTicks::Now();
Devlin 2014/07/09 20:07:47 Take this out, too.
gpdavis 2014/07/09 22:15:51 Done.
558 for (size_t i = 0; i < sorted_menu_titles.size(); ++i) { 558 for (size_t i = 0; i < sorted_menu_titles.size(); ++i) {
559 const std::string& id = map_ids[sorted_menu_titles[i]]; 559 const std::string& id = map_ids[sorted_menu_titles[i]];
560 const MenuItem::ExtensionKey extension_key(id); 560 const MenuItem::ExtensionKey extension_key(id);
561 extension_items_.AppendExtensionItems( 561 extension_items_.AppendExtensionItems(
562 extension_key, printable_selection_text, &index); 562 extension_key, printable_selection_text, &index);
563 } 563 }
564
565 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime",
566 base::TimeTicks::Now() - begin);
567 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index);
568 } 564 }
569 565
570 void RenderViewContextMenu::AppendCurrentExtensionItems() { 566 void RenderViewContextMenu::AppendCurrentExtensionItems() {
571 // Avoid appending extension related items when |extension| is null. 567 // Avoid appending extension related items when |extension| is null.
572 // For Panel, this happens when the panel is navigated to a url outside of the 568 // For Panel, this happens when the panel is navigated to a url outside of the
573 // extension's package. 569 // extension's package.
574 const Extension* extension = GetExtension(); 570 const Extension* extension = GetExtension();
575 if (extension) { 571 if (extension) {
576 // Only add extension items from this extension. 572 // Only add extension items from this extension.
577 int index = 0; 573 int index = 0;
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 source_web_contents_->GetRenderViewHost()-> 1988 source_web_contents_->GetRenderViewHost()->
1993 ExecuteMediaPlayerActionAtLocation(location, action); 1989 ExecuteMediaPlayerActionAtLocation(location, action);
1994 } 1990 }
1995 1991
1996 void RenderViewContextMenu::PluginActionAt( 1992 void RenderViewContextMenu::PluginActionAt(
1997 const gfx::Point& location, 1993 const gfx::Point& location,
1998 const WebPluginAction& action) { 1994 const WebPluginAction& action) {
1999 source_web_contents_->GetRenderViewHost()-> 1995 source_web_contents_->GetRenderViewHost()->
2000 ExecutePluginActionAtLocation(location, action); 1996 ExecutePluginActionAtLocation(location, action);
2001 } 1997 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698