Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", | 502 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", |
| 503 base::TimeTicks::Now() - begin); | 503 base::TimeTicks::Now() - begin); |
| 504 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); | 504 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void RenderViewContextMenu::InitMenu() { | 507 void RenderViewContextMenu::InitMenu() { |
| 508 bool has_link = !params_.link_url.is_empty(); | 508 bool has_link = !params_.link_url.is_empty(); |
| 509 bool has_selection = !params_.selection_text.empty(); | 509 bool has_selection = !params_.selection_text.empty(); |
| 510 | 510 |
| 511 if (AppendCustomItems()) { | 511 if (AppendCustomItems()) { |
| 512 // Don't add items for Pepper menu. | 512 if (has_selection) { |
| 513 if (!params_.custom_context.is_pepper_menu) | 513 menu_model_.AddSeparator(); |
|
brettw
2011/10/21 20:24:27
I get it. Can we have a comment here like:
// If
| |
| 514 AppendDeveloperItems(); | 514 } else { |
| 515 return; | 515 // Don't add items for Pepper menu. |
| 516 if (!params_.custom_context.is_pepper_menu) | |
| 517 AppendDeveloperItems(); | |
| 518 return; | |
| 519 } | |
| 516 } | 520 } |
| 517 | 521 |
| 518 // When no special node or text is selected and selection has no link, | 522 // When no special node or text is selected and selection has no link, |
| 519 // show page items. | 523 // show page items. |
| 520 if (params_.media_type == WebContextMenuData::MediaTypeNone && | 524 if (params_.media_type == WebContextMenuData::MediaTypeNone && |
| 521 !has_link && | 525 !has_link && |
| 522 !params_.is_editable && | 526 !params_.is_editable && |
| 523 !has_selection) { | 527 !has_selection) { |
| 524 if (!params_.page_url.is_empty()) { | 528 if (!params_.page_url.is_empty()) { |
| 525 bool is_devtools = IsDevToolsURL(params_.page_url); | 529 bool is_devtools = IsDevToolsURL(params_.page_url); |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1959 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1963 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 1960 g_browser_process->clipboard()); | 1964 g_browser_process->clipboard()); |
| 1961 } | 1965 } |
| 1962 | 1966 |
| 1963 void RenderViewContextMenu::MediaPlayerActionAt( | 1967 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1964 const gfx::Point& location, | 1968 const gfx::Point& location, |
| 1965 const WebMediaPlayerAction& action) { | 1969 const WebMediaPlayerAction& action) { |
| 1966 source_tab_contents_->render_view_host()-> | 1970 source_tab_contents_->render_view_host()-> |
| 1967 ExecuteMediaPlayerActionAtLocation(location, action); | 1971 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1968 } | 1972 } |
| OLD | NEW |