| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cloud_print/cloud_print_setup_flow.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 std::string json_args; | 78 std::string json_args; |
| 79 base::JSONWriter::Write(&args, &json_args); | 79 base::JSONWriter::Write(&args, &json_args); |
| 80 | 80 |
| 81 CloudPrintSetupFlow* flow = new CloudPrintSetupFlow(json_args, profile, | 81 CloudPrintSetupFlow* flow = new CloudPrintSetupFlow(json_args, profile, |
| 82 delegate, setup_done); | 82 delegate, setup_done); |
| 83 // We may not always have a browser. This can happen when we are being | 83 // We may not always have a browser. This can happen when we are being |
| 84 // invoked in the context of a "token expired" notfication. If we don't have | 84 // invoked in the context of a "token expired" notfication. If we don't have |
| 85 // a brower, use the underlying dialog system to show the dialog without | 85 // a brower, use the underlying dialog system to show the dialog without |
| 86 // using a browser. | 86 // using a browser. |
| 87 if (!parent_window && browser && browser->window()) | 87 if (!parent_window && browser && browser->window()) |
| 88 parent_window = browser->window()->GetNativeHandle(); | 88 parent_window = browser->window()->GetNativeWindow(); |
| 89 browser::ShowWebDialog(parent_window, profile, browser, flow); | 89 browser::ShowWebDialog(parent_window, profile, browser, flow); |
| 90 return flow; | 90 return flow; |
| 91 } | 91 } |
| 92 | 92 |
| 93 CloudPrintSetupFlow::CloudPrintSetupFlow( | 93 CloudPrintSetupFlow::CloudPrintSetupFlow( |
| 94 const std::string& args, | 94 const std::string& args, |
| 95 Profile* profile, | 95 Profile* profile, |
| 96 const base::WeakPtr<Delegate>& delegate, | 96 const base::WeakPtr<Delegate>& delegate, |
| 97 bool setup_done) | 97 bool setup_done) |
| 98 : web_ui_(NULL), | 98 : web_ui_(NULL), |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( | 335 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( |
| 336 const string16& iframe_xpath, | 336 const string16& iframe_xpath, |
| 337 const string16& js) { | 337 const string16& js) { |
| 338 if (web_ui_) { | 338 if (web_ui_) { |
| 339 content::RenderViewHost* rvh = | 339 content::RenderViewHost* rvh = |
| 340 web_ui_->GetWebContents()->GetRenderViewHost(); | 340 web_ui_->GetWebContents()->GetRenderViewHost(); |
| 341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); | 341 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); |
| 342 } | 342 } |
| 343 } | 343 } |
| OLD | NEW |