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

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

Issue 149692: Fix auto-opening file types not auto-opening.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 months 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 | « no previous file | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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_manager.h" 5 #include "chrome/browser/download/download_manager.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 "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 // If this was a dangerous download, it has now been approved and must be 826 // If this was a dangerous download, it has now been approved and must be
827 // removed from dangerous_finished_ so it does not get deleted on shutdown. 827 // removed from dangerous_finished_ so it does not get deleted on shutdown.
828 DownloadMap::iterator it = dangerous_finished_.find(download->id()); 828 DownloadMap::iterator it = dangerous_finished_.find(download->id());
829 if (it != dangerous_finished_.end()) 829 if (it != dangerous_finished_.end())
830 dangerous_finished_.erase(it); 830 dangerous_finished_.erase(it);
831 831
832 // Notify our observers that we are complete (the call to Finished() set the 832 // Notify our observers that we are complete (the call to Finished() set the
833 // state to complete but did not notify). 833 // state to complete but did not notify).
834 download->UpdateObservers(); 834 download->UpdateObservers();
835 835
836 // Open the download if the user or user prefs indicate it should be.
837 FilePath::StringType extension = download->full_path().Extension();
838
839 // Handle chrome extensions explicitly and skip the shell execute. 836 // Handle chrome extensions explicitly and skip the shell execute.
840 if (Extension::IsExtension(download->full_path())) { 837 if (Extension::IsExtension(download->full_path())) {
841 OpenChromeExtension(download->full_path()); 838 OpenChromeExtension(download->full_path());
842 return; 839 return;
843 } 840 }
844 841
842 // Open the download if the user or user prefs indicate it should be.
843 FilePath::StringType extension = download->full_path().Extension();
844 // Drop the leading period. (The auto-open list is period-less.)
845 if (extension.size() > 0)
846 extension = extension.substr(1);
847
845 if (download->open_when_complete() || ShouldOpenFileExtension(extension)) 848 if (download->open_when_complete() || ShouldOpenFileExtension(extension))
846 OpenDownloadInShell(download, NULL); 849 OpenDownloadInShell(download, NULL);
847 } 850 }
848 851
849 // Called on the file thread. Renames the downloaded file to its original name. 852 // Called on the file thread. Renames the downloaded file to its original name.
850 void DownloadManager::ProceedWithFinishedDangerousDownload( 853 void DownloadManager::ProceedWithFinishedDangerousDownload(
851 int64 download_handle, 854 int64 download_handle,
852 const FilePath& path, 855 const FilePath& path,
853 const FilePath& original_name) { 856 const FilePath& original_name) {
854 bool success = false; 857 bool success = false;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 } 1483 }
1481 1484
1482 if (contents) 1485 if (contents)
1483 contents->OnStartDownload(download); 1486 contents->OnStartDownload(download);
1484 } 1487 }
1485 1488
1486 // Clears the last download path, used to initialize "save as" dialogs. 1489 // Clears the last download path, used to initialize "save as" dialogs.
1487 void DownloadManager::ClearLastDownloadPath() { 1490 void DownloadManager::ClearLastDownloadPath() {
1488 last_download_path_ = FilePath(); 1491 last_download_path_ = FilePath();
1489 } 1492 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698