| OLD | NEW |
| 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 Loading... |
| 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 for (std::vector<base::string16>::iterator it = sorted_menu_titles.begin(); |
| 558 for (size_t i = 0; i < sorted_menu_titles.size(); ++i) { | 558 it != sorted_menu_titles.end(); ++it) { |
| 559 const std::string& id = map_ids[sorted_menu_titles[i]]; | 559 const std::string& id = map_ids[*it]; |
| 560 const MenuItem::ExtensionKey extension_key(id); | |
| 561 extension_items_.AppendExtensionItems( | 560 extension_items_.AppendExtensionItems( |
| 562 extension_key, printable_selection_text, &index); | 561 MenuItem::ExtensionKey(id), printable_selection_text, &index); |
| 563 } | 562 } |
| 564 | |
| 565 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", | |
| 566 base::TimeTicks::Now() - begin); | |
| 567 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); | |
| 568 } | 563 } |
| 569 | 564 |
| 570 void RenderViewContextMenu::AppendCurrentExtensionItems() { | 565 void RenderViewContextMenu::AppendCurrentExtensionItems() { |
| 571 // Avoid appending extension related items when |extension| is null. | 566 // 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 | 567 // For Panel, this happens when the panel is navigated to a url outside of the |
| 573 // extension's package. | 568 // extension's package. |
| 574 const Extension* extension = GetExtension(); | 569 const Extension* extension = GetExtension(); |
| 575 if (extension) { | 570 if (extension) { |
| 576 // Only add extension items from this extension. | 571 // Only add extension items from this extension. |
| 577 int index = 0; | 572 int index = 0; |
| (...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 source_web_contents_->GetRenderViewHost()-> | 1988 source_web_contents_->GetRenderViewHost()-> |
| 1994 ExecuteMediaPlayerActionAtLocation(location, action); | 1989 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1995 } | 1990 } |
| 1996 | 1991 |
| 1997 void RenderViewContextMenu::PluginActionAt( | 1992 void RenderViewContextMenu::PluginActionAt( |
| 1998 const gfx::Point& location, | 1993 const gfx::Point& location, |
| 1999 const WebPluginAction& action) { | 1994 const WebPluginAction& action) { |
| 2000 source_web_contents_->GetRenderViewHost()-> | 1995 source_web_contents_->GetRenderViewHost()-> |
| 2001 ExecutePluginActionAtLocation(location, action); | 1996 ExecutePluginActionAtLocation(location, action); |
| 2002 } | 1997 } |
| OLD | NEW |