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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_NONE; |
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 *scale_factor = web_ui_util::ParseScaleFactor(iter->second); | 85 web_ui_util::ParseScaleFactor(iter->second, scale_factor); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 } // namespace | 89 } // namespace |
90 | 90 |
91 FileIconSource::FileIconSource() | 91 FileIconSource::FileIconSource() |
92 : DataSource(kFileIconPath, MessageLoop::current()) {} | 92 : DataSource(kFileIconPath, MessageLoop::current()) {} |
93 | 93 |
94 FileIconSource::~FileIconSource() { | 94 FileIconSource::~FileIconSource() { |
95 cancelable_consumer_.CancelAllRequests(); | 95 cancelable_consumer_.CancelAllRequests(); |
(...skipping 56 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 |