| 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/ui/webui/fileicon_source.h" | 5 #include "chrome/browser/ui/webui/fileicon_source.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // Simple parser for data on the query. | 69 // Simple parser for data on the query. |
| 70 void ParseQueryParams(const std::string& query, | 70 void ParseQueryParams(const std::string& query, |
| 71 ui::ScaleFactor* scale_factor, | 71 ui::ScaleFactor* scale_factor, |
| 72 IconLoader::IconSize* icon_size) { | 72 IconLoader::IconSize* icon_size) { |
| 73 typedef std::pair<std::string, std::string> KVPair; | 73 typedef std::pair<std::string, std::string> KVPair; |
| 74 std::vector<KVPair> parameters; | 74 std::vector<KVPair> parameters; |
| 75 if (icon_size) | 75 if (icon_size) |
| 76 *icon_size = IconLoader::NORMAL; | 76 *icon_size = IconLoader::NORMAL; |
| 77 if (scale_factor) | 77 if (scale_factor) |
| 78 *scale_factor = ui::SCALE_FACTOR_NONE; | 78 *scale_factor = ui::SCALE_FACTOR_100P; |
| 79 base::SplitStringIntoKeyValuePairs(query, '=', '&', ¶meters); | 79 base::SplitStringIntoKeyValuePairs(query, '=', '&', ¶meters); |
| 80 for (std::vector<KVPair>::const_iterator iter = parameters.begin(); | 80 for (std::vector<KVPair>::const_iterator iter = parameters.begin(); |
| 81 iter != parameters.end(); ++iter) { | 81 iter != parameters.end(); ++iter) { |
| 82 if (icon_size && iter->first == kIconSize) | 82 if (icon_size && iter->first == kIconSize) |
| 83 *icon_size = SizeStringToIconSize(iter->second); | 83 *icon_size = SizeStringToIconSize(iter->second); |
| 84 else if (scale_factor && iter->first == kScaleFactor) | 84 else if (scale_factor && iter->first == kScaleFactor) |
| 85 web_ui_util::ParseScaleFactor(iter->second, scale_factor); | 85 web_ui_util::ParseScaleFactor(iter->second, scale_factor); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 icon->ToImageSkia()->GetRepresentation( | 152 icon->ToImageSkia()->GetRepresentation( |
| 153 details.scale_factor).sk_bitmap(), | 153 details.scale_factor).sk_bitmap(), |
| 154 false, &icon_data->data()); | 154 false, &icon_data->data()); |
| 155 | 155 |
| 156 SendResponse(details.request_id, icon_data); | 156 SendResponse(details.request_id, icon_data); |
| 157 } else { | 157 } else { |
| 158 // TODO(glen): send a dummy icon. | 158 // TODO(glen): send a dummy icon. |
| 159 SendResponse(details.request_id, NULL); | 159 SendResponse(details.request_id, NULL); |
| 160 } | 160 } |
| 161 } | 161 } |
| OLD | NEW |