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

Side by Side Diff: chrome/browser/tab_contents/web_contents.cc

Issue 23004: Port some strings in download/save_package.cc (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
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/tab_contents/web_contents.h" 5 #include "chrome/browser/tab_contents/web_contents.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 const GURL& current_page_url = GetURL(); 549 const GURL& current_page_url = GetURL();
550 if (dlm && current_page_url.is_valid()) 550 if (dlm && current_page_url.is_valid())
551 dlm->DownloadUrl(current_page_url, GURL(), this); 551 dlm->DownloadUrl(current_page_url, GURL(), this);
552 return; 552 return;
553 } 553 }
554 554
555 // Get our user preference state. 555 // Get our user preference state.
556 PrefService* prefs = profile()->GetPrefs(); 556 PrefService* prefs = profile()->GetPrefs();
557 DCHECK(prefs); 557 DCHECK(prefs);
558 558
559 std::wstring suggest_name = 559 FilePath suggest_name = SavePackage::GetSuggestNameForSaveAs(prefs,
560 SavePackage::GetSuggestNameForSaveAs(prefs, GetTitle()); 560 FilePath::FromWStringHack(GetTitle()));
561 561
562 SavePackage::SavePackageParam param(contents_mime_type()); 562 SavePackage::SavePackageParam param(contents_mime_type());
563 param.prefs = prefs; 563 param.prefs = prefs;
564 564
565 // TODO(rocking): Use new asynchronous dialog boxes to prevent the SaveAs 565 // TODO(rocking): Use new asynchronous dialog boxes to prevent the SaveAs
566 // dialog blocking the UI thread. See bug: http://b/issue?id=1129694. 566 // dialog blocking the UI thread. See bug: http://b/issue?id=1129694.
567 if (SavePackage::GetSaveInfo(suggest_name, view_->GetNativeView(), 567 if (SavePackage::GetSaveInfo(suggest_name, view_->GetNativeView(),
568 &param, profile()->GetDownloadManager())) 568 &param, profile()->GetDownloadManager())) {
569 SavePage(param.saved_main_file_path, param.dir, param.save_type); 569 SavePage(param.saved_main_file_path.ToWStringHack(),
570 param.dir.ToWStringHack(),
571 param.save_type);
572 }
570 } 573 }
571 574
572 void WebContents::SavePage(const std::wstring& main_file, 575 void WebContents::SavePage(const std::wstring& main_file,
573 const std::wstring& dir_path, 576 const std::wstring& dir_path,
574 SavePackage::SavePackageType save_type) { 577 SavePackage::SavePackageType save_type) {
575 // Stop the page from navigating. 578 // Stop the page from navigating.
576 Stop(); 579 Stop();
577 580
578 save_package_ = new SavePackage(this, save_type, main_file, dir_path); 581 save_package_ = new SavePackage(this, save_type,
582 FilePath::FromWStringHack(main_file),
583 FilePath::FromWStringHack(dir_path));
579 save_package_->Init(); 584 save_package_->Init();
580 } 585 }
581 586
582 void WebContents::PrintPreview() { 587 void WebContents::PrintPreview() {
583 // We don't show the print preview yet, only the print dialog. 588 // We don't show the print preview yet, only the print dialog.
584 PrintNow(); 589 PrintNow();
585 } 590 }
586 591
587 bool WebContents::PrintNow() { 592 bool WebContents::PrintNow() {
588 // We can't print interstitial page for now. 593 // We can't print interstitial page for now.
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 // The favicon url isn't valid. This means there really isn't a favicon, 1765 // The favicon url isn't valid. This means there really isn't a favicon,
1761 // or the favicon url wasn't obtained before the load started. This assumes 1766 // or the favicon url wasn't obtained before the load started. This assumes
1762 // the later. 1767 // the later.
1763 // TODO(sky): Need a way to set the favicon that doesn't involve generating 1768 // TODO(sky): Need a way to set the favicon that doesn't involve generating
1764 // its url. 1769 // its url.
1765 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); 1770 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer));
1766 } 1771 }
1767 new_url->set_safe_for_autoreplace(true); 1772 new_url->set_safe_for_autoreplace(true);
1768 url_model->Add(new_url); 1773 url_model->Add(new_url);
1769 } 1774 }
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package_unittest.cc ('k') | chrome/common/temp_scaffolding_stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698