OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_context_menu.h" | 5 #include "chrome/browser/download/download_shelf_context_menu.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/download/download_crx_util.h" | 9 #include "chrome/browser/download/download_crx_util.h" |
10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 bool DownloadShelfContextMenu::GetAcceleratorForCommandId( | 209 bool DownloadShelfContextMenu::GetAcceleratorForCommandId( |
210 int command_id, ui::Accelerator* accelerator) { | 210 int command_id, ui::Accelerator* accelerator) { |
211 return false; | 211 return false; |
212 } | 212 } |
213 | 213 |
214 bool DownloadShelfContextMenu::IsItemForCommandIdDynamic(int command_id) const { | 214 bool DownloadShelfContextMenu::IsItemForCommandIdDynamic(int command_id) const { |
215 return command_id == TOGGLE_PAUSE; | 215 return command_id == TOGGLE_PAUSE; |
216 } | 216 } |
217 | 217 |
218 string16 DownloadShelfContextMenu::GetLabelForCommandId(int command_id) const { | 218 base::string16 DownloadShelfContextMenu::GetLabelForCommandId( |
| 219 int command_id) const { |
219 switch (static_cast<ContextMenuCommands>(command_id)) { | 220 switch (static_cast<ContextMenuCommands>(command_id)) { |
220 case SHOW_IN_FOLDER: | 221 case SHOW_IN_FOLDER: |
221 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_SHOW); | 222 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_SHOW); |
222 case OPEN_WHEN_COMPLETE: | 223 case OPEN_WHEN_COMPLETE: |
223 if (download_item_ && !download_item_->IsDone()) | 224 if (download_item_ && !download_item_->IsDone()) |
224 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE); | 225 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN_WHEN_COMPLETE); |
225 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN); | 226 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_OPEN); |
226 case ALWAYS_OPEN_TYPE: | 227 case ALWAYS_OPEN_TYPE: |
227 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE); | 228 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_ALWAYS_OPEN_TYPE); |
228 case PLATFORM_OPEN: | 229 case PLATFORM_OPEN: |
(...skipping 12 matching lines...) Expand all Loading... |
241 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_REPORT); | 242 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_REPORT); |
242 case KEEP: | 243 case KEEP: |
243 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_KEEP); | 244 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_KEEP); |
244 case LEARN_MORE_SCANNING: | 245 case LEARN_MORE_SCANNING: |
245 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_LEARN_MORE_SCANNING); | 246 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_MENU_LEARN_MORE_SCANNING); |
246 case LEARN_MORE_INTERRUPTED: | 247 case LEARN_MORE_INTERRUPTED: |
247 return l10n_util::GetStringUTF16( | 248 return l10n_util::GetStringUTF16( |
248 IDS_DOWNLOAD_MENU_LEARN_MORE_INTERRUPTED); | 249 IDS_DOWNLOAD_MENU_LEARN_MORE_INTERRUPTED); |
249 } | 250 } |
250 NOTREACHED(); | 251 NOTREACHED(); |
251 return string16(); | 252 return base::string16(); |
252 } | 253 } |
253 | 254 |
254 void DownloadShelfContextMenu::DetachFromDownloadItem() { | 255 void DownloadShelfContextMenu::DetachFromDownloadItem() { |
255 if (!download_item_) | 256 if (!download_item_) |
256 return; | 257 return; |
257 | 258 |
258 download_item_->RemoveObserver(this); | 259 download_item_->RemoveObserver(this); |
259 download_item_ = NULL; | 260 download_item_ = NULL; |
260 } | 261 } |
261 | 262 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 DownloadItemModel download_model(download_item_); | 369 DownloadItemModel download_model(download_item_); |
369 if (download_model.ShouldAllowDownloadFeedback()) { | 370 if (download_model.ShouldAllowDownloadFeedback()) { |
370 malicious_download_menu_model_->AddItemWithStringId( | 371 malicious_download_menu_model_->AddItemWithStringId( |
371 REPORT, IDS_DOWNLOAD_MENU_REPORT); | 372 REPORT, IDS_DOWNLOAD_MENU_REPORT); |
372 } | 373 } |
373 malicious_download_menu_model_->AddItemWithStringId( | 374 malicious_download_menu_model_->AddItemWithStringId( |
374 LEARN_MORE_SCANNING, IDS_DOWNLOAD_MENU_LEARN_MORE_SCANNING); | 375 LEARN_MORE_SCANNING, IDS_DOWNLOAD_MENU_LEARN_MORE_SCANNING); |
375 | 376 |
376 return malicious_download_menu_model_.get(); | 377 return malicious_download_menu_model_.get(); |
377 } | 378 } |
OLD | NEW |