| 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/extensions/extension_icon_image.h" | 5 #include "chrome/browser/extensions/extension_icon_image.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 // If there is no resource found, bail out and notify observer of failure. | 123 // If there is no resource found, bail out and notify observer of failure. |
| 124 if (resource.empty()) { | 124 if (resource.empty()) { |
| 125 if (observer_) | 125 if (observer_) |
| 126 observer_->OnIconImageLoadFailed(this, scale_factor); | 126 observer_->OnIconImageLoadFailed(this, scale_factor); |
| 127 return; | 127 return; |
| 128 } | 128 } |
| 129 | 129 |
| 130 int id = tracker_.next_id(); | 130 int id = tracker_.next_id(); |
| 131 <<<<<<< HEAD |
| 131 load_map_[id] = scale_factor; | 132 load_map_[id] = scale_factor; |
| 132 | 133 |
| 134 ======= |
| 135 load_map_[id].scale_factor = scale_factor; |
| 136 load_map_[id].is_async = false; |
| 137 LOG(ERROR) << "load image"; |
| 138 >>>>>>> 0b2657e... remove default icon test |
| 133 std::vector<ImageLoadingTracker::ImageRepresentation> info_list; | 139 std::vector<ImageLoadingTracker::ImageRepresentation> info_list; |
| 134 info_list.push_back(ImageLoadingTracker::ImageRepresentation( | 140 info_list.push_back(ImageLoadingTracker::ImageRepresentation( |
| 135 resource, | 141 resource, |
| 136 ImageLoadingTracker::ImageRepresentation::RESIZE_WHEN_LARGER, | 142 ImageLoadingTracker::ImageRepresentation::RESIZE_WHEN_LARGER, |
| 137 desired_size_in_dip_.Scale(scale), | 143 desired_size_in_dip_.Scale(scale), |
| 138 scale_factor)); | 144 scale_factor)); |
| 139 tracker_.LoadImages(extension_, info_list, ImageLoadingTracker::DONT_CACHE); | 145 tracker_.LoadImages(extension_, info_list, ImageLoadingTracker::DONT_CACHE); |
| 140 } | 146 } |
| 141 | 147 |
| 142 void IconImage::OnImageLoaded(const gfx::Image& image, | 148 void IconImage::OnImageLoaded(const gfx::Image& image, |
| 143 const std::string& extension_id, | 149 const std::string& extension_id, |
| 144 int index) { | 150 int index) { |
| 151 LOG(ERROR) << "image loaded"; |
| 145 LoadMap::iterator load_map_it = load_map_.find(index); | 152 LoadMap::iterator load_map_it = load_map_.find(index); |
| 146 DCHECK(load_map_it != load_map_.end()); | 153 DCHECK(load_map_it != load_map_.end()); |
| 147 | 154 |
| 148 ui::ScaleFactor scale_factor = load_map_it->second; | 155 ui::ScaleFactor scale_factor = load_map_it->second; |
| 149 | 156 |
| 150 load_map_.erase(load_map_it); | 157 load_map_.erase(load_map_it); |
| 151 | 158 |
| 152 if (image.IsEmpty()) { | 159 if (image.IsEmpty()) { |
| 153 // There waas an error loading the image. | 160 // There waas an error loading the image. |
| 154 if (observer_) | 161 if (observer_) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 171 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED); | 178 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_UNLOADED); |
| 172 | 179 |
| 173 const Extension* extension = | 180 const Extension* extension = |
| 174 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; | 181 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
| 175 | 182 |
| 176 if (extension_ == extension) | 183 if (extension_ == extension) |
| 177 extension_ = NULL; | 184 extension_ = NULL; |
| 178 } | 185 } |
| 179 | 186 |
| 180 } // namespace extensions | 187 } // namespace extensions |
| OLD | NEW |