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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // hitting the print button), the delegate is notified, and responds | 97 // hitting the print button), the delegate is notified, and responds |
98 // that the dialog should be closed, at which point things are torn | 98 // that the dialog should be closed, at which point things are torn |
99 // down and released. | 99 // down and released. |
100 | 100 |
101 // TODO(scottbyer): | 101 // TODO(scottbyer): |
102 // http://code.google.com/p/chromium/issues/detail?id=44093 The | 102 // http://code.google.com/p/chromium/issues/detail?id=44093 The |
103 // high-level flow (where the data is generated before even | 103 // high-level flow (where the data is generated before even |
104 // bringing up the dialog) isn't what we want. | 104 // bringing up the dialog) isn't what we want. |
105 | 105 |
106 using content::BrowserThread; | 106 using content::BrowserThread; |
| 107 using content::NavigationEntry; |
107 using content::WebContents; | 108 using content::WebContents; |
108 | 109 |
109 namespace internal_cloud_print_helpers { | 110 namespace internal_cloud_print_helpers { |
110 | 111 |
111 // From the JSON parsed value, get the entries for the page setup | 112 // From the JSON parsed value, get the entries for the page setup |
112 // parameters. | 113 // parameters. |
113 bool GetPageSetupParameters(const std::string& json, | 114 bool GetPageSetupParameters(const std::string& json, |
114 PrintMsg_Print_Params& parameters) { | 115 PrintMsg_Print_Params& parameters) { |
115 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); | 116 scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false)); |
116 DLOG_IF(ERROR, (!parsed_value.get() || | 117 DLOG_IF(ERROR, (!parsed_value.get() || |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData, | 296 base::Bind(&CloudPrintFlowHandler::HandleSendPrintData, |
296 base::Unretained(this))); | 297 base::Unretained(this))); |
297 web_ui_->RegisterMessageCallback("SetPageParameters", | 298 web_ui_->RegisterMessageCallback("SetPageParameters", |
298 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters, | 299 base::Bind(&CloudPrintFlowHandler::HandleSetPageParameters, |
299 base::Unretained(this))); | 300 base::Unretained(this))); |
300 | 301 |
301 // Register for appropriate notifications, and re-direct the URL | 302 // Register for appropriate notifications, and re-direct the URL |
302 // to the real server URL, now that we've gotten an HTML dialog | 303 // to the real server URL, now that we've gotten an HTML dialog |
303 // going. | 304 // going. |
304 NavigationController* controller = &web_ui_->tab_contents()->GetController(); | 305 NavigationController* controller = &web_ui_->tab_contents()->GetController(); |
305 content::NavigationEntry* pending_entry = controller->GetPendingEntry(); | 306 NavigationEntry* pending_entry = controller->GetPendingEntry(); |
306 if (pending_entry) { | 307 if (pending_entry) { |
307 Profile* profile = Profile::FromWebUI(web_ui_); | 308 Profile* profile = Profile::FromWebUI(web_ui_); |
308 pending_entry->SetURL( | 309 pending_entry->SetURL( |
309 CloudPrintURL(profile).GetCloudPrintServiceDialogURL()); | 310 CloudPrintURL(profile).GetCloudPrintServiceDialogURL()); |
310 } | 311 } |
311 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, | 312 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, |
312 content::Source<NavigationController>(controller)); | 313 content::Source<NavigationController>(controller)); |
313 } | 314 } |
314 | 315 |
315 void CloudPrintFlowHandler::Observe( | 316 void CloudPrintFlowHandler::Observe( |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 file_type, | 720 file_type, |
720 false, | 721 false, |
721 delete_on_close); | 722 delete_on_close); |
722 return true; | 723 return true; |
723 } | 724 } |
724 } | 725 } |
725 return false; | 726 return false; |
726 } | 727 } |
727 | 728 |
728 } // end namespace | 729 } // end namespace |
OLD | NEW |