| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_shelf.h" | 5 #include "chrome/browser/download/download_shelf.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/browser/dom_ui/downloads_ui.h" | 9 #include "chrome/browser/dom_ui/downloads_ui.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 default: | 79 default: |
| 80 NOTREACHED(); | 80 NOTREACHED(); |
| 81 } | 81 } |
| 82 return std::wstring(); | 82 return std::wstring(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const { | 85 bool DownloadShelfContextMenu::IsItemCommandEnabled(int id) const { |
| 86 switch (id) { | 86 switch (id) { |
| 87 case SHOW_IN_FOLDER: | 87 case SHOW_IN_FOLDER: |
| 88 case OPEN_WHEN_COMPLETE: | 88 case OPEN_WHEN_COMPLETE: |
| 89 return download_->state() != DownloadItem::CANCELLED; | 89 return download_->state() != DownloadItem::CANCELLED && |
| 90 file_util::PathExists(download_->full_path()); |
| 90 case ALWAYS_OPEN_TYPE: | 91 case ALWAYS_OPEN_TYPE: |
| 91 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
| 92 return download_util::CanOpenDownload(download_); | 93 return download_util::CanOpenDownload(download_); |
| 93 #elif defined(OS_LINUX) | 94 #elif defined(OS_LINUX) |
| 94 // Need to implement dangerous download stuff: http://crbug.com/11780 | 95 // Need to implement dangerous download stuff: http://crbug.com/11780 |
| 95 return false; | 96 return false; |
| 96 #endif | 97 #endif |
| 97 case CANCEL: | 98 case CANCEL: |
| 98 return download_->state() == DownloadItem::IN_PROGRESS; | 99 return download_->state() == DownloadItem::IN_PROGRESS; |
| 99 default: | 100 default: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); | 122 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE)); |
| 122 break; | 123 break; |
| 123 } | 124 } |
| 124 case CANCEL: | 125 case CANCEL: |
| 125 model_->CancelTask(); | 126 model_->CancelTask(); |
| 126 break; | 127 break; |
| 127 default: | 128 default: |
| 128 NOTREACHED(); | 129 NOTREACHED(); |
| 129 } | 130 } |
| 130 } | 131 } |
| OLD | NEW |