| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 // Overridden from content::WebContentsObserver: | 70 // Overridden from content::WebContentsObserver: |
| 71 void DocumentLoadedInFrame( | 71 void DocumentLoadedInFrame( |
| 72 content::RenderFrameHost* render_frame_host) override { | 72 content::RenderFrameHost* render_frame_host) override { |
| 73 GURL url = web_contents()->GetURL(); | 73 GURL url = web_contents()->GetURL(); |
| 74 if (cloud_devices::IsCloudPrintURL(url)) { | 74 if (cloud_devices::IsCloudPrintURL(url)) { |
| 75 base::string16 origin = base::UTF8ToUTF16(url.GetOrigin().spec()); | 75 base::string16 origin = base::UTF8ToUTF16(url.GetOrigin().spec()); |
| 76 content::MessagePortProvider::PostMessageToFrame( | 76 content::MessagePortProvider::PostMessageToFrame( |
| 77 web_contents(), origin, origin, message_data_, | 77 web_contents(), origin, origin, message_data_); |
| 78 std::vector<int>()); | |
| 79 } | 78 } |
| 80 } | 79 } |
| 81 | 80 |
| 82 void WebContentsDestroyed() override { delete this; } | 81 void WebContentsDestroyed() override { delete this; } |
| 83 | 82 |
| 84 base::string16 message_data_; | 83 base::string16 message_data_; |
| 85 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter); | 84 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter); |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 void CreatePrintDialog(content::BrowserContext* browser_context, | 87 void CreatePrintDialog(content::BrowserContext* browser_context, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 std::string file_type = | 153 std::string file_type = |
| 155 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType); | 154 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType); |
| 156 if (file_type.empty()) | 155 if (file_type.empty()) |
| 157 file_type = "application/pdf"; | 156 file_type = "application/pdf"; |
| 158 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title, | 157 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title, |
| 159 print_job_print_ticket, file_type); | 158 print_job_print_ticket, file_type); |
| 160 return true; | 159 return true; |
| 161 } | 160 } |
| 162 | 161 |
| 163 } // namespace print_dialog_cloud | 162 } // namespace print_dialog_cloud |
| OLD | NEW |