Chromium Code Reviews| Index: chrome/browser/ui/webui/web_ui_util.cc |
| diff --git a/chrome/browser/ui/webui/web_ui_util.cc b/chrome/browser/ui/webui/web_ui_util.cc |
| index c1ba2d569ee41488412db026c8debb6b0d311be7..0c641c44af21681f529f4113efdf4dafb3d4adec 100644 |
| --- a/chrome/browser/ui/webui/web_ui_util.cc |
| +++ b/chrome/browser/ui/webui/web_ui_util.cc |
| @@ -79,12 +79,16 @@ WindowOpenDisposition GetDispositionFromClick(const ListValue* args, |
| } |
| -ui::ScaleFactor ParseScaleFactor(const base::StringPiece& identifier) { |
| +bool ParseScaleFactor(const base::StringPiece& identifier, |
| + ui::ScaleFactor* scale_factor) { |
| + *scale_factor = ui::SCALE_FACTOR_NONE; |
| for (size_t i = 0; i < arraysize(kScaleFactorMap); i++) { |
| - if (identifier == kScaleFactorMap[i].name) |
| - return kScaleFactorMap[i].scale_factor; |
| + if (identifier == kScaleFactorMap[i].name) { |
| + *scale_factor = kScaleFactorMap[i].scale_factor; |
| + return true; |
| + } |
| } |
| - return ui::SCALE_FACTOR_NONE; |
| + return false; |
| } |
| void ParsePathAndScale(const GURL& url, |
| @@ -100,13 +104,16 @@ void ParsePathAndScale(const GURL& url, |
| std::size_t pos = path->rfind('@'); |
| if (pos != std::string::npos) { |
| base::StringPiece stripped_path(*path); |
| - if (scale_factor) { |
| - *scale_factor = ParseScaleFactor(stripped_path.substr( |
| - pos + 1, stripped_path.length() - pos - 1)); |
| + ui::ScaleFactor factor; |
| + |
| + if (ParseScaleFactor(stripped_path.substr( |
| + pos + 1, stripped_path.length() - pos - 1), &factor)) { |
|
Evan Stade
2012/08/16 18:57:49
2 more indent
sadrul
2012/08/16 19:00:33
Done.
|
| + // Strip scale factor specification from path. |
| + stripped_path.remove_suffix(stripped_path.length() - pos); |
| + stripped_path.CopyToString(path); |
| } |
| - // Strip scale factor specification from path. |
| - stripped_path.remove_suffix(stripped_path.length() - pos); |
| - stripped_path.CopyToString(path); |
| + if (scale_factor) |
| + *scale_factor = factor; |
| } |
| } |