| OLD | NEW |
| 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 "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 | 6 |
| 7 | 7 |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 void CreateDialogForFileImpl(content::BrowserContext* browser_context, | 637 void CreateDialogForFileImpl(content::BrowserContext* browser_context, |
| 638 gfx::NativeWindow modal_parent, | 638 gfx::NativeWindow modal_parent, |
| 639 const base::FilePath& path_to_file, | 639 const base::FilePath& path_to_file, |
| 640 const string16& print_job_title, | 640 const string16& print_job_title, |
| 641 const string16& print_ticket, | 641 const string16& print_ticket, |
| 642 const std::string& file_type, | 642 const std::string& file_type, |
| 643 bool delete_on_close) { | 643 bool delete_on_close) { |
| 644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 645 scoped_refptr<base::RefCountedMemory> data; | 645 scoped_refptr<base::RefCountedMemory> data; |
| 646 int64 file_size = 0; | 646 int64 file_size = 0; |
| 647 if (file_util::GetFileSize(path_to_file, &file_size) && file_size != 0) { | 647 if (base::GetFileSize(path_to_file, &file_size) && file_size != 0) { |
| 648 std::string file_data; | 648 std::string file_data; |
| 649 if (file_size < kuint32max) { | 649 if (file_size < kuint32max) { |
| 650 file_data.reserve(static_cast<unsigned int>(file_size)); | 650 file_data.reserve(static_cast<unsigned int>(file_size)); |
| 651 } else { | 651 } else { |
| 652 DLOG(WARNING) << " print data file too large to reserve space"; | 652 DLOG(WARNING) << " print data file too large to reserve space"; |
| 653 } | 653 } |
| 654 if (base::ReadFileToString(path_to_file, &file_data)) { | 654 if (base::ReadFileToString(path_to_file, &file_data)) { |
| 655 data = base::RefCountedString::TakeString(&file_data); | 655 data = base::RefCountedString::TakeString(&file_data); |
| 656 } | 656 } |
| 657 } | 657 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 print_job_print_ticket, | 758 print_job_print_ticket, |
| 759 file_type, | 759 file_type, |
| 760 delete_on_close); | 760 delete_on_close); |
| 761 return true; | 761 return true; |
| 762 } | 762 } |
| 763 } | 763 } |
| 764 return false; | 764 return false; |
| 765 } | 765 } |
| 766 | 766 |
| 767 } // namespace print_dialog_cloud | 767 } // namespace print_dialog_cloud |
| OLD | NEW |