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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc

Issue 6121004: Remove wstring from gfx. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.cc ('k') | chrome/browser/remoting/setup_flow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "app/gfx/font_util.h" 7 #include "app/gfx/font_util.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/singleton.h" 9 #include "base/singleton.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Create the message handler only after we are asked, the caller is 126 // Create the message handler only after we are asked, the caller is
127 // responsible for deleting the objects. 127 // responsible for deleting the objects.
128 handlers->push_back( 128 handlers->push_back(
129 new CloudPrintSetupMessageHandler( 129 new CloudPrintSetupMessageHandler(
130 const_cast<CloudPrintSetupFlow*>(this))); 130 const_cast<CloudPrintSetupFlow*>(this)));
131 } 131 }
132 132
133 void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const { 133 void CloudPrintSetupFlow::GetDialogSize(gfx::Size* size) const {
134 PrefService* prefs = profile_->GetPrefs(); 134 PrefService* prefs = profile_->GetPrefs();
135 gfx::Font approximate_web_font( 135 gfx::Font approximate_web_font(
136 UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), 136 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
137 prefs->GetInteger(prefs::kWebKitDefaultFontSize)); 137 prefs->GetInteger(prefs::kWebKitDefaultFontSize));
138 138
139 if (setup_done_) { 139 if (setup_done_) {
140 *size = gfx::GetLocalizedContentsSizeForFont( 140 *size = gfx::GetLocalizedContentsSizeForFont(
141 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS, 141 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS,
142 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_HEIGHT_LINES, 142 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_HEIGHT_LINES,
143 approximate_web_font); 143 approximate_web_font);
144 } else { 144 } else {
145 *size = gfx::GetLocalizedContentsSizeForFont( 145 *size = gfx::GetLocalizedContentsSizeForFont(
146 IDS_CLOUD_PRINT_SETUP_WIZARD_WIDTH_CHARS, 146 IDS_CLOUD_PRINT_SETUP_WIZARD_WIDTH_CHARS,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 std::wstring message = 275 std::wstring message =
276 UTF16ToWideHack(l10n_util::GetStringFUTF16(IDS_CLOUD_PRINT_SETUP_DONE, 276 UTF16ToWideHack(l10n_util::GetStringFUTF16(IDS_CLOUD_PRINT_SETUP_DONE,
277 product_name, 277 product_name,
278 UTF8ToUTF16(login_))); 278 UTF8ToUTF16(login_)));
279 std::wstring javascript = L"cloudprint.setMessage('" + message + L"');"; 279 std::wstring javascript = L"cloudprint.setMessage('" + message + L"');";
280 ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript); 280 ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript);
281 281
282 if (dom_ui_) { 282 if (dom_ui_) {
283 PrefService* prefs = profile_->GetPrefs(); 283 PrefService* prefs = profile_->GetPrefs();
284 gfx::Font approximate_web_font( 284 gfx::Font approximate_web_font(
285 UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)), 285 UTF8ToUTF16(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
286 prefs->GetInteger(prefs::kWebKitDefaultFontSize)); 286 prefs->GetInteger(prefs::kWebKitDefaultFontSize));
287 gfx::Size done_size = gfx::GetLocalizedContentsSizeForFont( 287 gfx::Size done_size = gfx::GetLocalizedContentsSizeForFont(
288 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS, 288 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_WIDTH_CHARS,
289 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_HEIGHT_LINES, 289 IDS_CLOUD_PRINT_SETUP_WIZARD_DONE_HEIGHT_LINES,
290 approximate_web_font); 290 approximate_web_font);
291 291
292 FundamentalValue new_width(done_size.width()); 292 FundamentalValue new_width(done_size.width());
293 FundamentalValue new_height(done_size.height()); 293 FundamentalValue new_height(done_size.height());
294 dom_ui_->CallJavascriptFunction(L"cloudprint.showSetupDone", 294 dom_ui_->CallJavascriptFunction(L"cloudprint.showSetupDone",
295 new_width, new_height); 295 new_width, new_height);
296 } 296 }
297 297
298 ExecuteJavascriptInIFrame(kDoneIframeXPath, L"cloudprint.onPageShown();"); 298 ExecuteJavascriptInIFrame(kDoneIframeXPath, L"cloudprint.onPageShown();");
299 } 299 }
300 300
301 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame( 301 void CloudPrintSetupFlow::ExecuteJavascriptInIFrame(
302 const std::wstring& iframe_xpath, 302 const std::wstring& iframe_xpath,
303 const std::wstring& js) { 303 const std::wstring& js) {
304 if (dom_ui_) { 304 if (dom_ui_) {
305 RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host(); 305 RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host();
306 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js); 306 rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js);
307 } 307 }
308 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.cc ('k') | chrome/browser/remoting/setup_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698