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

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

Issue 149161: Move extension install to after .crx download completes (Closed)
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
« 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 this, &DownloadManager::ProceedWithFinishedDangerousDownload, 813 this, &DownloadManager::ProceedWithFinishedDangerousDownload,
814 download->db_handle(), 814 download->db_handle(),
815 download->full_path(), download->original_name())); 815 download->full_path(), download->original_name()));
816 return; 816 return;
817 } 817 }
818 ContinueDownloadFinished(download); 818 ContinueDownloadFinished(download);
819 } 819 }
820 820
821 void DownloadManager::DownloadRenamedToFinalName(int download_id, 821 void DownloadManager::DownloadRenamedToFinalName(int download_id,
822 const FilePath& full_path) { 822 const FilePath& full_path) {
823 if (Extension::IsExtension(full_path))
824 OpenChromeExtension(full_path);
825 } 823 }
826 824
827 void DownloadManager::ContinueDownloadFinished(DownloadItem* download) { 825 void DownloadManager::ContinueDownloadFinished(DownloadItem* download) {
828 // 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
829 // 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.
830 DownloadMap::iterator it = dangerous_finished_.find(download->id()); 828 DownloadMap::iterator it = dangerous_finished_.find(download->id());
831 if (it != dangerous_finished_.end()) 829 if (it != dangerous_finished_.end())
832 dangerous_finished_.erase(it); 830 dangerous_finished_.erase(it);
833 831
834 // 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
835 // state to complete but did not notify). 833 // state to complete but did not notify).
836 download->UpdateObservers(); 834 download->UpdateObservers();
837 835
838 // Open the download if the user or user prefs indicate it should be. 836 // Open the download if the user or user prefs indicate it should be.
839 FilePath::StringType extension = download->full_path().Extension(); 837 FilePath::StringType extension = download->full_path().Extension();
840 838
841 // Handle chrome extensions explicitly and skip the shell execute. 839 // Handle chrome extensions explicitly and skip the shell execute.
842 if (Extension::IsExtension(download->full_path())) { 840 if (Extension::IsExtension(download->full_path())) {
843 // Skip the shell execute. This will be handled in 841 OpenChromeExtension(download->full_path());
Matt Perry 2009/07/02 23:52:01 Are you sure this happens after DownloadRenamedToF
844 // DownloadRenamedToFinalName
845 return; 842 return;
846 } 843 }
847 844
848 if (download->open_when_complete() || ShouldOpenFileExtension(extension)) 845 if (download->open_when_complete() || ShouldOpenFileExtension(extension))
849 OpenDownloadInShell(download, NULL); 846 OpenDownloadInShell(download, NULL);
850 } 847 }
851 848
852 // Called on the file thread. Renames the downloaded file to its original name. 849 // Called on the file thread. Renames the downloaded file to its original name.
853 void DownloadManager::ProceedWithFinishedDangerousDownload( 850 void DownloadManager::ProceedWithFinishedDangerousDownload(
854 int64 download_handle, 851 int64 download_handle,
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1480 }
1484 1481
1485 if (contents) 1482 if (contents)
1486 contents->OnStartDownload(download); 1483 contents->OnStartDownload(download);
1487 } 1484 }
1488 1485
1489 // Clears the last download path, used to initialize "save as" dialogs. 1486 // Clears the last download path, used to initialize "save as" dialogs.
1490 void DownloadManager::ClearLastDownloadPath() { 1487 void DownloadManager::ClearLastDownloadPath() {
1491 last_download_path_ = FilePath(); 1488 last_download_path_ = FilePath();
1492 } 1489 }
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