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 std::vector<base::string16>::iterator it; |
Devlin
2014/07/09 22:42:59
same comment about scoping.
gpdavis
2014/07/10 00:22:26
Done.
| |
558 for (size_t i = 0; i < sorted_menu_titles.size(); ++i) { | 558 for (it = sorted_menu_titles.begin(); 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); | 560 const MenuItem::ExtensionKey extension_key(id); |
Devlin
2014/07/09 22:42:59
Since you're here... same comment about inlining e
gpdavis
2014/07/10 00:22:25
Done.
| |
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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 source_web_contents_->GetRenderViewHost()-> | 1989 source_web_contents_->GetRenderViewHost()-> |
1994 ExecuteMediaPlayerActionAtLocation(location, action); | 1990 ExecuteMediaPlayerActionAtLocation(location, action); |
1995 } | 1991 } |
1996 | 1992 |
1997 void RenderViewContextMenu::PluginActionAt( | 1993 void RenderViewContextMenu::PluginActionAt( |
1998 const gfx::Point& location, | 1994 const gfx::Point& location, |
1999 const WebPluginAction& action) { | 1995 const WebPluginAction& action) { |
2000 source_web_contents_->GetRenderViewHost()-> | 1996 source_web_contents_->GetRenderViewHost()-> |
2001 ExecutePluginActionAtLocation(location, action); | 1997 ExecutePluginActionAtLocation(location, action); |
2002 } | 1998 } |
OLD | NEW |