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 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/search_engines/template_url_service_factory.h" | 39 #include "chrome/browser/search_engines/template_url_service_factory.h" |
40 #include "chrome/browser/spellchecker/spellcheck_host.h" | 40 #include "chrome/browser/spellchecker/spellcheck_host.h" |
41 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 41 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
42 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 42 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
43 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 43 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
44 #include "chrome/browser/translate/translate_manager.h" | 44 #include "chrome/browser/translate/translate_manager.h" |
45 #include "chrome/browser/translate/translate_prefs.h" | 45 #include "chrome/browser/translate/translate_prefs.h" |
46 #include "chrome/browser/translate/translate_tab_helper.h" | 46 #include "chrome/browser/translate/translate_tab_helper.h" |
47 #include "chrome/browser/ui/browser.h" | 47 #include "chrome/browser/ui/browser.h" |
48 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 48 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 49 #include "chrome/browser/ui/tab_contents/per_tab_prefs_tab_helper.h" |
49 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 50 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
50 #include "chrome/common/chrome_constants.h" | 51 #include "chrome/common/chrome_constants.h" |
51 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
52 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
53 #include "chrome/common/print_messages.h" | 54 #include "chrome/common/print_messages.h" |
54 #include "chrome/common/spellcheck_messages.h" | 55 #include "chrome/common/spellcheck_messages.h" |
55 #include "chrome/common/url_constants.h" | 56 #include "chrome/common/url_constants.h" |
56 #include "content/browser/child_process_security_policy.h" | 57 #include "content/browser/child_process_security_policy.h" |
57 #include "content/browser/download/download_manager.h" | 58 #include "content/browser/download/download_manager.h" |
58 #include "content/browser/download/download_stats.h" | 59 #include "content/browser/download/download_stats.h" |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 view->ShowingContextMenu(false); | 1766 view->ShowingContextMenu(false); |
1766 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1767 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
1767 if (rvh) { | 1768 if (rvh) { |
1768 rvh->NotifyContextMenuClosed(params_.custom_context); | 1769 rvh->NotifyContextMenuClosed(params_.custom_context); |
1769 } | 1770 } |
1770 } | 1771 } |
1771 | 1772 |
1772 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { | 1773 bool RenderViewContextMenu::IsDevCommandEnabled(int id) const { |
1773 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { | 1774 if (id == IDC_CONTENT_CONTEXT_INSPECTELEMENT) { |
1774 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1775 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 1776 TabContentsWrapper* tab_contents_wrapper = |
| 1777 TabContentsWrapper::GetCurrentWrapperForContents( |
| 1778 source_tab_contents_); |
| 1779 if (!tab_contents_wrapper) |
| 1780 return false; |
1775 // Don't enable the web inspector if JavaScript is disabled. | 1781 // Don't enable the web inspector if JavaScript is disabled. |
1776 if (!profile_->GetPrefs()->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 1782 if (!tab_contents_wrapper->per_tab_prefs_tab_helper()->prefs()->GetBoolean( |
| 1783 prefs::kWebKitJavascriptEnabled) || |
1777 command_line.HasSwitch(switches::kDisableJavaScript)) | 1784 command_line.HasSwitch(switches::kDisableJavaScript)) |
1778 return false; | 1785 return false; |
1779 // Don't enable the web inspector if the developer tools are disabled via | 1786 // Don't enable the web inspector if the developer tools are disabled via |
1780 // the preference dev-tools-disabled. | 1787 // the preference dev-tools-disabled. |
1781 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 1788 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
1782 return false; | 1789 return false; |
1783 } | 1790 } |
1784 | 1791 |
1785 return true; | 1792 return true; |
1786 } | 1793 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1836 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
1830 g_browser_process->clipboard()); | 1837 g_browser_process->clipboard()); |
1831 } | 1838 } |
1832 | 1839 |
1833 void RenderViewContextMenu::MediaPlayerActionAt( | 1840 void RenderViewContextMenu::MediaPlayerActionAt( |
1834 const gfx::Point& location, | 1841 const gfx::Point& location, |
1835 const WebMediaPlayerAction& action) { | 1842 const WebMediaPlayerAction& action) { |
1836 source_tab_contents_->render_view_host()-> | 1843 source_tab_contents_->render_view_host()-> |
1837 ExecuteMediaPlayerActionAtLocation(location, action); | 1844 ExecuteMediaPlayerActionAtLocation(location, action); |
1838 } | 1845 } |
OLD | NEW |