| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "ui/base/l10n/l10n_util.h" | 81 #include "ui/base/l10n/l10n_util.h" |
| 82 #include "ui/base/text/text_elider.h" | 82 #include "ui/base/text/text_elider.h" |
| 83 #include "ui/gfx/favicon_size.h" | 83 #include "ui/gfx/favicon_size.h" |
| 84 #include "webkit/glue/webmenuitem.h" | 84 #include "webkit/glue/webmenuitem.h" |
| 85 | 85 |
| 86 #ifdef FILE_MANAGER_EXTENSION | 86 #ifdef FILE_MANAGER_EXTENSION |
| 87 #include "chrome/browser/extensions/file_manager_util.h" | 87 #include "chrome/browser/extensions/file_manager_util.h" |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 using content::DownloadManager; | 90 using content::DownloadManager; |
| 91 using content::NavigationEntry; |
| 91 using content::OpenURLParams; | 92 using content::OpenURLParams; |
| 92 using content::SSLStatus; | 93 using content::SSLStatus; |
| 93 using content::UserMetricsAction; | 94 using content::UserMetricsAction; |
| 94 using content::WebContents; | 95 using content::WebContents; |
| 95 using WebKit::WebContextMenuData; | 96 using WebKit::WebContextMenuData; |
| 96 using WebKit::WebMediaPlayerAction; | 97 using WebKit::WebMediaPlayerAction; |
| 97 using WebKit::WebURL; | 98 using WebKit::WebURL; |
| 98 using WebKit::WebString; | 99 using WebKit::WebString; |
| 99 | 100 |
| 100 namespace { | 101 namespace { |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 PrefService* local_state = g_browser_process->local_state(); | 1190 PrefService* local_state = g_browser_process->local_state(); |
| 1190 DCHECK(local_state); | 1191 DCHECK(local_state); |
| 1191 // Test if file-selection dialogs are forbidden by policy. | 1192 // Test if file-selection dialogs are forbidden by policy. |
| 1192 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) | 1193 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) |
| 1193 return false; | 1194 return false; |
| 1194 | 1195 |
| 1195 // Instead of using GetURL here, we use url() (which is the "real" url of | 1196 // Instead of using GetURL here, we use url() (which is the "real" url of |
| 1196 // the page) from the NavigationEntry because its reflects their origin | 1197 // the page) from the NavigationEntry because its reflects their origin |
| 1197 // rather than the display one (returned by GetURL) which may be | 1198 // rather than the display one (returned by GetURL) which may be |
| 1198 // different (like having "view-source:" on the front). | 1199 // different (like having "view-source:" on the front). |
| 1199 content::NavigationEntry* active_entry = | 1200 NavigationEntry* active_entry = |
| 1200 source_tab_contents_->GetController().GetActiveEntry(); | 1201 source_tab_contents_->GetController().GetActiveEntry(); |
| 1201 return SavePackage::IsSavableURL( | 1202 return SavePackage::IsSavableURL( |
| 1202 (active_entry) ? active_entry->GetURL() : GURL()); | 1203 (active_entry) ? active_entry->GetURL() : GURL()); |
| 1203 } | 1204 } |
| 1204 | 1205 |
| 1205 case IDC_CONTENT_CONTEXT_RELOADFRAME: | 1206 case IDC_CONTENT_CONTEXT_RELOADFRAME: |
| 1206 return params_.frame_url.is_valid(); | 1207 return params_.frame_url.is_valid(); |
| 1207 | 1208 |
| 1208 case IDC_CONTENT_CONTEXT_UNDO: | 1209 case IDC_CONTENT_CONTEXT_UNDO: |
| 1209 return !!(params_.edit_flags & WebContextMenuData::CanUndo); | 1210 return !!(params_.edit_flags & WebContextMenuData::CanUndo); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 | 1561 |
| 1561 case IDC_VIEW_SOURCE: | 1562 case IDC_VIEW_SOURCE: |
| 1562 source_tab_contents_->ViewSource(); | 1563 source_tab_contents_->ViewSource(); |
| 1563 break; | 1564 break; |
| 1564 | 1565 |
| 1565 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | 1566 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: |
| 1566 Inspect(params_.x, params_.y); | 1567 Inspect(params_.x, params_.y); |
| 1567 break; | 1568 break; |
| 1568 | 1569 |
| 1569 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { | 1570 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { |
| 1570 content::NavigationEntry* nav_entry = | 1571 NavigationEntry* nav_entry = |
| 1571 source_tab_contents_->GetController().GetActiveEntry(); | 1572 source_tab_contents_->GetController().GetActiveEntry(); |
| 1572 source_tab_contents_->ShowPageInfo(nav_entry->GetURL(), | 1573 source_tab_contents_->ShowPageInfo(nav_entry->GetURL(), |
| 1573 nav_entry->GetSSL(), true); | 1574 nav_entry->GetSSL(), true); |
| 1574 break; | 1575 break; |
| 1575 } | 1576 } |
| 1576 | 1577 |
| 1577 case IDC_CONTENT_CONTEXT_TRANSLATE: { | 1578 case IDC_CONTENT_CONTEXT_TRANSLATE: { |
| 1578 // A translation might have been triggered by the time the menu got | 1579 // A translation might have been triggered by the time the menu got |
| 1579 // selected, do nothing in that case. | 1580 // selected, do nothing in that case. |
| 1580 TabContentsWrapper* tab_contents_wrapper = | 1581 TabContentsWrapper* tab_contents_wrapper = |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1868 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 1868 g_browser_process->clipboard()); | 1869 g_browser_process->clipboard()); |
| 1869 } | 1870 } |
| 1870 | 1871 |
| 1871 void RenderViewContextMenu::MediaPlayerActionAt( | 1872 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1872 const gfx::Point& location, | 1873 const gfx::Point& location, |
| 1873 const WebMediaPlayerAction& action) { | 1874 const WebMediaPlayerAction& action) { |
| 1874 source_tab_contents_->GetRenderViewHost()-> | 1875 source_tab_contents_->GetRenderViewHost()-> |
| 1875 ExecuteMediaPlayerActionAtLocation(location, action); | 1876 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1876 } | 1877 } |
| OLD | NEW |