Chromium Code Reviews| 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 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1183 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: | 1183 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| 1184 return params_.src_url.is_valid(); | 1184 return params_.src_url.is_valid(); |
| 1185 | 1185 |
| 1186 case IDC_CONTENT_CONTEXT_SAVEAVAS: { | 1186 case IDC_CONTENT_CONTEXT_SAVEAVAS: { |
| 1187 PrefService* local_state = g_browser_process->local_state(); | 1187 PrefService* local_state = g_browser_process->local_state(); |
| 1188 DCHECK(local_state); | 1188 DCHECK(local_state); |
| 1189 // Test if file-selection dialogs are forbidden by policy. | 1189 // Test if file-selection dialogs are forbidden by policy. |
| 1190 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) | 1190 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) |
| 1191 return false; | 1191 return false; |
| 1192 | 1192 |
| 1193 return (params_.media_flags & | 1193 const GURL& url = params_.src_url; |
| 1194 WebContextMenuData::MediaCanSave) && | 1194 return (params_.media_flags & WebContextMenuData::MediaCanSave) && |
| 1195 params_.src_url.is_valid() && | 1195 url.is_valid() && ProfileIOData::IsHandledProtocol(url.scheme()) && |
| 1196 ProfileIOData::IsHandledProtocol(params_.src_url.scheme()); | 1196 // Do not save the preview PDF on the print preview page. |
| 1197 !(url.SchemeIs(chrome::kChromeUIScheme) && | |
|
brettw
2011/09/16 05:19:14
This code is getting a bit crazy. Can you make a l
Lei Zhang
2011/09/16 20:00:50
Done.
| |
| 1198 url.host() == chrome::kChromeUIPrintHost); | |
| 1197 } | 1199 } |
| 1198 | 1200 |
| 1199 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: | 1201 case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: |
| 1200 return true; | 1202 return true; |
| 1201 | 1203 |
| 1202 case IDC_SAVE_PAGE: { | 1204 case IDC_SAVE_PAGE: { |
| 1203 PrefService* local_state = g_browser_process->local_state(); | 1205 PrefService* local_state = g_browser_process->local_state(); |
| 1204 DCHECK(local_state); | 1206 DCHECK(local_state); |
| 1205 // Test if file-selection dialogs are forbidden by policy. | 1207 // Test if file-selection dialogs are forbidden by policy. |
| 1206 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) | 1208 if (!local_state->GetBoolean(prefs::kAllowFileSelectionDialogs)) |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1940 g_browser_process->clipboard()); | 1942 g_browser_process->clipboard()); |
| 1941 } | 1943 } |
| 1942 | 1944 |
| 1943 void RenderViewContextMenu::MediaPlayerActionAt( | 1945 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1944 const gfx::Point& location, | 1946 const gfx::Point& location, |
| 1945 const WebMediaPlayerAction& action) { | 1947 const WebMediaPlayerAction& action) { |
| 1946 RenderViewHost* rvh = source_tab_contents_->render_view_host(); | 1948 RenderViewHost* rvh = source_tab_contents_->render_view_host(); |
| 1947 rvh->Send(new ViewMsg_MediaPlayerActionAt( | 1949 rvh->Send(new ViewMsg_MediaPlayerActionAt( |
| 1948 rvh->routing_id(), location, action)); | 1950 rvh->routing_id(), location, action)); |
| 1949 } | 1951 } |
| OLD | NEW |