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

Side by Side Diff: ui/webui/web_ui_util.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new usage of scale in FastShowPickler Created 7 years, 2 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 | « ui/views/win/hwnd_message_handler.cc ('k') | no next file » | 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) 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 "ui/webui/web_ui_util.h" 5 #include "ui/webui/web_ui_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 double scale = 0; 91 double scale = 0;
92 std::string stripped; 92 std::string stripped;
93 identifier.substr(0, identifier.length() - 1).CopyToString(&stripped); 93 identifier.substr(0, identifier.length() - 1).CopyToString(&stripped);
94 if (!base::StringToDouble(stripped, &scale)) { 94 if (!base::StringToDouble(stripped, &scale)) {
95 LOG(WARNING) << "Invalid scale factor format: " << identifier; 95 LOG(WARNING) << "Invalid scale factor format: " << identifier;
96 return false; 96 return false;
97 } 97 }
98 98
99 *scale_factor = ui::GetScaleFactorFromScale(static_cast<float>(scale)); 99 *scale_factor = ui::GetSupportedScaleFactor(static_cast<float>(scale));
100 return true; 100 return true;
101 } 101 }
102 102
103 void ParsePathAndScale(const GURL& url, 103 void ParsePathAndScale(const GURL& url,
104 std::string* path, 104 std::string* path,
105 ui::ScaleFactor* scale_factor) { 105 ui::ScaleFactor* scale_factor) {
106 *path = net::UnescapeURLComponent(url.path().substr(1), 106 *path = net::UnescapeURLComponent(url.path().substr(1),
107 (net::UnescapeRule::URL_SPECIAL_CHARS | 107 (net::UnescapeRule::URL_SPECIAL_CHARS |
108 net::UnescapeRule::SPACES)); 108 net::UnescapeRule::SPACES));
109 if (scale_factor) 109 if (scale_factor)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #endif 148 #endif
149 149
150 localized_strings->SetString("fontfamily", font_family); 150 localized_strings->SetString("fontfamily", font_family);
151 localized_strings->SetString("fontsize", 151 localized_strings->SetString("fontsize",
152 l10n_util::GetStringUTF8(web_font_size_id)); 152 l10n_util::GetStringUTF8(web_font_size_id));
153 localized_strings->SetString("textdirection", 153 localized_strings->SetString("textdirection",
154 base::i18n::IsRTL() ? "rtl" : "ltr"); 154 base::i18n::IsRTL() ? "rtl" : "ltr");
155 } 155 }
156 156
157 } // namespace webui 157 } // namespace webui
OLDNEW
« no previous file with comments | « ui/views/win/hwnd_message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698