Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(919)

Side by Side Diff: chrome/browser/printing/print_dialog_cloud_win.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 25 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "components/cloud_devices/common/cloud_devices_urls.h" 27 #include "components/cloud_devices/common/cloud_devices_urls.h"
28 #include "components/google/core/browser/google_util.h" 28 #include "components/google/core/browser/google_util.h"
29 #include "content/public/browser/browser_context.h" 29 #include "content/public/browser/browser_context.h"
30 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/message_port_provider.h" 31 #include "content/public/browser/message_port_provider.h"
32 #include "content/public/browser/render_frame_host.h" 32 #include "content/public/browser/render_frame_host.h"
33 #include "content/public/common/message_port.h"
33 34
34 namespace print_dialog_cloud { 35 namespace print_dialog_cloud {
35 36
36 namespace { 37 namespace {
37 38
38 // Limit is used only to allocate memory. Cloud has own small limit. 39 // Limit is used only to allocate memory. Cloud has own small limit.
39 const int kMaxFileSize = 1024 * 1024 * 1024; 40 const int kMaxFileSize = 1024 * 1024 * 1024;
40 41
41 // Sets print data into Cloud Print widget. 42 // Sets print data into Cloud Print widget.
42 class PrintDataSetter : public content::WebContentsObserver { 43 class PrintDataSetter : public content::WebContentsObserver {
(...skipping 25 matching lines...) Expand all
68 69
69 private: 70 private:
70 // Overridden from content::WebContentsObserver: 71 // Overridden from content::WebContentsObserver:
71 void DocumentLoadedInFrame( 72 void DocumentLoadedInFrame(
72 content::RenderFrameHost* render_frame_host) override { 73 content::RenderFrameHost* render_frame_host) override {
73 GURL url = web_contents()->GetURL(); 74 GURL url = web_contents()->GetURL();
74 if (cloud_devices::IsCloudPrintURL(url)) { 75 if (cloud_devices::IsCloudPrintURL(url)) {
75 base::string16 origin = base::UTF8ToUTF16(url.GetOrigin().spec()); 76 base::string16 origin = base::UTF8ToUTF16(url.GetOrigin().spec());
76 content::MessagePortProvider::PostMessageToFrame( 77 content::MessagePortProvider::PostMessageToFrame(
77 web_contents(), origin, origin, message_data_, 78 web_contents(), origin, origin, message_data_,
78 std::vector<int>()); 79 std::vector<content::MessagePort>());
79 } 80 }
80 } 81 }
81 82
82 void WebContentsDestroyed() override { delete this; } 83 void WebContentsDestroyed() override { delete this; }
83 84
84 base::string16 message_data_; 85 base::string16 message_data_;
85 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter); 86 DISALLOW_COPY_AND_ASSIGN(PrintDataSetter);
86 }; 87 };
87 88
88 void CreatePrintDialog(content::BrowserContext* browser_context, 89 void CreatePrintDialog(content::BrowserContext* browser_context,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 std::string file_type = 155 std::string file_type =
155 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType); 156 command_line.GetSwitchValueASCII(switches::kCloudPrintFileType);
156 if (file_type.empty()) 157 if (file_type.empty())
157 file_type = "application/pdf"; 158 file_type = "application/pdf";
158 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title, 159 CreatePrintDialogForFile(profile, cloud_print_file, print_job_title,
159 print_job_print_ticket, file_type); 160 print_job_print_ticket, file_type);
160 return true; 161 return true;
161 } 162 }
162 163
163 } // namespace print_dialog_cloud 164 } // namespace print_dialog_cloud
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698