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

Side by Side Diff: chrome/browser/printing/print_job_worker.cc

Issue 1338333002: Add checks for android printing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated test. It still is kind of flaky (2/30, the print dialog comes up -> timeout), but no crash Created 5 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
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 "chrome/browser/printing/print_job_worker.h" 5 #include "chrome/browser/printing/print_job_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 bool has_selection, 212 bool has_selection,
213 bool is_scripted) { 213 bool is_scripted) {
214 DCHECK_CURRENTLY_ON(BrowserThread::UI); 214 DCHECK_CURRENTLY_ON(BrowserThread::UI);
215 215
216 #if defined(OS_ANDROID) 216 #if defined(OS_ANDROID)
217 if (is_scripted) { 217 if (is_scripted) {
218 PrintingContextDelegate* printing_context_delegate = 218 PrintingContextDelegate* printing_context_delegate =
219 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get()); 219 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get());
220 content::WebContents* web_contents = 220 content::WebContents* web_contents =
221 printing_context_delegate->GetWebContents(); 221 printing_context_delegate->GetWebContents();
222 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); 222 TabAndroid* tab =
223 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr;
223 224
224 // Regardless of whether the following call fails or not, the javascript 225 // Regardless of whether the following call fails or not, the javascript
225 // call will return since startPendingPrint will make it return immediately 226 // call will return since startPendingPrint will make it return immediately
226 // in case of error. 227 // in case of error.
227 if (tab) 228 if (tab)
228 tab->SetPendingPrint(); 229 tab->SetPendingPrint();
229 } 230 }
230 #endif 231 #endif
231 232
232 // weak_factory_ creates pointers valid only on owner_ thread. 233 // weak_factory_ creates pointers valid only on owner_ thread.
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 document_, 435 document_,
435 scoped_refptr<PrintedPage>())); 436 scoped_refptr<PrintedPage>()));
436 Cancel(); 437 Cancel();
437 438
438 // Makes sure the variables are reinitialized. 439 // Makes sure the variables are reinitialized.
439 document_ = NULL; 440 document_ = NULL;
440 page_number_ = PageNumber::npos(); 441 page_number_ = PageNumber::npos();
441 } 442 }
442 443
443 } // namespace printing 444 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698