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 "ash/shelf/app_list_button.h" | 5 #include "ash/shelf/app_list_button.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
8 #include "ash/shelf/shelf_button.h" | 8 #include "ash/shelf/shelf_button.h" |
9 #include "ash/shelf/shelf_button_host.h" | 9 #include "ash/shelf/shelf_button_host.h" |
10 #include "ash/shelf/shelf_item_types.h" | 10 #include "ash/shelf/shelf_item_types.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; | 133 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; |
134 } else { | 134 } else { |
135 if (shelf_widget_->GetDimsShelf()) | 135 if (shelf_widget_->GetDimsShelf()) |
136 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; | 136 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; |
137 else | 137 else |
138 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; | 138 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; |
139 } | 139 } |
140 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 140 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
141 const gfx::ImageSkia* background_image = | 141 const gfx::ImageSkia* background_image = |
142 rb.GetImageNamed(background_image_id).ToImageSkia(); | 142 rb.GetImageNamed(background_image_id).ToImageSkia(); |
| 143 // TODO(mgiuca): When the "classic" app list is removed, also remove this |
| 144 // resource and its icon file. |
| 145 int foreground_image_id = app_list::switches::IsExperimentalAppListEnabled() |
| 146 ? IDR_ASH_SHELF_ICON_APPLIST |
| 147 : IDR_ASH_SHELF_ICON_APPLIST_CLASSIC; |
143 const gfx::ImageSkia* forground_image = | 148 const gfx::ImageSkia* forground_image = |
144 rb.GetImageNamed(IDR_ASH_SHELF_ICON_APPLIST).ToImageSkia(); | 149 rb.GetImageNamed(foreground_image_id).ToImageSkia(); |
145 | 150 |
146 gfx::Rect contents_bounds = GetContentsBounds(); | 151 gfx::Rect contents_bounds = GetContentsBounds(); |
147 gfx::Rect background_bounds, forground_bounds; | 152 gfx::Rect background_bounds, forground_bounds; |
148 | 153 |
149 ShelfAlignment alignment = shelf_widget_->GetAlignment(); | 154 ShelfAlignment alignment = shelf_widget_->GetAlignment(); |
150 background_bounds.set_size(background_image->size()); | 155 background_bounds.set_size(background_image->size()); |
151 if (alignment == SHELF_ALIGNMENT_LEFT) { | 156 if (alignment == SHELF_ALIGNMENT_LEFT) { |
152 background_bounds.set_x(contents_bounds.width() - | 157 background_bounds.set_x(contents_bounds.width() - |
153 ShelfLayoutManager::kShelfItemInset - background_image->width()); | 158 ShelfLayoutManager::kShelfItemInset - background_image->width()); |
154 background_bounds.set_y(contents_bounds.y() + | 159 background_bounds.set_y(contents_bounds.y() + |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 193 |
189 void AppListButton::SetDrawBackgroundAsActive( | 194 void AppListButton::SetDrawBackgroundAsActive( |
190 bool draw_background_as_active) { | 195 bool draw_background_as_active) { |
191 if (draw_background_as_active_ == draw_background_as_active) | 196 if (draw_background_as_active_ == draw_background_as_active) |
192 return; | 197 return; |
193 draw_background_as_active_ = draw_background_as_active; | 198 draw_background_as_active_ = draw_background_as_active; |
194 SchedulePaint(); | 199 SchedulePaint(); |
195 } | 200 } |
196 | 201 |
197 } // namespace ash | 202 } // namespace ash |
OLD | NEW |