OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/mus/shelf_delegate_mus.h" | 5 #include "ash/mus/shelf_delegate_mus.h" |
6 | 6 |
7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
8 #include "ash/shelf/shelf_item_delegate.h" | 8 #include "ash/shelf/shelf_item_delegate.h" |
9 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateMus); | 79 DISALLOW_COPY_AND_ASSIGN(ShelfItemDelegateMus); |
80 }; | 80 }; |
81 | 81 |
82 // Returns an icon image from a serialized SkBitmap, or the default shelf icon | 82 // Returns an icon image from a serialized SkBitmap, or the default shelf icon |
83 // image if the bitmap is empty. Assumes the bitmap is a 1x icon. | 83 // image if the bitmap is empty. Assumes the bitmap is a 1x icon. |
84 // TODO(jamescook): Support other scale factors. | 84 // TODO(jamescook): Support other scale factors. |
85 gfx::ImageSkia GetShelfIconFromBitmap( | 85 gfx::ImageSkia GetShelfIconFromBitmap( |
86 const mojo::Array<uint8_t>& serialized_bitmap) { | 86 const mojo::Array<uint8_t>& serialized_bitmap) { |
87 // Convert the data to an ImageSkia. | 87 // Convert the data to an ImageSkia. |
88 SkBitmap bitmap = mojo::ConvertTo<SkBitmap, const std::vector<uint8_t>>( | 88 SkBitmap bitmap = mojo::ConvertTo<SkBitmap>(serialized_bitmap.storage()); |
89 serialized_bitmap.storage()); | |
90 gfx::ImageSkia icon_image; | 89 gfx::ImageSkia icon_image; |
91 if (!bitmap.isNull()) { | 90 if (!bitmap.isNull()) { |
92 icon_image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 91 icon_image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
93 } else { | 92 } else { |
94 // Use default icon. | 93 // Use default icon. |
95 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 94 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
96 icon_image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); | 95 icon_image = *rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON); |
97 } | 96 } |
98 return icon_image; | 97 return icon_image; |
99 } | 98 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 DCHECK_GE(index, 0); | 236 DCHECK_GE(index, 0); |
238 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id); | 237 ShelfItems::const_iterator iter = model_->ItemByID(shelf_id); |
239 DCHECK(iter != model_->items().end()); | 238 DCHECK(iter != model_->items().end()); |
240 ShelfItem item = *iter; | 239 ShelfItem item = *iter; |
241 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING; | 240 item.status = has_focus ? STATUS_ACTIVE : STATUS_RUNNING; |
242 model_->Set(index, item); | 241 model_->Set(index, item); |
243 } | 242 } |
244 | 243 |
245 } // namespace sysui | 244 } // namespace sysui |
246 } // namespace ash | 245 } // namespace ash |
OLD | NEW |