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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // large data to google docs and set the URL in the printing | 247 // large data to google docs and set the URL in the printing |
248 // JavaScript to that location, and make sure it gets deleted when not | 248 // JavaScript to that location, and make sure it gets deleted when not |
249 // needed. - 4/1/2010 | 249 // needed. - 4/1/2010 |
250 void CloudPrintDataSender::SendPrintData() { | 250 void CloudPrintDataSender::SendPrintData() { |
251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
252 if (!data_.get() || !data_->size()) | 252 if (!data_.get() || !data_->size()) |
253 return; | 253 return; |
254 | 254 |
255 std::string base64_data; | 255 std::string base64_data; |
256 base::Base64Encode( | 256 base::Base64Encode( |
257 base::StringPiece(reinterpret_cast<const char*>(data_->front()), | 257 base::StringPiece(data_->front_as<char>(), data_->size()), |
258 data_->size()), | |
259 &base64_data); | 258 &base64_data); |
260 std::string header("data:"); | 259 std::string header("data:"); |
261 header.append(file_type_); | 260 header.append(file_type_); |
262 header.append(";base64,"); | 261 header.append(";base64,"); |
263 base64_data.insert(0, header); | 262 base64_data.insert(0, header); |
264 | 263 |
265 base::AutoLock lock(lock_); | 264 base::AutoLock lock(lock_); |
266 if (helper_) { | 265 if (helper_) { |
267 base::StringValue title(print_job_title_); | 266 base::StringValue title(print_job_title_); |
268 base::StringValue ticket(print_ticket_); | 267 base::StringValue ticket(print_ticket_); |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 print_job_print_ticket, | 772 print_job_print_ticket, |
774 file_type, | 773 file_type, |
775 delete_on_close); | 774 delete_on_close); |
776 return true; | 775 return true; |
777 } | 776 } |
778 } | 777 } |
779 return false; | 778 return false; |
780 } | 779 } |
781 | 780 |
782 } // namespace print_dialog_cloud | 781 } // namespace print_dialog_cloud |
OLD | NEW |