| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/download/download_commands.h" | 5 #include "chrome/browser/download/download_commands.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "net/base/url_util.h" | 30 #include "net/base/url_util.h" |
| 31 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 31 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 33 | 33 |
| 34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 35 #include "chrome/browser/download/download_target_determiner.h" | 35 #include "chrome/browser/download/download_target_determiner.h" |
| 36 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" | 36 #include "chrome/browser/ui/pdf/adobe_reader_info_win.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 40 #include "chrome/browser/chromeos/note_taking_app_utils.h" | 40 #include "chrome/browser/chromeos/note_taking_helper.h" |
| 41 #endif // defined(OS_CHROMEOS) | 41 #endif // defined(OS_CHROMEOS) |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 // Maximum size (compressed) of image to be copied to the clipboard. If the | 45 // Maximum size (compressed) of image to be copied to the clipboard. If the |
| 46 // image exceeds this size, the image is not copied. | 46 // image exceeds this size, the image is not copied. |
| 47 const int64_t kMaxImageClipboardSize = 20 * 1024 * 1024; // 20 MB | 47 const int64_t kMaxImageClipboardSize = 20 * 1024 * 1024; // 20 MB |
| 48 | 48 |
| 49 class ImageClipboardCopyManager : public ImageDecoder::ImageRequest { | 49 class ImageClipboardCopyManager : public ImageDecoder::ImageRequest { |
| 50 public: | 50 public: |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 break; | 350 break; |
| 351 case RESUME: | 351 case RESUME: |
| 352 download_item_->Resume(); | 352 download_item_->Resume(); |
| 353 break; | 353 break; |
| 354 case COPY_TO_CLIPBOARD: | 354 case COPY_TO_CLIPBOARD: |
| 355 CopyFileAsImageToClipboard(); | 355 CopyFileAsImageToClipboard(); |
| 356 break; | 356 break; |
| 357 case ANNOTATE: | 357 case ANNOTATE: |
| 358 #if defined(OS_CHROMEOS) | 358 #if defined(OS_CHROMEOS) |
| 359 if (DownloadItemModel(download_item_).HasSupportedImageMimeType()) { | 359 if (DownloadItemModel(download_item_).HasSupportedImageMimeType()) { |
| 360 chromeos::LaunchNoteTakingAppForNewNote( | 360 chromeos::NoteTakingHelper::Get()->LaunchAppForNewNote( |
| 361 Profile::FromBrowserContext(download_item_->GetBrowserContext()), | 361 Profile::FromBrowserContext(download_item_->GetBrowserContext()), |
| 362 download_item_->GetTargetFilePath()); | 362 download_item_->GetTargetFilePath()); |
| 363 } | 363 } |
| 364 #endif // defined(OS_CHROMEOS) | 364 #endif // defined(OS_CHROMEOS) |
| 365 break; | 365 break; |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 Browser* DownloadCommands::GetBrowser() const { | 369 Browser* DownloadCommands::GetBrowser() const { |
| 370 Profile* profile = | 370 Profile* profile = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 401 download_item_->GetReceivedBytes() > kMaxImageClipboardSize) { | 401 download_item_->GetReceivedBytes() > kMaxImageClipboardSize) { |
| 402 return; | 402 return; |
| 403 } | 403 } |
| 404 | 404 |
| 405 if (!DownloadItemModel(download_item_).HasSupportedImageMimeType()) | 405 if (!DownloadItemModel(download_item_).HasSupportedImageMimeType()) |
| 406 return; | 406 return; |
| 407 | 407 |
| 408 base::FilePath file_path = download_item_->GetFullPath(); | 408 base::FilePath file_path = download_item_->GetFullPath(); |
| 409 ImageClipboardCopyManager::Start(file_path); | 409 ImageClipboardCopyManager::Start(file_path); |
| 410 } | 410 } |
| OLD | NEW |