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