OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 const GURL& image_url, | 841 const GURL& image_url, |
842 const std::vector<SkBitmap>& bitmaps, | 842 const std::vector<SkBitmap>& bitmaps, |
843 const std::vector<gfx::Size>& original_bitmap_sizes) { | 843 const std::vector<gfx::Size>& original_bitmap_sizes) { |
844 if (((image_url != app_icon_url_) && (image_url != window_icon_url_)) || | 844 if (((image_url != app_icon_url_) && (image_url != window_icon_url_)) || |
845 bitmaps.empty()) { | 845 bitmaps.empty()) { |
846 return; | 846 return; |
847 } | 847 } |
848 | 848 |
849 // Bitmaps are ordered largest to smallest. Choose the smallest bitmap | 849 // Bitmaps are ordered largest to smallest. Choose the smallest bitmap |
850 // whose height >= the preferred size. | 850 // whose height >= the preferred size. |
851 int largest_index = 0; | 851 size_t largest_index = 0; |
852 for (size_t i = 1; i < bitmaps.size(); ++i) { | 852 for (size_t i = 1; i < bitmaps.size(); ++i) { |
853 if (bitmaps[i].height() < app_delegate_->PreferredIconSize()) | 853 if (bitmaps[i].height() < app_delegate_->PreferredIconSize()) |
854 break; | 854 break; |
855 largest_index = i; | 855 largest_index = i; |
856 } | 856 } |
857 const SkBitmap& largest = bitmaps[largest_index]; | 857 const SkBitmap& largest = bitmaps[largest_index]; |
858 UpdateAppIcon(gfx::Image::CreateFrom1xBitmap(largest)); | 858 UpdateAppIcon(gfx::Image::CreateFrom1xBitmap(largest)); |
859 } | 859 } |
860 | 860 |
861 void AppWindow::OnExtensionIconImageChanged(IconImage* image) { | 861 void AppWindow::OnExtensionIconImageChanged(IconImage* image) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 region.bounds.x(), | 1155 region.bounds.x(), |
1156 region.bounds.y(), | 1156 region.bounds.y(), |
1157 region.bounds.right(), | 1157 region.bounds.right(), |
1158 region.bounds.bottom(), | 1158 region.bounds.bottom(), |
1159 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1159 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1160 } | 1160 } |
1161 return sk_region; | 1161 return sk_region; |
1162 } | 1162 } |
1163 | 1163 |
1164 } // namespace extensions | 1164 } // namespace extensions |
OLD | NEW |