| OLD | NEW |
| 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/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 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 15 #include "base/prefs/public/pref_member.h" | 15 #include "base/prefs/public/pref_member.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "chrome/app/chrome_command_ids.h" | 20 #include "chrome/app/chrome_command_ids.h" |
| 21 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 21 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 22 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 22 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 23 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 23 #include "chrome/browser/autocomplete/autocomplete_match.h" | 24 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 24 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/devtools/devtools_window.h" | 26 #include "chrome/browser/devtools/devtools_window.h" |
| 26 #include "chrome/browser/download/download_service.h" | 27 #include "chrome/browser/download/download_service.h" |
| 27 #include "chrome/browser/download/download_service_factory.h" | 28 #include "chrome/browser/download/download_service_factory.h" |
| 28 #include "chrome/browser/download/download_util.h" | 29 #include "chrome/browser/download/download_util.h" |
| 29 #include "chrome/browser/extensions/extension_host.h" | 30 #include "chrome/browser/extensions/extension_host.h" |
| 30 #include "chrome/browser/extensions/extension_service.h" | 31 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 #endif | 225 #endif |
| 225 | 226 |
| 226 return true; | 227 return true; |
| 227 } | 228 } |
| 228 | 229 |
| 229 void DevToolsInspectElementAt(RenderViewHost* rvh, int x, int y) { | 230 void DevToolsInspectElementAt(RenderViewHost* rvh, int x, int y) { |
| 230 DevToolsWindow::InspectElement(rvh, x, y); | 231 DevToolsWindow::InspectElement(rvh, x, y); |
| 231 } | 232 } |
| 232 | 233 |
| 233 // Helper function to escape "&" as "&&". | 234 // Helper function to escape "&" as "&&". |
| 234 void EscapeAmpersands(string16& text) { | 235 void EscapeAmpersands(string16* text) { |
| 235 const char16 ampersand[] = {'&', 0}; | 236 const char16 ampersand[] = {'&', 0}; |
| 236 ReplaceChars(text, ampersand, ASCIIToUTF16("&&"), &text); | 237 ReplaceChars(*text, ampersand, ASCIIToUTF16("&&"), text); |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace | 240 } // namespace |
| 240 | 241 |
| 241 // static | 242 // static |
| 242 const size_t RenderViewContextMenu::kMaxSelectionTextLength = 50; | 243 const size_t RenderViewContextMenu::kMaxSelectionTextLength = 50; |
| 243 | 244 |
| 244 // static | 245 // static |
| 245 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { | 246 bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { |
| 246 return url.SchemeIs(chrome::kChromeDevToolsScheme) && | 247 return url.SchemeIs(chrome::kChromeDevToolsScheme) && |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (patterns.is_empty()) | 292 if (patterns.is_empty()) |
| 292 return true; | 293 return true; |
| 293 return patterns.MatchesURL(url); | 294 return patterns.MatchesURL(url); |
| 294 } | 295 } |
| 295 | 296 |
| 296 // static | 297 // static |
| 297 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( | 298 bool RenderViewContextMenu::ExtensionContextAndPatternMatch( |
| 298 const content::ContextMenuParams& params, | 299 const content::ContextMenuParams& params, |
| 299 MenuItem::ContextList contexts, | 300 MenuItem::ContextList contexts, |
| 300 const extensions::URLPatternSet& target_url_patterns) { | 301 const extensions::URLPatternSet& target_url_patterns) { |
| 301 bool has_link = !params.link_url.is_empty(); | 302 const bool has_link = !params.link_url.is_empty(); |
| 302 bool has_selection = !params.selection_text.empty(); | 303 const bool has_selection = !params.selection_text.empty(); |
| 303 bool in_frame = !params.frame_url.is_empty(); | 304 const bool in_frame = !params.frame_url.is_empty(); |
| 304 | 305 |
| 305 if (contexts.Contains(MenuItem::ALL) || | 306 if (contexts.Contains(MenuItem::ALL) || |
| 306 (has_selection && contexts.Contains(MenuItem::SELECTION)) || | 307 (has_selection && contexts.Contains(MenuItem::SELECTION)) || |
| 307 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || | 308 (params.is_editable && contexts.Contains(MenuItem::EDITABLE)) || |
| 308 (in_frame && contexts.Contains(MenuItem::FRAME))) | 309 (in_frame && contexts.Contains(MenuItem::FRAME))) |
| 309 return true; | 310 return true; |
| 310 | 311 |
| 311 if (has_link && contexts.Contains(MenuItem::LINK) && | 312 if (has_link && contexts.Contains(MenuItem::LINK) && |
| 312 ExtensionPatternMatch(target_url_patterns, params.link_url)) | 313 ExtensionPatternMatch(target_url_patterns, params.link_url)) |
| 313 return true; | 314 return true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 389 |
| 389 if (sorted_ids.empty()) | 390 if (sorted_ids.empty()) |
| 390 return; | 391 return; |
| 391 | 392 |
| 392 int index = 0; | 393 int index = 0; |
| 393 base::TimeTicks begin = base::TimeTicks::Now(); | 394 base::TimeTicks begin = base::TimeTicks::Now(); |
| 394 std::vector<std::pair<std::string, std::string> >::const_iterator i; | 395 std::vector<std::pair<std::string, std::string> >::const_iterator i; |
| 395 for (i = sorted_ids.begin(); | 396 for (i = sorted_ids.begin(); |
| 396 i != sorted_ids.end(); ++i) { | 397 i != sorted_ids.end(); ++i) { |
| 397 string16 printable_selection_text = PrintableSelectionText(); | 398 string16 printable_selection_text = PrintableSelectionText(); |
| 398 EscapeAmpersands(printable_selection_text); | 399 EscapeAmpersands(&printable_selection_text); |
| 399 | 400 |
| 400 extension_items_.AppendExtensionItems(i->second, printable_selection_text, | 401 extension_items_.AppendExtensionItems(i->second, printable_selection_text, |
| 401 &index); | 402 &index); |
| 402 } | 403 } |
| 403 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", | 404 UMA_HISTOGRAM_TIMES("Extensions.ContextMenus_BuildTime", |
| 404 base::TimeTicks::Now() - begin); | 405 base::TimeTicks::Now() - begin); |
| 405 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); | 406 UMA_HISTOGRAM_COUNTS("Extensions.ContextMenus_ItemCount", index); |
| 406 } | 407 } |
| 407 | 408 |
| 408 void RenderViewContextMenu::InitMenu() { | 409 void RenderViewContextMenu::InitMenu() { |
| 410 if (chrome::IsRunningInForcedAppMode()) { |
| 411 AppendAppModeItems(); |
| 412 return; |
| 413 } |
| 414 |
| 409 chrome::ViewType view_type = chrome::GetViewType(source_web_contents_); | 415 chrome::ViewType view_type = chrome::GetViewType(source_web_contents_); |
| 410 if (view_type == chrome::VIEW_TYPE_APP_SHELL) { | 416 if (view_type == chrome::VIEW_TYPE_APP_SHELL) { |
| 411 AppendPlatformAppItems(); | 417 AppendPlatformAppItems(); |
| 412 return; | 418 return; |
| 413 } else if (view_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 419 } else if (view_type == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
| 414 AppendPopupExtensionItems(); | 420 AppendPopupExtensionItems(); |
| 415 return; | 421 return; |
| 416 } else if (view_type == chrome::VIEW_TYPE_PANEL) { | 422 } else if (view_type == chrome::VIEW_TYPE_PANEL) { |
| 417 AppendPanelItems(); | 423 AppendPanelItems(); |
| 418 return; | 424 return; |
| 419 } | 425 } |
| 420 | 426 |
| 421 bool has_link = !params_.unfiltered_link_url.is_empty(); | 427 const bool has_link = !params_.unfiltered_link_url.is_empty(); |
| 422 bool has_selection = !params_.selection_text.empty(); | 428 const bool has_selection = !params_.selection_text.empty(); |
| 423 | 429 |
| 424 if (AppendCustomItems()) { | 430 if (AppendCustomItems()) { |
| 425 // If there's a selection, don't early return when there are custom items, | 431 // If there's a selection, don't early return when there are custom items, |
| 426 // but fall through to adding the normal ones after the custom ones. | 432 // but fall through to adding the normal ones after the custom ones. |
| 427 if (has_selection) { | 433 if (has_selection) { |
| 428 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 434 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 429 } else { | 435 } else { |
| 430 // Don't add items for Pepper menu. | 436 // Don't add items for Pepper menu. |
| 431 if (!params_.custom_context.is_pepper_menu) | 437 if (!params_.custom_context.is_pepper_menu) |
| 432 AppendDeveloperItems(); | 438 AppendDeveloperItems(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 extensions::ExtensionSystem* system = | 518 extensions::ExtensionSystem* system = |
| 513 extensions::ExtensionSystem::Get(profile_); | 519 extensions::ExtensionSystem::Get(profile_); |
| 514 // There is no process manager in some tests. | 520 // There is no process manager in some tests. |
| 515 if (!system->process_manager()) | 521 if (!system->process_manager()) |
| 516 return NULL; | 522 return NULL; |
| 517 | 523 |
| 518 return system->process_manager()->GetExtensionForRenderViewHost( | 524 return system->process_manager()->GetExtensionForRenderViewHost( |
| 519 source_web_contents_->GetRenderViewHost()); | 525 source_web_contents_->GetRenderViewHost()); |
| 520 } | 526 } |
| 521 | 527 |
| 528 void RenderViewContextMenu::AppendAppModeItems() { |
| 529 const bool has_selection = !params_.selection_text.empty(); |
| 530 |
| 531 if (params_.is_editable) |
| 532 AppendEditableItems(); |
| 533 else if (has_selection) |
| 534 AppendCopyItem(); |
| 535 } |
| 536 |
| 522 void RenderViewContextMenu::AppendPlatformAppItems() { | 537 void RenderViewContextMenu::AppendPlatformAppItems() { |
| 523 const Extension* platform_app = GetExtension(); | 538 const Extension* platform_app = GetExtension(); |
| 524 | 539 |
| 525 // The RVH might be for a process sandboxed from the extension. | 540 // The RVH might be for a process sandboxed from the extension. |
| 526 if (!platform_app) | 541 if (!platform_app) |
| 527 return; | 542 return; |
| 528 | 543 |
| 529 DCHECK(platform_app->is_platform_app()); | 544 DCHECK(platform_app->is_platform_app()); |
| 530 | 545 |
| 531 bool has_selection = !params_.selection_text.empty(); | 546 const bool has_selection = !params_.selection_text.empty(); |
| 532 | 547 |
| 533 // Add undo/redo, cut/copy/paste etc for text fields. | 548 // Add undo/redo, cut/copy/paste etc for text fields. |
| 534 if (params_.is_editable) | 549 if (params_.is_editable) |
| 535 AppendEditableItems(); | 550 AppendEditableItems(); |
| 536 else if (has_selection) | 551 else if (has_selection) |
| 537 AppendCopyItem(); | 552 AppendCopyItem(); |
| 538 | 553 |
| 539 int index = 0; | 554 int index = 0; |
| 540 extension_items_.AppendExtensionItems(platform_app->id(), | 555 extension_items_.AppendExtensionItems(platform_app->id(), |
| 541 PrintableSelectionText(), &index); | 556 PrintableSelectionText(), &index); |
| 542 | 557 |
| 543 // Add dev tools for unpacked extensions. | 558 // Add dev tools for unpacked extensions. |
| 544 if (extensions::Manifest::IsUnpackedLocation(platform_app->location()) || | 559 if (extensions::Manifest::IsUnpackedLocation(platform_app->location()) || |
| 545 CommandLine::ForCurrentProcess()->HasSwitch( | 560 CommandLine::ForCurrentProcess()->HasSwitch( |
| 546 switches::kDebugPackedApps)) { | 561 switches::kDebugPackedApps)) { |
| 547 // Add a separator if there are any items already in the menu. | 562 // Add a separator if there are any items already in the menu. |
| 548 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 563 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 549 | 564 |
| 550 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP, | 565 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP, |
| 551 IDS_CONTENT_CONTEXT_RELOAD_PACKAGED_APP); | 566 IDS_CONTENT_CONTEXT_RELOAD_PACKAGED_APP); |
| 552 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP, | 567 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP, |
| 553 IDS_CONTENT_CONTEXT_RESTART_APP); | 568 IDS_CONTENT_CONTEXT_RESTART_APP); |
| 554 AppendDeveloperItems(); | 569 AppendDeveloperItems(); |
| 555 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE, | 570 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE, |
| 556 IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE); | 571 IDS_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE); |
| 557 } | 572 } |
| 558 } | 573 } |
| 559 | 574 |
| 560 void RenderViewContextMenu::AppendPopupExtensionItems() { | 575 void RenderViewContextMenu::AppendPopupExtensionItems() { |
| 561 bool has_selection = !params_.selection_text.empty(); | 576 const bool has_selection = !params_.selection_text.empty(); |
| 562 | 577 |
| 563 if (params_.is_editable) | 578 if (params_.is_editable) |
| 564 AppendEditableItems(); | 579 AppendEditableItems(); |
| 565 else if (has_selection) | 580 else if (has_selection) |
| 566 AppendCopyItem(); | 581 AppendCopyItem(); |
| 567 | 582 |
| 568 if (has_selection) | 583 if (has_selection) |
| 569 AppendSearchProvider(); | 584 AppendSearchProvider(); |
| 570 | 585 |
| 571 AppendAllExtensionItems(); | 586 AppendAllExtensionItems(); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 ASCIIToUTF16(" "), ¶ms_.selection_text); | 840 ASCIIToUTF16(" "), ¶ms_.selection_text); |
| 826 | 841 |
| 827 AutocompleteMatch match; | 842 AutocompleteMatch match; |
| 828 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( | 843 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify( |
| 829 params_.selection_text, string16(), false, false, &match, NULL); | 844 params_.selection_text, string16(), false, false, &match, NULL); |
| 830 selection_navigation_url_ = match.destination_url; | 845 selection_navigation_url_ = match.destination_url; |
| 831 if (!selection_navigation_url_.is_valid()) | 846 if (!selection_navigation_url_.is_valid()) |
| 832 return; | 847 return; |
| 833 | 848 |
| 834 string16 printable_selection_text = PrintableSelectionText(); | 849 string16 printable_selection_text = PrintableSelectionText(); |
| 835 EscapeAmpersands(printable_selection_text); | 850 EscapeAmpersands(&printable_selection_text); |
| 836 | 851 |
| 837 if (AutocompleteMatch::IsSearchType(match.type)) { | 852 if (AutocompleteMatch::IsSearchType(match.type)) { |
| 838 const TemplateURL* const default_provider = | 853 const TemplateURL* const default_provider = |
| 839 TemplateURLServiceFactory::GetForProfile(profile_)-> | 854 TemplateURLServiceFactory::GetForProfile(profile_)-> |
| 840 GetDefaultSearchProvider(); | 855 GetDefaultSearchProvider(); |
| 841 if (!default_provider) | 856 if (!default_provider) |
| 842 return; | 857 return; |
| 843 menu_model_.AddItem( | 858 menu_model_.AddItem( |
| 844 IDC_CONTENT_CONTEXT_SEARCHWEBFOR, | 859 IDC_CONTENT_CONTEXT_SEARCHWEBFOR, |
| 845 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_SEARCHWEBFOR, | 860 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_SEARCHWEBFOR, |
| 846 default_provider->short_name(), | 861 default_provider->short_name(), |
| 847 printable_selection_text)); | 862 printable_selection_text)); |
| 848 } else { | 863 } else { |
| 849 if ((selection_navigation_url_ != params_.link_url) && | 864 if ((selection_navigation_url_ != params_.link_url) && |
| 850 ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 865 ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 851 selection_navigation_url_.scheme())) { | 866 selection_navigation_url_.scheme())) { |
| 852 menu_model_.AddItem( | 867 menu_model_.AddItem( |
| 853 IDC_CONTENT_CONTEXT_GOTOURL, | 868 IDC_CONTENT_CONTEXT_GOTOURL, |
| 854 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_GOTOURL, | 869 l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_GOTOURL, |
| 855 printable_selection_text)); | 870 printable_selection_text)); |
| 856 } | 871 } |
| 857 } | 872 } |
| 858 } | 873 } |
| 859 | 874 |
| 860 void RenderViewContextMenu::AppendEditableItems() { | 875 void RenderViewContextMenu::AppendEditableItems() { |
| 861 AppendSpellingSuggestionsSubMenu(); | 876 const bool use_spellcheck_and_search = !chrome::IsRunningInForcedAppMode(); |
| 877 |
| 878 if (use_spellcheck_and_search) |
| 879 AppendSpellingSuggestionsSubMenu(); |
| 862 | 880 |
| 863 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_UNDO, | 881 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_UNDO, |
| 864 IDS_CONTENT_CONTEXT_UNDO); | 882 IDS_CONTENT_CONTEXT_UNDO); |
| 865 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_REDO, | 883 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_REDO, |
| 866 IDS_CONTENT_CONTEXT_REDO); | 884 IDS_CONTENT_CONTEXT_REDO); |
| 867 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 885 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 868 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_CUT, | 886 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_CUT, |
| 869 IDS_CONTENT_CONTEXT_CUT); | 887 IDS_CONTENT_CONTEXT_CUT); |
| 870 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPY, | 888 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPY, |
| 871 IDS_CONTENT_CONTEXT_COPY); | 889 IDS_CONTENT_CONTEXT_COPY); |
| 872 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_PASTE, | 890 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_PASTE, |
| 873 IDS_CONTENT_CONTEXT_PASTE); | 891 IDS_CONTENT_CONTEXT_PASTE); |
| 874 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE, | 892 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE, |
| 875 IDS_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE); | 893 IDS_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE); |
| 876 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_DELETE, | 894 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_DELETE, |
| 877 IDS_CONTENT_CONTEXT_DELETE); | 895 IDS_CONTENT_CONTEXT_DELETE); |
| 878 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 896 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 879 | 897 |
| 880 if (!params_.keyword_url.is_empty()) { | 898 if (use_spellcheck_and_search && !params_.keyword_url.is_empty()) { |
| 881 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ADDSEARCHENGINE, | 899 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_ADDSEARCHENGINE, |
| 882 IDS_CONTENT_CONTEXT_ADDSEARCHENGINE); | 900 IDS_CONTENT_CONTEXT_ADDSEARCHENGINE); |
| 883 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 901 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 884 } | 902 } |
| 885 | 903 |
| 886 AppendSpellcheckOptionsSubMenu(); | 904 if (use_spellcheck_and_search) |
| 905 AppendSpellcheckOptionsSubMenu(); |
| 887 AppendSpeechInputOptionsSubMenu(); | 906 AppendSpeechInputOptionsSubMenu(); |
| 888 AppendPlatformEditableItems(); | 907 AppendPlatformEditableItems(); |
| 889 | 908 |
| 890 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 909 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 891 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SELECTALL, | 910 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SELECTALL, |
| 892 IDS_CONTENT_CONTEXT_SELECTALL); | 911 IDS_CONTENT_CONTEXT_SELECTALL); |
| 893 } | 912 } |
| 894 | 913 |
| 895 void RenderViewContextMenu::AppendSpellingSuggestionsSubMenu() { | 914 void RenderViewContextMenu::AppendSpellingSuggestionsSubMenu() { |
| 896 if (!spelling_menu_observer_.get()) | 915 if (!spelling_menu_observer_.get()) |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1873 source_web_contents_->GetRenderViewHost()-> | 1892 source_web_contents_->GetRenderViewHost()-> |
| 1874 ExecuteMediaPlayerActionAtLocation(location, action); | 1893 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1875 } | 1894 } |
| 1876 | 1895 |
| 1877 void RenderViewContextMenu::PluginActionAt( | 1896 void RenderViewContextMenu::PluginActionAt( |
| 1878 const gfx::Point& location, | 1897 const gfx::Point& location, |
| 1879 const WebPluginAction& action) { | 1898 const WebPluginAction& action) { |
| 1880 source_web_contents_->GetRenderViewHost()-> | 1899 source_web_contents_->GetRenderViewHost()-> |
| 1881 ExecutePluginActionAtLocation(location, action); | 1900 ExecutePluginActionAtLocation(location, action); |
| 1882 } | 1901 } |
| OLD | NEW |