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

Side by Side Diff: content/browser/download/save_item.cc

Issue 1502563004: Save-Page-As-Complete-Html: Each frame links to a distinct local file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-url-deduping-for-frame-and-adding-save-item-id
Patch Set: Rebasing... Created 4 years, 10 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 | « content/browser/download/save_item.h ('k') | content/browser/download/save_package.h » ('j') | 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) 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_item.h" 5 #include "content/browser/download/save_item.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/browser/download/save_file.h" 9 #include "content/browser/download/save_file.h"
10 #include "content/browser/download/save_file_manager.h" 10 #include "content/browser/download/save_file_manager.h"
11 #include "content/browser/download/save_package.h" 11 #include "content/browser/download/save_package.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 namespace { 16 namespace {
17 17
18 SaveItemId GetNextSaveItemId() { 18 SaveItemId GetNextSaveItemId() {
19 static int g_next_save_item_id = 1; 19 static int g_next_save_item_id = 1;
20 DCHECK_CURRENTLY_ON(BrowserThread::UI); 20 DCHECK_CURRENTLY_ON(BrowserThread::UI);
21 return SaveItemId::FromUnsafeValue(g_next_save_item_id++); 21 return SaveItemId::FromUnsafeValue(g_next_save_item_id++);
22 } 22 }
23 23
24 } // namespace 24 } // namespace
25 25
26 // Constructor for SaveItem when creating each saving job. 26 // Constructor for SaveItem when creating each saving job.
27 SaveItem::SaveItem(const GURL& url, 27 SaveItem::SaveItem(const GURL& url,
28 const Referrer& referrer, 28 const Referrer& referrer,
29 SavePackage* package, 29 SavePackage* package,
30 SaveFileCreateInfo::SaveFileSource save_source) 30 SaveFileCreateInfo::SaveFileSource save_source,
31 int frame_tree_node_id)
31 : save_item_id_(GetNextSaveItemId()), 32 : save_item_id_(GetNextSaveItemId()),
32 url_(url), 33 url_(url),
33 referrer_(referrer), 34 referrer_(referrer),
35 frame_tree_node_id_(frame_tree_node_id),
34 total_bytes_(0), 36 total_bytes_(0),
35 received_bytes_(0), 37 received_bytes_(0),
36 state_(WAIT_START), 38 state_(WAIT_START),
37 has_final_name_(false), 39 has_final_name_(false),
38 is_success_(false), 40 is_success_(false),
39 save_source_(save_source), 41 save_source_(save_source),
40 package_(package) { 42 package_(package) {
41 DCHECK(package); 43 DCHECK(package);
42 } 44 }
43 45
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 file_name_ = full_path_.BaseName(); 123 file_name_ = full_path_.BaseName();
122 has_final_name_ = true; 124 has_final_name_ = true;
123 } 125 }
124 126
125 void SaveItem::SetTotalBytes(int64_t total_bytes) { 127 void SaveItem::SetTotalBytes(int64_t total_bytes) {
126 DCHECK_EQ(0, total_bytes_); 128 DCHECK_EQ(0, total_bytes_);
127 total_bytes_ = total_bytes; 129 total_bytes_ = total_bytes;
128 } 130 }
129 131
130 } // namespace content 132 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_item.h ('k') | content/browser/download/save_package.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698