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/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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 13 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
14 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 14 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
15 #include "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.
h" | 15 #include "chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.
h" |
16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h" | 16 #include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h" |
17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/service/service_process_control.h" | 19 #include "chrome/browser/service/service_process_control.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/browser_dialogs.h" | 21 #include "chrome/browser/ui/browser_dialogs.h" |
22 #include "chrome/browser/ui/browser_list.h" | 22 #include "chrome/browser/ui/browser_list.h" |
23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/browser/ui/dialog_style.h" |
24 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 25 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
25 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" | 26 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" |
26 #include "chrome/common/net/gaia/gaia_constants.h" | 27 #include "chrome/common/net/gaia/gaia_constants.h" |
27 #include "chrome/common/net/gaia/google_service_auth_error.h" | 28 #include "chrome/common/net/gaia/google_service_auth_error.h" |
28 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/service_messages.h" | 30 #include "chrome/common/service_messages.h" |
30 #include "content/browser/renderer_host/render_view_host.h" | 31 #include "content/browser/renderer_host/render_view_host.h" |
31 #include "content/browser/tab_contents/tab_contents.h" | 32 #include "content/browser/tab_contents/tab_contents.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 delegate, setup_done); | 76 delegate, setup_done); |
76 // We may not always have a browser. This can happen when we are being | 77 // We may not always have a browser. This can happen when we are being |
77 // invoked in the context of a "token expired" notfication. If we don't have | 78 // invoked in the context of a "token expired" notfication. If we don't have |
78 // a brower, use the underlying dialog system to show the dialog without | 79 // a brower, use the underlying dialog system to show the dialog without |
79 // using a browser. | 80 // using a browser. |
80 if (!parent_window) { | 81 if (!parent_window) { |
81 Browser* browser = BrowserList::GetLastActive(); | 82 Browser* browser = BrowserList::GetLastActive(); |
82 if (browser && browser->window()) | 83 if (browser && browser->window()) |
83 parent_window = browser->window()->GetNativeHandle(); | 84 parent_window = browser->window()->GetNativeHandle(); |
84 } | 85 } |
85 browser::ShowHtmlDialog(parent_window, profile, flow); | 86 browser::ShowHtmlDialog(parent_window, profile, flow, STYLE_GENERIC); |
86 return flow; | 87 return flow; |
87 } | 88 } |
88 | 89 |
89 CloudPrintSetupFlow::CloudPrintSetupFlow( | 90 CloudPrintSetupFlow::CloudPrintSetupFlow( |
90 const std::string& args, | 91 const std::string& args, |
91 Profile* profile, | 92 Profile* profile, |
92 const base::WeakPtr<Delegate>& delegate, | 93 const base::WeakPtr<Delegate>& delegate, |
93 bool setup_done) | 94 bool setup_done) |
94 : web_ui_(NULL), | 95 : web_ui_(NULL), |
95 dialog_start_args_(args), | 96 dialog_start_args_(args), |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 327 } |
327 | 328 |
328 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( | 329 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( |
329 const string16& iframe_xpath, | 330 const string16& iframe_xpath, |
330 const string16& js) { | 331 const string16& js) { |
331 if (web_ui_) { | 332 if (web_ui_) { |
332 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); | 333 RenderViewHost* rvh = web_ui_->tab_contents()->render_view_host(); |
333 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); | 334 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); |
334 } | 335 } |
335 } | 336 } |
OLD | NEW |