OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" | 7 #include "chrome/browser/tab_contents/render_view_context_menu_controller.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 296 |
297 case IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: | 297 case IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: |
298 OpenURL(params_.link_url, OFF_THE_RECORD, PageTransition::LINK); | 298 OpenURL(params_.link_url, OFF_THE_RECORD, PageTransition::LINK); |
299 break; | 299 break; |
300 | 300 |
301 // TODO(paulg): Prompt the user for file name when saving links and images. | 301 // TODO(paulg): Prompt the user for file name when saving links and images. |
302 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: | 302 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: |
303 case IDS_CONTENT_CONTEXT_SAVELINKAS: { | 303 case IDS_CONTENT_CONTEXT_SAVELINKAS: { |
304 const GURL& referrer = | 304 const GURL& referrer = |
305 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 305 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
306 const GURL& url = id == IDS_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url
: | 306 const GURL& url = |
307 params_.image_url
; | 307 (id == IDS_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : |
| 308 params_.image_url); |
308 DownloadManager* dlm = | 309 DownloadManager* dlm = |
309 source_web_contents_->profile()->GetDownloadManager(); | 310 source_web_contents_->profile()->GetDownloadManager(); |
310 dlm->DownloadUrl(url, referrer, source_web_contents_); | 311 dlm->DownloadUrl(url, referrer, source_web_contents_); |
311 break; | 312 break; |
312 } | 313 } |
313 | 314 |
314 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION: | 315 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION: |
315 WriteURLToClipboard(params_.link_url); | 316 WriteURLToClipboard(params_.link_url); |
316 break; | 317 break; |
317 | 318 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // Don't enable the web inspector if JavaScript is disabled | 538 // Don't enable the web inspector if JavaScript is disabled |
538 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { | 539 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { |
539 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); | 540 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); |
540 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || | 541 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || |
541 command_line.HasSwitch(switches::kDisableJavaScript)) | 542 command_line.HasSwitch(switches::kDisableJavaScript)) |
542 return false; | 543 return false; |
543 } | 544 } |
544 | 545 |
545 return true; | 546 return true; |
546 } | 547 } |
OLD | NEW |