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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "content/browser/tab_contents/navigation_entry.h" | 58 #include "content/browser/tab_contents/navigation_entry.h" |
59 #include "content/browser/tab_contents/tab_contents.h" | 59 #include "content/browser/tab_contents/tab_contents.h" |
60 #include "content/browser/user_metrics.h" | 60 #include "content/browser/user_metrics.h" |
61 #include "content/common/content_restriction.h" | 61 #include "content/common/content_restriction.h" |
62 #include "content/common/view_messages.h" | 62 #include "content/common/view_messages.h" |
63 #include "grit/generated_resources.h" | 63 #include "grit/generated_resources.h" |
64 #include "net/base/escape.h" | 64 #include "net/base/escape.h" |
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" | 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.
h" |
67 #include "ui/base/l10n/l10n_util.h" | 67 #include "ui/base/l10n/l10n_util.h" |
| 68 #include "ui/base/text/text_elider.h" |
68 #include "ui/gfx/favicon_size.h" | 69 #include "ui/gfx/favicon_size.h" |
69 #include "webkit/glue/webmenuitem.h" | 70 #include "webkit/glue/webmenuitem.h" |
70 | 71 |
71 using WebKit::WebContextMenuData; | 72 using WebKit::WebContextMenuData; |
72 using WebKit::WebMediaPlayerAction; | 73 using WebKit::WebMediaPlayerAction; |
73 using WebKit::WebURL; | 74 using WebKit::WebURL; |
74 using WebKit::WebString; | 75 using WebKit::WebString; |
75 | 76 |
76 namespace { | 77 namespace { |
77 | 78 |
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 // Don't enable the web inspector if the developer tools are disabled via | 1782 // Don't enable the web inspector if the developer tools are disabled via |
1782 // the preference dev-tools-disabled. | 1783 // the preference dev-tools-disabled. |
1783 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 1784 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
1784 return false; | 1785 return false; |
1785 } | 1786 } |
1786 | 1787 |
1787 return true; | 1788 return true; |
1788 } | 1789 } |
1789 | 1790 |
1790 string16 RenderViewContextMenu::PrintableSelectionText() { | 1791 string16 RenderViewContextMenu::PrintableSelectionText() { |
1791 return l10n_util::TruncateString(params_.selection_text, | 1792 return ui::TruncateString(params_.selection_text, |
1792 kMaxSelectionTextLength); | 1793 kMaxSelectionTextLength); |
1793 } | 1794 } |
1794 | 1795 |
1795 // Controller functions -------------------------------------------------------- | 1796 // Controller functions -------------------------------------------------------- |
1796 | 1797 |
1797 void RenderViewContextMenu::OpenURL( | 1798 void RenderViewContextMenu::OpenURL( |
1798 const GURL& url, const GURL& referrer, int64 frame_id, | 1799 const GURL& url, const GURL& referrer, int64 frame_id, |
1799 WindowOpenDisposition disposition, | 1800 WindowOpenDisposition disposition, |
1800 PageTransition::Type transition) { | 1801 PageTransition::Type transition) { |
1801 TabContents* new_contents = | 1802 TabContents* new_contents = |
1802 source_tab_contents_->OpenURL(url, referrer, disposition, transition); | 1803 source_tab_contents_->OpenURL(url, referrer, disposition, transition); |
(...skipping 30 matching lines...) Expand all Loading... |
1833 g_browser_process->clipboard()); | 1834 g_browser_process->clipboard()); |
1834 } | 1835 } |
1835 | 1836 |
1836 void RenderViewContextMenu::MediaPlayerActionAt( | 1837 void RenderViewContextMenu::MediaPlayerActionAt( |
1837 const gfx::Point& location, | 1838 const gfx::Point& location, |
1838 const WebMediaPlayerAction& action) { | 1839 const WebMediaPlayerAction& action) { |
1839 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1840 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
1840 rvh->Send(new ViewMsg_MediaPlayerActionAt( | 1841 rvh->Send(new ViewMsg_MediaPlayerActionAt( |
1841 rvh->routing_id(), location, action)); | 1842 rvh->routing_id(), location, action)); |
1842 } | 1843 } |
OLD | NEW |