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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // exclude extensions. | 184 // exclude extensions. |
185 return download_item_->CanOpenDownload() && | 185 return download_item_->CanOpenDownload() && |
186 safe_browsing::FileTypePolicies::GetInstance() | 186 safe_browsing::FileTypePolicies::GetInstance() |
187 ->IsAllowedToOpenAutomatically( | 187 ->IsAllowedToOpenAutomatically( |
188 download_item_->GetTargetFilePath()) && | 188 download_item_->GetTargetFilePath()) && |
189 !download_crx_util::IsExtensionDownload(*download_item_); | 189 !download_crx_util::IsExtensionDownload(*download_item_); |
190 case CANCEL: | 190 case CANCEL: |
191 return !download_item_->IsDone(); | 191 return !download_item_->IsDone(); |
192 case PAUSE: | 192 case PAUSE: |
193 return !download_item_->IsDone() && !download_item_->IsPaused() && | 193 return !download_item_->IsDone() && !download_item_->IsPaused() && |
| 194 !download_item_->IsSavePackageDownload() && |
194 download_item_->GetState() == content::DownloadItem::IN_PROGRESS; | 195 download_item_->GetState() == content::DownloadItem::IN_PROGRESS; |
195 case RESUME: | 196 case RESUME: |
196 return download_item_->CanResume() && | 197 return download_item_->CanResume() && |
197 (download_item_->IsPaused() || | 198 (download_item_->IsPaused() || |
198 download_item_->GetState() != content::DownloadItem::IN_PROGRESS); | 199 download_item_->GetState() != content::DownloadItem::IN_PROGRESS); |
199 case COPY_TO_CLIPBOARD: | 200 case COPY_TO_CLIPBOARD: |
200 return (download_item_->GetState() == content::DownloadItem::COMPLETE && | 201 return (download_item_->GetState() == content::DownloadItem::COMPLETE && |
201 download_item_->GetReceivedBytes() <= kMaxImageClipboardSize); | 202 download_item_->GetReceivedBytes() <= kMaxImageClipboardSize); |
202 case ANNOTATE: | 203 case ANNOTATE: |
203 return download_item_->GetState() == content::DownloadItem::COMPLETE; | 204 return download_item_->GetState() == content::DownloadItem::COMPLETE; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 download_item_->GetReceivedBytes() > kMaxImageClipboardSize) { | 402 download_item_->GetReceivedBytes() > kMaxImageClipboardSize) { |
402 return; | 403 return; |
403 } | 404 } |
404 | 405 |
405 if (!DownloadItemModel(download_item_).HasSupportedImageMimeType()) | 406 if (!DownloadItemModel(download_item_).HasSupportedImageMimeType()) |
406 return; | 407 return; |
407 | 408 |
408 base::FilePath file_path = download_item_->GetFullPath(); | 409 base::FilePath file_path = download_item_->GetFullPath(); |
409 ImageClipboardCopyManager::Start(file_path); | 410 ImageClipboardCopyManager::Start(file_path); |
410 } | 411 } |
OLD | NEW |