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

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

Issue 2906133004: JavaScript dialogs cause a page to lose fullscreen. (Closed)
Patch Set: matt Created 3 years, 6 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 | « no previous file | chrome/browser/printing/print_view_manager.cc » ('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 "chrome/browser/printing/print_job_worker.h" 5 #include "chrome/browser/printing/print_job_worker.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 printing_context_->settings(), 209 printing_context_->settings(),
210 result)); 210 result));
211 } 211 }
212 212
213 void PrintJobWorker::GetSettingsWithUI( 213 void PrintJobWorker::GetSettingsWithUI(
214 int document_page_count, 214 int document_page_count,
215 bool has_selection, 215 bool has_selection,
216 bool is_scripted) { 216 bool is_scripted) {
217 DCHECK_CURRENTLY_ON(BrowserThread::UI); 217 DCHECK_CURRENTLY_ON(BrowserThread::UI);
218 218
219 PrintingContextDelegate* printing_context_delegate =
220 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get());
221 content::WebContents* web_contents =
222 printing_context_delegate->GetWebContents();
223
219 #if defined(OS_ANDROID) 224 #if defined(OS_ANDROID)
220 if (is_scripted) { 225 if (is_scripted) {
221 PrintingContextDelegate* printing_context_delegate =
222 static_cast<PrintingContextDelegate*>(printing_context_delegate_.get());
223 content::WebContents* web_contents =
224 printing_context_delegate->GetWebContents();
225 TabAndroid* tab = 226 TabAndroid* tab =
226 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr; 227 web_contents ? TabAndroid::FromWebContents(web_contents) : nullptr;
227 228
228 // Regardless of whether the following call fails or not, the javascript 229 // Regardless of whether the following call fails or not, the javascript
229 // call will return since startPendingPrint will make it return immediately 230 // call will return since startPendingPrint will make it return immediately
230 // in case of error. 231 // in case of error.
231 if (tab) 232 if (tab)
232 tab->SetPendingPrint(); 233 tab->SetPendingPrint();
233 } 234 }
234 #endif 235 #endif
235 236
237 // Running a dialog causes an exit to webpage-initiated fullscreen.
238 // http://crbug.com/728276
239 if (web_contents->IsFullscreenForCurrentTab())
240 web_contents->ExitFullscreen(true);
241
236 // weak_factory_ creates pointers valid only on owner_ thread. 242 // weak_factory_ creates pointers valid only on owner_ thread.
237 printing_context_->AskUserForSettings( 243 printing_context_->AskUserForSettings(
238 document_page_count, has_selection, is_scripted, 244 document_page_count, has_selection, is_scripted,
239 base::Bind(&PostOnOwnerThread, make_scoped_refptr(owner_), 245 base::Bind(&PostOnOwnerThread, make_scoped_refptr(owner_),
240 base::Bind(&PrintJobWorker::GetSettingsDone, 246 base::Bind(&PrintJobWorker::GetSettingsDone,
241 weak_factory_.GetWeakPtr()))); 247 weak_factory_.GetWeakPtr())));
242 } 248 }
243 249
244 void PrintJobWorker::UseDefaultSettings() { 250 void PrintJobWorker::UseDefaultSettings() {
245 PrintingContext::Result result = printing_context_->UseDefaultSettings(); 251 PrintingContext::Result result = printing_context_->UseDefaultSettings();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 JobEventDetails::FAILED, 0, 439 JobEventDetails::FAILED, 0,
434 base::RetainedRef(document_), nullptr)); 440 base::RetainedRef(document_), nullptr));
435 Cancel(); 441 Cancel();
436 442
437 // Makes sure the variables are reinitialized. 443 // Makes sure the variables are reinitialized.
438 document_ = NULL; 444 document_ = NULL;
439 page_number_ = PageNumber::npos(); 445 page_number_ = PageNumber::npos();
440 } 446 }
441 447
442 } // namespace printing 448 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/printing/print_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698