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

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

Issue 525793002: Make WebContentsObserver::web_contents() public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 6 years, 3 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_package.h ('k') | content/public/browser/web_contents_observer.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_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_util.h" 10 #include "base/file_util.h"
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 #elif defined(OS_WIN) 1297 #elif defined(OS_WIN)
1298 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type)); 1298 base::FilePath::StringType mime_type(base::UTF8ToWide(contents_mime_type));
1299 #endif // OS_WIN 1299 #endif // OS_WIN
1300 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) { 1300 for (uint32 i = 0; i < ARRAYSIZE_UNSAFE(extensions); ++i) {
1301 if (mime_type == extensions[i].mime_type) 1301 if (mime_type == extensions[i].mime_type)
1302 return extensions[i].suggested_extension; 1302 return extensions[i].suggested_extension;
1303 } 1303 }
1304 return FILE_PATH_LITERAL(""); 1304 return FILE_PATH_LITERAL("");
1305 } 1305 }
1306 1306
1307 WebContents* SavePackage::web_contents() const {
1308 return WebContentsObserver::web_contents();
1309 }
1310
1311 void SavePackage::GetSaveInfo() { 1307 void SavePackage::GetSaveInfo() {
1312 // Can't use web_contents_ in the file thread, so get the data that we need 1308 // Can't use web_contents_ in the file thread, so get the data that we need
1313 // before calling to it. 1309 // before calling to it.
1314 base::FilePath website_save_dir, download_save_dir; 1310 base::FilePath website_save_dir, download_save_dir;
1315 bool skip_dir_check = false; 1311 bool skip_dir_check = false;
1316 DCHECK(download_manager_); 1312 DCHECK(download_manager_);
1317 if (download_manager_->GetDelegate()) { 1313 if (download_manager_->GetDelegate()) {
1318 download_manager_->GetDelegate()->GetSaveDir( 1314 download_manager_->GetDelegate()->GetSaveDir(
1319 web_contents()->GetBrowserContext(), &website_save_dir, 1315 web_contents()->GetBrowserContext(), &website_save_dir,
1320 &download_save_dir, &skip_dir_check); 1316 &download_save_dir, &skip_dir_check);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 1436
1441 void SavePackage::FinalizeDownloadEntry() { 1437 void SavePackage::FinalizeDownloadEntry() {
1442 DCHECK(download_); 1438 DCHECK(download_);
1443 DCHECK(download_manager_); 1439 DCHECK(download_manager_);
1444 1440
1445 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1441 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1446 StopObservation(); 1442 StopObservation();
1447 } 1443 }
1448 1444
1449 } // namespace content 1445 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/save_package.h ('k') | content/public/browser/web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698