Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: chrome/browser/download/download_shelf.cc

Issue 337042: Revert 30168 - Commit patch set from http://codereview.chromium.org/149796... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/dom_ui/downloads_ui.h" 10 #include "chrome/browser/dom_ui/downloads_ui.h"
(...skipping 14 matching lines...) Expand all
25 25
26 DownloadShelfContextMenu::~DownloadShelfContextMenu() { 26 DownloadShelfContextMenu::~DownloadShelfContextMenu() {
27 } 27 }
28 28
29 bool DownloadShelfContextMenu::ItemIsChecked(int id) const { 29 bool DownloadShelfContextMenu::ItemIsChecked(int id) const {
30 switch (id) { 30 switch (id) {
31 case OPEN_WHEN_COMPLETE: { 31 case OPEN_WHEN_COMPLETE: {
32 return download_->open_when_complete(); 32 return download_->open_when_complete();
33 } 33 }
34 case ALWAYS_OPEN_TYPE: { 34 case ALWAYS_OPEN_TYPE: {
35 return download_->manager()->ShouldOpenFileBasedOnExtension( 35 const FilePath::StringType extension =
36 download_->full_path()); 36 file_util::GetFileExtensionFromPath(download_->full_path());
37 return download_->manager()->ShouldOpenFileExtension(extension);
37 } 38 }
38 case TOGGLE_PAUSE: { 39 case TOGGLE_PAUSE: {
39 return download_->is_paused(); 40 return download_->is_paused();
40 } 41 }
41 } 42 }
42 return false; 43 return false;
43 } 44 }
44 45
45 bool DownloadShelfContextMenu::ItemIsDefault(int id) const { 46 bool DownloadShelfContextMenu::ItemIsDefault(int id) const {
46 return id == OPEN_WHEN_COMPLETE; 47 return id == OPEN_WHEN_COMPLETE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 void DownloadShelfContextMenu::ExecuteItemCommand(int id) { 90 void DownloadShelfContextMenu::ExecuteItemCommand(int id) {
90 switch (id) { 91 switch (id) {
91 case SHOW_IN_FOLDER: 92 case SHOW_IN_FOLDER:
92 download_->manager()->ShowDownloadInShell(download_); 93 download_->manager()->ShowDownloadInShell(download_);
93 break; 94 break;
94 case OPEN_WHEN_COMPLETE: 95 case OPEN_WHEN_COMPLETE:
95 download_util::OpenDownload(download_); 96 download_util::OpenDownload(download_);
96 break; 97 break;
97 case ALWAYS_OPEN_TYPE: { 98 case ALWAYS_OPEN_TYPE: {
98 download_->manager()->OpenFilesBasedOnExtension( 99 const FilePath::StringType extension =
99 download_->full_path(), !ItemIsChecked(ALWAYS_OPEN_TYPE)); 100 file_util::GetFileExtensionFromPath(download_->full_path());
101 download_->manager()->OpenFilesOfExtension(
102 extension, !ItemIsChecked(ALWAYS_OPEN_TYPE));
100 break; 103 break;
101 } 104 }
102 case CANCEL: 105 case CANCEL:
103 model_->CancelTask(); 106 model_->CancelTask();
104 break; 107 break;
105 case TOGGLE_PAUSE: 108 case TOGGLE_PAUSE:
106 // It is possible for the download to complete before the user clicks the 109 // It is possible for the download to complete before the user clicks the
107 // menu item, recheck if the download is in progress state before toggling 110 // menu item, recheck if the download is in progress state before toggling
108 // pause. 111 // pause.
109 if (download_->state() == DownloadItem::IN_PROGRESS) 112 if (download_->state() == DownloadItem::IN_PROGRESS)
110 download_->TogglePause(); 113 download_->TogglePause();
111 break; 114 break;
112 default: 115 default:
113 NOTREACHED(); 116 NOTREACHED();
114 } 117 }
115 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698