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 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/printing/print_preview_context_menu_observer.h" | 33 #include "chrome/browser/printing/print_preview_context_menu_observer.h" |
34 #include "chrome/browser/printing/print_preview_tab_controller.h" | 34 #include "chrome/browser/printing/print_preview_tab_controller.h" |
35 #include "chrome/browser/printing/print_view_manager.h" | 35 #include "chrome/browser/printing/print_view_manager.h" |
36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/profiles/profile_io_data.h" | 37 #include "chrome/browser/profiles/profile_io_data.h" |
38 #include "chrome/browser/search_engines/template_url.h" | 38 #include "chrome/browser/search_engines/template_url.h" |
39 #include "chrome/browser/search_engines/template_url_service.h" | 39 #include "chrome/browser/search_engines/template_url_service.h" |
40 #include "chrome/browser/search_engines/template_url_service_factory.h" | 40 #include "chrome/browser/search_engines/template_url_service_factory.h" |
41 #include "chrome/browser/spellchecker/spellcheck_host.h" | 41 #include "chrome/browser/spellchecker/spellcheck_host.h" |
42 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 42 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
| 43 #include "chrome/browser/tab_contents/retargeting_details.h" |
43 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" | 44 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
44 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 45 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
45 #include "chrome/browser/translate/translate_manager.h" | 46 #include "chrome/browser/translate/translate_manager.h" |
46 #include "chrome/browser/translate/translate_prefs.h" | 47 #include "chrome/browser/translate/translate_prefs.h" |
47 #include "chrome/browser/translate/translate_tab_helper.h" | 48 #include "chrome/browser/translate/translate_tab_helper.h" |
48 #include "chrome/browser/ui/browser.h" | 49 #include "chrome/browser/ui/browser.h" |
49 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 50 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
50 #include "chrome/browser/ui/tab_contents/per_tab_prefs_tab_helper.h" | 51 #include "chrome/browser/ui/tab_contents/per_tab_prefs_tab_helper.h" |
51 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 52 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
52 #include "chrome/common/chrome_constants.h" | 53 #include "chrome/common/chrome_constants.h" |
| 54 #include "chrome/common/chrome_notification_types.h" |
53 #include "chrome/common/chrome_switches.h" | 55 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
55 #include "chrome/common/print_messages.h" | 57 #include "chrome/common/print_messages.h" |
56 #include "chrome/common/spellcheck_messages.h" | 58 #include "chrome/common/spellcheck_messages.h" |
57 #include "chrome/common/url_constants.h" | 59 #include "chrome/common/url_constants.h" |
58 #include "content/browser/child_process_security_policy.h" | 60 #include "content/browser/child_process_security_policy.h" |
59 #include "content/browser/download/download_manager.h" | 61 #include "content/browser/download/download_manager.h" |
60 #include "content/browser/download/download_stats.h" | 62 #include "content/browser/download/download_stats.h" |
61 #include "content/browser/download/save_package.h" | 63 #include "content/browser/download/save_package.h" |
62 #include "content/browser/renderer_host/render_view_host.h" | 64 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 | 1812 |
1811 void RenderViewContextMenu::OpenURL( | 1813 void RenderViewContextMenu::OpenURL( |
1812 const GURL& url, const GURL& referrer, int64 frame_id, | 1814 const GURL& url, const GURL& referrer, int64 frame_id, |
1813 WindowOpenDisposition disposition, | 1815 WindowOpenDisposition disposition, |
1814 content::PageTransition transition) { | 1816 content::PageTransition transition) { |
1815 TabContents* new_contents = source_tab_contents_->OpenURL(OpenURLParams( | 1817 TabContents* new_contents = source_tab_contents_->OpenURL(OpenURLParams( |
1816 url, content::Referrer(referrer, params_.referrer_policy), disposition, | 1818 url, content::Referrer(referrer, params_.referrer_policy), disposition, |
1817 transition, false)); | 1819 transition, false)); |
1818 | 1820 |
1819 if (new_contents) { | 1821 if (new_contents) { |
1820 content::RetargetingDetails details; | 1822 RetargetingDetails details; |
1821 details.source_tab_contents = source_tab_contents_; | 1823 details.source_tab_contents = source_tab_contents_; |
1822 details.source_frame_id = frame_id; | 1824 details.source_frame_id = frame_id; |
1823 details.target_url = url; | 1825 details.target_url = url; |
1824 details.target_tab_contents = new_contents; | 1826 details.target_tab_contents = new_contents; |
| 1827 details.not_yet_in_tabstrip = false; |
1825 content::NotificationService::current()->Notify( | 1828 content::NotificationService::current()->Notify( |
1826 content::NOTIFICATION_RETARGETING, | 1829 chrome::NOTIFICATION_RETARGETING, |
1827 content::Source<content::BrowserContext>( | 1830 content::Source<Profile>(Profile::FromBrowserContext( |
1828 source_tab_contents_->browser_context()), | 1831 source_tab_contents_->browser_context())), |
1829 content::Details<content::RetargetingDetails>(&details)); | 1832 content::Details<RetargetingDetails>(&details)); |
1830 } | 1833 } |
1831 } | 1834 } |
1832 | 1835 |
1833 void RenderViewContextMenu::CopyImageAt(int x, int y) { | 1836 void RenderViewContextMenu::CopyImageAt(int x, int y) { |
1834 source_tab_contents_->render_view_host()->CopyImageAt(x, y); | 1837 source_tab_contents_->render_view_host()->CopyImageAt(x, y); |
1835 } | 1838 } |
1836 | 1839 |
1837 void RenderViewContextMenu::Inspect(int x, int y) { | 1840 void RenderViewContextMenu::Inspect(int x, int y) { |
1838 UserMetrics::RecordAction(UserMetricsAction("DevTools_InspectElement")); | 1841 UserMetrics::RecordAction(UserMetricsAction("DevTools_InspectElement")); |
1839 DevToolsWindow::InspectElement( | 1842 DevToolsWindow::InspectElement( |
1840 source_tab_contents_->render_view_host(), x, y); | 1843 source_tab_contents_->render_view_host(), x, y); |
1841 } | 1844 } |
1842 | 1845 |
1843 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { | 1846 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { |
1844 chrome_browser_net::WriteURLToClipboard( | 1847 chrome_browser_net::WriteURLToClipboard( |
1845 url, | 1848 url, |
1846 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1849 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
1847 g_browser_process->clipboard()); | 1850 g_browser_process->clipboard()); |
1848 } | 1851 } |
1849 | 1852 |
1850 void RenderViewContextMenu::MediaPlayerActionAt( | 1853 void RenderViewContextMenu::MediaPlayerActionAt( |
1851 const gfx::Point& location, | 1854 const gfx::Point& location, |
1852 const WebMediaPlayerAction& action) { | 1855 const WebMediaPlayerAction& action) { |
1853 source_tab_contents_->render_view_host()-> | 1856 source_tab_contents_->render_view_host()-> |
1854 ExecuteMediaPlayerActionAtLocation(location, action); | 1857 ExecuteMediaPlayerActionAtLocation(location, action); |
1855 } | 1858 } |
OLD | NEW |