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. |
364 WebPreferences webkit_prefs = rvh->GetWebkitPreferences(); | 366 WebPreferences webkit_prefs = rvh->GetWebkitPreferences(); |
365 webkit_prefs.allow_scripts_to_close_windows = true; | 367 webkit_prefs.allow_scripts_to_close_windows = true; |
366 rvh->UpdateWebkitPreferences(webkit_prefs); | 368 rvh->UpdateWebkitPreferences(webkit_prefs); |
367 } else { | 369 } else { |
368 NOTREACHED(); | 370 NOTREACHED(); |
369 } | 371 } |
370 // Choose one or the other. If you need to debug, bring up the | 372 // Choose one or the other. If you need to debug, bring up the |
371 // debugger. You can then use the various chrome.send() | 373 // debugger. You can then use the various chrome.send() |
372 // registrations above to kick of the various function calls, | 374 // registrations above to kick of the various function calls, |
373 // including chrome.send("SendPrintData") in the javaScript | 375 // including chrome.send("SendPrintData") in the javaScript |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 777 |
776 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL, | 778 print_dialog_cloud::CreatePrintDialogForFile(profile, NULL, |
777 cloud_print_file, print_job_title, print_job_print_ticket, file_type); | 779 cloud_print_file, print_job_title, print_job_print_ticket, file_type); |
778 return true; | 780 return true; |
779 } | 781 } |
780 } | 782 } |
781 return false; | 783 return false; |
782 } | 784 } |
783 | 785 |
784 } // namespace print_dialog_cloud | 786 } // namespace print_dialog_cloud |
OLD | NEW |