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

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

Issue 42054: Stop using renderer specific host ids in ResourceDispatcher. This allows it ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/plugin_process_host.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 : web_contents_(web_content), 149 : web_contents_(web_content),
150 download_(NULL), 150 download_(NULL),
151 saved_main_file_path_(file_full_path), 151 saved_main_file_path_(file_full_path),
152 saved_main_directory_path_(directory_full_path), 152 saved_main_directory_path_(directory_full_path),
153 finished_(false), 153 finished_(false),
154 user_canceled_(false), 154 user_canceled_(false),
155 disk_error_occurred_(false), 155 disk_error_occurred_(false),
156 save_type_(save_type), 156 save_type_(save_type),
157 all_save_items_count_(0), 157 all_save_items_count_(0),
158 wait_state_(INITIALIZE), 158 wait_state_(INITIALIZE),
159 tab_id_(web_content->process()->host_id()) { 159 tab_id_(web_content->process()->pid()) {
160 DCHECK(web_content); 160 DCHECK(web_content);
161 const GURL& current_page_url = web_contents_->GetURL(); 161 const GURL& current_page_url = web_contents_->GetURL();
162 DCHECK(current_page_url.is_valid()); 162 DCHECK(current_page_url.is_valid());
163 page_url_ = current_page_url; 163 page_url_ = current_page_url;
164 DCHECK(save_type_ == SAVE_AS_ONLY_HTML || 164 DCHECK(save_type_ == SAVE_AS_ONLY_HTML ||
165 save_type_ == SAVE_AS_COMPLETE_HTML); 165 save_type_ == SAVE_AS_COMPLETE_HTML);
166 DCHECK(!saved_main_file_path_.empty() && 166 DCHECK(!saved_main_file_path_.empty() &&
167 saved_main_file_path_.value().length() <= kMaxFilePathLength); 167 saved_main_file_path_.value().length() <= kMaxFilePathLength);
168 DCHECK(!saved_main_directory_path_.empty() && 168 DCHECK(!saved_main_directory_path_.empty() &&
169 saved_main_directory_path_.value().length() < kMaxFilePathLength); 169 saved_main_directory_path_.value().length() < kMaxFilePathLength);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 for (SavedItemMap::iterator it = saved_success_items_.begin(); 571 for (SavedItemMap::iterator it = saved_success_items_.begin();
572 it != saved_success_items_.end(); ++it) 572 it != saved_success_items_.end(); ++it)
573 final_names.push_back(std::make_pair(it->first, 573 final_names.push_back(std::make_pair(it->first,
574 it->second->full_path())); 574 it->second->full_path()));
575 575
576 file_manager_->GetSaveLoop()->PostTask(FROM_HERE, 576 file_manager_->GetSaveLoop()->PostTask(FROM_HERE,
577 NewRunnableMethod(file_manager_, 577 NewRunnableMethod(file_manager_,
578 &SaveFileManager::RenameAllFiles, 578 &SaveFileManager::RenameAllFiles,
579 final_names, 579 final_names,
580 dir, 580 dir,
581 web_contents_->process()->host_id(), 581 web_contents_->process()->pid(),
582 web_contents_->render_view_host()->routing_id())); 582 web_contents_->render_view_host()->routing_id()));
583 } 583 }
584 584
585 // Successfully finished all items of this SavePackage. 585 // Successfully finished all items of this SavePackage.
586 void SavePackage::Finish() { 586 void SavePackage::Finish() {
587 // User may cancel the job when we're moving files to the final directory. 587 // User may cancel the job when we're moving files to the final directory.
588 if (canceled()) 588 if (canceled())
589 return; 589 return;
590 590
591 wait_state_ = SUCCESSFUL; 591 wait_state_ = SUCCESSFUL;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 waiting_item_queue_.pop(); 709 waiting_item_queue_.pop();
710 710
711 // Add the item to in_progress_items_. 711 // Add the item to in_progress_items_.
712 SaveUrlItemMap::iterator it = in_progress_items_.find( 712 SaveUrlItemMap::iterator it = in_progress_items_.find(
713 save_item->url().spec()); 713 save_item->url().spec());
714 DCHECK(it == in_progress_items_.end()); 714 DCHECK(it == in_progress_items_.end());
715 in_progress_items_[save_item->url().spec()] = save_item; 715 in_progress_items_[save_item->url().spec()] = save_item;
716 save_item->Start(); 716 save_item->Start();
717 file_manager_->SaveURL(save_item->url(), 717 file_manager_->SaveURL(save_item->url(),
718 save_item->referrer(), 718 save_item->referrer(),
719 web_contents_->process()->host_id(), 719 web_contents_->process()->pid(),
720 web_contents_->render_view_host()->routing_id(), 720 web_contents_->render_view_host()->routing_id(),
721 save_item->save_source(), 721 save_item->save_source(),
722 save_item->full_path(), 722 save_item->full_path(),
723 request_context_.get(), 723 request_context_.get(),
724 this); 724 this);
725 } while (process_all_remaining_items && waiting_item_queue_.size()); 725 } while (process_all_remaining_items && waiting_item_queue_.size());
726 } 726 }
727 727
728 728
729 // Open download page in windows explorer on file thread, to avoid blocking the 729 // Open download page in windows explorer on file thread, to avoid blocking the
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (available_length > 0) { 1112 if (available_length > 0) {
1113 *pure_file_name = 1113 *pure_file_name =
1114 pure_file_name->substr(0, available_length); 1114 pure_file_name->substr(0, available_length);
1115 return true; 1115 return true;
1116 } 1116 }
1117 1117
1118 // Not enough room to even use a shortened |pure_file_name|. 1118 // Not enough room to even use a shortened |pure_file_name|.
1119 pure_file_name->clear(); 1119 pure_file_name->clear();
1120 return false; 1120 return false;
1121 } 1121 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/plugin_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698