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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 const content::NotificationSource& source, | 354 const content::NotificationSource& source, |
355 const content::NotificationDetails& details) { | 355 const content::NotificationDetails& details) { |
356 switch (type) { | 356 switch (type) { |
357 case content::NOTIFICATION_LOAD_STOP: { | 357 case content::NOTIFICATION_LOAD_STOP: { |
358 GURL url = web_ui()->GetWebContents()->GetURL(); | 358 GURL url = web_ui()->GetWebContents()->GetURL(); |
359 if (IsCloudPrintDialogUrl(url)) { | 359 if (IsCloudPrintDialogUrl(url)) { |
360 // Take the opportunity to set some (minimal) additional | 360 // Take the opportunity to set some (minimal) additional |
361 // script permissions required for the web UI. | 361 // script permissions required for the web UI. |
362 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost(); | 362 RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost(); |
363 if (rvh) { | 363 if (rvh) { |
364 // TODO(chrishtr): this is wrong. allow_scripts_to_close_windows will | |
365 // be reset the next time a preference changes. | |
366 WebPreferences webkit_prefs = rvh->GetWebkitPreferences(); | 364 WebPreferences webkit_prefs = rvh->GetWebkitPreferences(); |
367 webkit_prefs.allow_scripts_to_close_windows = true; | 365 webkit_prefs.allow_scripts_to_close_windows = true; |
368 rvh->UpdateWebkitPreferences(webkit_prefs); | 366 rvh->UpdateWebkitPreferences(webkit_prefs); |
369 } else { | 367 } else { |
370 NOTREACHED(); | 368 NOTREACHED(); |
371 } | 369 } |
372 // Choose one or the other. If you need to debug, bring up the | 370 // Choose one or the other. If you need to debug, bring up the |
373 // debugger. You can then use the various chrome.send() | 371 // debugger. You can then use the various chrome.send() |
374 // registrations above to kick of the various function calls, | 372 // registrations above to kick of the various function calls, |
375 // including chrome.send("SendPrintData") in the javaScript | 373 // including chrome.send("SendPrintData") in the javaScript |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 775 |
778 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL, | 776 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL, |
779 cloud_print_file, print_job_title, print_job_print_ticket, file_type); | 777 cloud_print_file, print_job_title, print_job_print_ticket, file_type); |
780 return true; | 778 return true; |
781 } | 779 } |
782 } | 780 } |
783 return false; | 781 return false; |
784 } | 782 } |
785 | 783 |
786 } // namespace print_dialog_cloud | 784 } // namespace print_dialog_cloud |
OLD | NEW |