| 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 "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 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/browser/content_browser_client.h" | 36 #include "content/public/browser/content_browser_client.h" |
| 37 #include "content/public/browser/download_manager_delegate.h" | 37 #include "content/public/browser/download_manager_delegate.h" |
| 38 #include "content/public/common/url_constants.h" | 38 #include "content/public/common/url_constants.h" |
| 39 #include "net/base/io_buffer.h" | 39 #include "net/base/io_buffer.h" |
| 40 #include "net/base/mime_util.h" | 40 #include "net/base/mime_util.h" |
| 41 #include "net/base/net_util.h" | 41 #include "net/base/net_util.h" |
| 42 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie
nt.h" |
| 44 | 44 |
| 45 using base::Time; | 45 using base::Time; |
| 46 using content::BrowserThread; |
| 46 using WebKit::WebPageSerializerClient; | 47 using WebKit::WebPageSerializerClient; |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 // A counter for uniquely identifying each save package. | 51 // A counter for uniquely identifying each save package. |
| 51 int g_save_package_id = 0; | 52 int g_save_package_id = 0; |
| 52 | 53 |
| 53 // Default name which will be used when we can not get proper name from | 54 // Default name which will be used when we can not get proper name from |
| 54 // resource URL. | 55 // resource URL. |
| 55 const char kDefaultSaveName[] = "saved_resource"; | 56 const char kDefaultSaveName[] = "saved_resource"; |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 StopObservation(); | 1279 StopObservation(); |
| 1279 } | 1280 } |
| 1280 | 1281 |
| 1281 void SavePackage::FinalizeDownloadEntry() { | 1282 void SavePackage::FinalizeDownloadEntry() { |
| 1282 DCHECK(download_); | 1283 DCHECK(download_); |
| 1283 DCHECK(download_manager_); | 1284 DCHECK(download_manager_); |
| 1284 | 1285 |
| 1285 download_manager_->SavePageDownloadFinished(download_); | 1286 download_manager_->SavePageDownloadFinished(download_); |
| 1286 StopObservation(); | 1287 StopObservation(); |
| 1287 } | 1288 } |
| OLD | NEW |