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 "content/browser/download/save_package.h" | 5 #include "content/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "content/browser/renderer_host/render_view_host_delegate.h" | 29 #include "content/browser/renderer_host/render_view_host_delegate.h" |
30 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
31 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 31 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
32 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
33 #include "content/public/browser/browser_context.h" | 33 #include "content/public/browser/browser_context.h" |
34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/content_browser_client.h" | 35 #include "content/public/browser/content_browser_client.h" |
36 #include "content/public/browser/download_manager_delegate.h" | 36 #include "content/public/browser/download_manager_delegate.h" |
37 #include "content/public/browser/navigation_entry.h" | 37 #include "content/public/browser/navigation_entry.h" |
38 #include "content/public/browser/resource_context.h" | 38 #include "content/public/browser/resource_context.h" |
| 39 #include "content/public/browser/storage_partition.h" |
39 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
40 #include "content/public/common/url_constants.h" | 41 #include "content/public/common/url_constants.h" |
41 #include "net/base/io_buffer.h" | 42 #include "net/base/io_buffer.h" |
42 #include "net/base/mime_util.h" | 43 #include "net/base/mime_util.h" |
43 #include "net/base/net_util.h" | 44 #include "net/base/net_util.h" |
44 #include "net/url_request/url_request_context.h" | 45 #include "net/url_request/url_request_context.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" |
46 | 47 |
47 using base::Time; | 48 using base::Time; |
48 using content::BrowserContext; | 49 using content::BrowserContext; |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 save_item->url().spec()); | 861 save_item->url().spec()); |
861 DCHECK(it == in_progress_items_.end()); | 862 DCHECK(it == in_progress_items_.end()); |
862 in_progress_items_[save_item->url().spec()] = save_item; | 863 in_progress_items_[save_item->url().spec()] = save_item; |
863 save_item->Start(); | 864 save_item->Start(); |
864 file_manager_->SaveURL(save_item->url(), | 865 file_manager_->SaveURL(save_item->url(), |
865 save_item->referrer(), | 866 save_item->referrer(), |
866 web_contents()->GetRenderProcessHost()->GetID(), | 867 web_contents()->GetRenderProcessHost()->GetID(), |
867 routing_id(), | 868 routing_id(), |
868 save_item->save_source(), | 869 save_item->save_source(), |
869 save_item->full_path(), | 870 save_item->full_path(), |
870 web_contents()-> | 871 content::BrowserContext::GetDefaultStoragePartition( |
871 GetBrowserContext()->GetResourceContext(), | 872 web_contents()->GetBrowserContext())-> |
| 873 GetResourceContext(), |
872 this); | 874 this); |
873 } while (process_all_remaining_items && waiting_item_queue_.size()); | 875 } while (process_all_remaining_items && waiting_item_queue_.size()); |
874 } | 876 } |
875 | 877 |
876 // Calculate the percentage of whole save page job. | 878 // Calculate the percentage of whole save page job. |
877 int SavePackage::PercentComplete() { | 879 int SavePackage::PercentComplete() { |
878 if (!all_save_items_count_) | 880 if (!all_save_items_count_) |
879 return 0; | 881 return 0; |
880 else if (!in_process_count()) | 882 else if (!in_process_count()) |
881 return 100; | 883 return 100; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 StopObservation(); | 1363 StopObservation(); |
1362 } | 1364 } |
1363 | 1365 |
1364 void SavePackage::FinalizeDownloadEntry() { | 1366 void SavePackage::FinalizeDownloadEntry() { |
1365 DCHECK(download_); | 1367 DCHECK(download_); |
1366 DCHECK(download_manager_); | 1368 DCHECK(download_manager_); |
1367 | 1369 |
1368 download_manager_->SavePageDownloadFinished(download_); | 1370 download_manager_->SavePageDownloadFinished(download_); |
1369 StopObservation(); | 1371 StopObservation(); |
1370 } | 1372 } |
OLD | NEW |