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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter); | 86 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter); |
87 }; | 87 }; |
88 | 88 |
89 void CreatePrintDialog(content::BrowserContext* browser_context, | 89 void CreatePrintDialog(content::BrowserContext* browser_context, |
90 const base::string16& print_job_title, | 90 const base::string16& print_job_title, |
91 const base::string16& print_ticket, | 91 const base::string16& print_ticket, |
92 const std::string& file_type, | 92 const std::string& file_type, |
93 const scoped_refptr<base::RefCountedMemory>& data) { | 93 const scoped_refptr<base::RefCountedMemory>& data) { |
94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 94 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
95 Profile* profile = Profile::FromBrowserContext(browser_context); | 95 Profile* profile = Profile::FromBrowserContext(browser_context); |
96 chrome::ScopedTabbedBrowserDisplayer displayer(profile, | 96 chrome::ScopedTabbedBrowserDisplayer displayer(profile); |
97 chrome::GetActiveDesktop()); | |
98 GURL url = cloud_devices::GetCloudPrintRelativeURL("client/dialog.html"); | 97 GURL url = cloud_devices::GetCloudPrintRelativeURL("client/dialog.html"); |
99 content::WebContents* web_contents = | 98 content::WebContents* web_contents = |
100 displayer.browser()->OpenURL(content::OpenURLParams( | 99 displayer.browser()->OpenURL(content::OpenURLParams( |
101 google_util::AppendGoogleLocaleParam( | 100 google_util::AppendGoogleLocaleParam( |
102 url, g_browser_process->GetApplicationLocale()), | 101 url, g_browser_process->GetApplicationLocale()), |
103 content::Referrer(), NEW_FOREGROUND_TAB, | 102 content::Referrer(), NEW_FOREGROUND_TAB, |
104 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); | 103 ui::PAGE_TRANSITION_AUTO_BOOKMARK, false)); |
105 if (data && data->size()) { | 104 if (data && data->size()) { |
106 new PrintDataSetter(web_contents, data, print_job_title, print_ticket, | 105 new PrintDataSetter(web_contents, data, print_job_title, print_ticket, |
107 file_type); | 106 file_type); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 std::string file_type = | 155 std::string file_type = |
157 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType); | 156 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType); |
158 if (file_type.empty()) | 157 if (file_type.empty()) |
159 file_type = "application/pdf"; | 158 file_type = "application/pdf"; |
160 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title, | 159 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title, |
161 print_job_print_ticket, file_type); | 160 print_job_print_ticket, file_type); |
162 return true; | 161 return true; |
163 } | 162 } |
164 | 163 |
165 } // namespace print_dialog_cloud | 164 } // namespace print_dialog_cloud |
OLD | NEW |