OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/download/save_file_manager.h" | 28 #include "chrome/browser/download/save_file_manager.h" |
29 #include "chrome/browser/download/save_item.h" | 29 #include "chrome/browser/download/save_item.h" |
30 #include "chrome/browser/net/url_fixer_upper.h" | 30 #include "chrome/browser/net/url_fixer_upper.h" |
31 #include "chrome/browser/platform_util.h" | 31 #include "chrome/browser/platform_util.h" |
32 #include "chrome/browser/prefs/pref_member.h" | 32 #include "chrome/browser/prefs/pref_member.h" |
33 #include "chrome/browser/prefs/pref_service.h" | 33 #include "chrome/browser/prefs/pref_service.h" |
34 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/tab_contents/tab_util.h" | 35 #include "chrome/browser/tab_contents/tab_util.h" |
36 #include "chrome/browser/ui/download/download_tab_helper.h" | 36 #include "chrome/browser/ui/download/download_tab_helper.h" |
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 38 #include "chrome/common/chrome_notification_types.h" |
38 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/render_messages.h" | 41 #include "chrome/common/render_messages.h" |
41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
42 #include "content/browser/browser_thread.h" | 43 #include "content/browser/browser_thread.h" |
43 #include "content/browser/renderer_host/render_process_host.h" | 44 #include "content/browser/renderer_host/render_process_host.h" |
44 #include "content/browser/renderer_host/render_view_host.h" | 45 #include "content/browser/renderer_host/render_view_host.h" |
45 #include "content/browser/renderer_host/render_view_host_delegate.h" | 46 #include "content/browser/renderer_host/render_view_host_delegate.h" |
46 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 47 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
47 #include "content/browser/tab_contents/tab_contents.h" | 48 #include "content/browser/tab_contents/tab_contents.h" |
48 #include "content/common/notification_service.h" | 49 #include "content/common/notification_service.h" |
49 #include "content/common/notification_type.h" | |
50 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
51 #include "net/base/io_buffer.h" | 51 #include "net/base/io_buffer.h" |
52 #include "net/base/mime_util.h" | 52 #include "net/base/mime_util.h" |
53 #include "net/base/net_util.h" | 53 #include "net/base/net_util.h" |
54 #include "net/url_request/url_request_context.h" | 54 #include "net/url_request/url_request_context.h" |
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" | 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" |
56 #include "ui/base/l10n/l10n_util.h" | 56 #include "ui/base/l10n/l10n_util.h" |
57 | 57 |
58 using base::Time; | 58 using base::Time; |
59 using WebKit::WebPageSerializerClient; | 59 using WebKit::WebPageSerializerClient; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 BrowserThread::PostTask( | 740 BrowserThread::PostTask( |
741 BrowserThread::FILE, FROM_HERE, | 741 BrowserThread::FILE, FROM_HERE, |
742 NewRunnableMethod(file_manager_, | 742 NewRunnableMethod(file_manager_, |
743 &SaveFileManager::RemoveSavedFileFromFileMap, | 743 &SaveFileManager::RemoveSavedFileFromFileMap, |
744 save_ids)); | 744 save_ids)); |
745 | 745 |
746 download_->OnAllDataSaved(all_save_items_count_); | 746 download_->OnAllDataSaved(all_save_items_count_); |
747 download_->MarkAsComplete(); | 747 download_->MarkAsComplete(); |
748 | 748 |
749 NotificationService::current()->Notify( | 749 NotificationService::current()->Notify( |
750 NotificationType::SAVE_PACKAGE_SUCCESSFULLY_FINISHED, | 750 chrome::NOTIFICATION_SAVE_PACKAGE_SUCCESSFULLY_FINISHED, |
751 Source<SavePackage>(this), | 751 Source<SavePackage>(this), |
752 Details<GURL>(&page_url_)); | 752 Details<GURL>(&page_url_)); |
753 } | 753 } |
754 | 754 |
755 // Called for updating end state. | 755 // Called for updating end state. |
756 void SavePackage::SaveFinished(int32 save_id, int64 size, bool is_success) { | 756 void SavePackage::SaveFinished(int32 save_id, int64 size, bool is_success) { |
757 // Because we might have canceled this saving job before, | 757 // Because we might have canceled this saving job before, |
758 // so we might not find corresponding SaveItem. Just ignore it. | 758 // so we might not find corresponding SaveItem. Just ignore it. |
759 SaveItem* save_item = LookupItemInProcessBySaveId(save_id); | 759 SaveItem* save_item = LookupItemInProcessBySaveId(save_id); |
760 if (!save_item) | 760 if (!save_item) |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 } | 1467 } |
1468 | 1468 |
1469 // SelectFileDialog::Listener interface. | 1469 // SelectFileDialog::Listener interface. |
1470 void SavePackage::FileSelected(const FilePath& path, | 1470 void SavePackage::FileSelected(const FilePath& path, |
1471 int index, void* params) { | 1471 int index, void* params) { |
1472 ContinueSave(path, index); | 1472 ContinueSave(path, index); |
1473 } | 1473 } |
1474 | 1474 |
1475 void SavePackage::FileSelectionCanceled(void* params) { | 1475 void SavePackage::FileSelectionCanceled(void* params) { |
1476 } | 1476 } |
OLD | NEW |