| 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 "chrome/browser/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_clipboard_writer.h" | 9 #include "base/scoped_clipboard_writer.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // TODO(paulg): Prompt the user for file name when saving links and images. | 368 // TODO(paulg): Prompt the user for file name when saving links and images. |
| 369 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: | 369 case IDS_CONTENT_CONTEXT_SAVEIMAGEAS: |
| 370 case IDS_CONTENT_CONTEXT_SAVELINKAS: { | 370 case IDS_CONTENT_CONTEXT_SAVELINKAS: { |
| 371 const GURL& referrer = | 371 const GURL& referrer = |
| 372 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 372 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 373 const GURL& url = | 373 const GURL& url = |
| 374 (id == IDS_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : | 374 (id == IDS_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : |
| 375 params_.image_url); | 375 params_.image_url); |
| 376 DownloadManager* dlm = | 376 DownloadManager* dlm = |
| 377 source_web_contents_->profile()->GetDownloadManager(); | 377 source_web_contents_->profile()->GetDownloadManager(); |
| 378 dlm->DownloadUrl(url, referrer, source_web_contents_); | 378 dlm->DownloadUrl(url, referrer, params_.frame_charset, |
| 379 source_web_contents_); |
| 379 break; | 380 break; |
| 380 } | 381 } |
| 381 | 382 |
| 382 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION: | 383 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION: |
| 383 WriteURLToClipboard(params_.unfiltered_link_url); | 384 WriteURLToClipboard(params_.unfiltered_link_url); |
| 384 break; | 385 break; |
| 385 | 386 |
| 386 case IDS_CONTENT_CONTEXT_COPYIMAGELOCATION: | 387 case IDS_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| 387 WriteURLToClipboard(params_.image_url); | 388 WriteURLToClipboard(params_.image_url); |
| 388 break; | 389 break; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 ScopedClipboardWriter scw(clipboard); | 655 ScopedClipboardWriter scw(clipboard); |
| 655 scw.WriteText(text); | 656 scw.WriteText(text); |
| 656 } | 657 } |
| 657 | 658 |
| 658 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { | 659 void RenderViewContextMenu::WriteURLToClipboard(const GURL& url) { |
| 659 if (url.SchemeIs(chrome::kMailToScheme)) | 660 if (url.SchemeIs(chrome::kMailToScheme)) |
| 660 WriteTextToClipboard(UTF8ToUTF16(url.path())); | 661 WriteTextToClipboard(UTF8ToUTF16(url.path())); |
| 661 else | 662 else |
| 662 WriteTextToClipboard(UTF8ToUTF16(url.spec())); | 663 WriteTextToClipboard(UTF8ToUTF16(url.spec())); |
| 663 } | 664 } |
| OLD | NEW |