OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/print_messages.h" | 24 #include "chrome/common/print_messages.h" |
25 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
26 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
27 #include "content/browser/renderer_host/render_view_host.h" | 27 #include "content/browser/renderer_host/render_view_host.h" |
28 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
29 #include "content/browser/tab_contents/tab_contents_view.h" | 29 #include "content/browser/tab_contents/tab_contents_view.h" |
30 #include "content/browser/webui/web_ui.h" | 30 #include "content/browser/webui/web_ui.h" |
31 #include "content/common/content_notification_types.h" | 31 #include "content/common/content_notification_types.h" |
32 #include "content/common/notification_registrar.h" | 32 #include "content/common/notification_registrar.h" |
33 #include "content/common/notification_source.h" | 33 #include "content/common/notification_source.h" |
34 #include "content/common/view_messages.h" | |
35 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
36 #include "webkit/glue/webpreferences.h" | 35 #include "webkit/glue/webpreferences.h" |
37 | 36 |
38 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
39 | 38 |
40 // This module implements the UI support in Chrome for cloud printing. | 39 // This module implements the UI support in Chrome for cloud printing. |
41 // This means hosting a dialog containing HTML/JavaScript and using | 40 // This means hosting a dialog containing HTML/JavaScript and using |
42 // the published cloud print user interface integration APIs to get | 41 // the published cloud print user interface integration APIs to get |
43 // page setup settings from the dialog contents and provide the | 42 // page setup settings from the dialog contents and provide the |
44 // generated print data to the dialog contents for uploading to the | 43 // generated print data to the dialog contents for uploading to the |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 GURL url = web_ui_->tab_contents()->GetURL(); | 315 GURL url = web_ui_->tab_contents()->GetURL(); |
317 GURL dialog_url = CloudPrintURL( | 316 GURL dialog_url = CloudPrintURL( |
318 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceDialogURL(); | 317 Profile::FromWebUI(web_ui_)).GetCloudPrintServiceDialogURL(); |
319 if (url.host() == dialog_url.host() && | 318 if (url.host() == dialog_url.host() && |
320 url.path() == dialog_url.path() && | 319 url.path() == dialog_url.path() && |
321 url.scheme() == dialog_url.scheme()) { | 320 url.scheme() == dialog_url.scheme()) { |
322 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); | 321 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); |
323 if (rvh && rvh->delegate()) { | 322 if (rvh && rvh->delegate()) { |
324 WebPreferences webkit_prefs = rvh->delegate()->GetWebkitPrefs(); | 323 WebPreferences webkit_prefs = rvh->delegate()->GetWebkitPrefs(); |
325 webkit_prefs.allow_scripts_to_close_windows = true; | 324 webkit_prefs.allow_scripts_to_close_windows = true; |
326 rvh->Send(new ViewMsg_UpdateWebPreferences( | 325 rvh->UpdateWebkitPreferences(webkit_prefs); |
327 rvh->routing_id(), webkit_prefs)); | |
328 } else { | 326 } else { |
329 DCHECK(false); | 327 DCHECK(false); |
330 } | 328 } |
331 } | 329 } |
332 | 330 |
333 // Choose one or the other. If you need to debug, bring up the | 331 // Choose one or the other. If you need to debug, bring up the |
334 // debugger. You can then use the various chrome.send() | 332 // debugger. You can then use the various chrome.send() |
335 // registrations above to kick of the various function calls, | 333 // registrations above to kick of the various function calls, |
336 // including chrome.send("SendPrintData") in the javaScript | 334 // including chrome.send("SendPrintData") in the javaScript |
337 // console and watch things happen with: | 335 // console and watch things happen with: |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 file_type, | 721 file_type, |
724 false, | 722 false, |
725 delete_on_close); | 723 delete_on_close); |
726 return true; | 724 return true; |
727 } | 725 } |
728 } | 726 } |
729 return false; | 727 return false; |
730 } | 728 } |
731 | 729 |
732 } // end namespace | 730 } // end namespace |
OLD | NEW |