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_item_types.h" | 8 #include "ash/shelf/shelf_item_types.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // resource and its icon file. | 116 // resource and its icon file. |
117 int foreground_image_id = app_list::switches::IsExperimentalAppListEnabled() | 117 int foreground_image_id = app_list::switches::IsExperimentalAppListEnabled() |
118 ? IDR_ASH_SHELF_ICON_APPLIST | 118 ? IDR_ASH_SHELF_ICON_APPLIST |
119 : IDR_ASH_SHELF_ICON_APPLIST_CLASSIC; | 119 : IDR_ASH_SHELF_ICON_APPLIST_CLASSIC; |
120 const gfx::ImageSkia* forground_image = | 120 const gfx::ImageSkia* forground_image = |
121 rb.GetImageNamed(foreground_image_id).ToImageSkia(); | 121 rb.GetImageNamed(foreground_image_id).ToImageSkia(); |
122 | 122 |
123 gfx::Rect contents_bounds = GetContentsBounds(); | 123 gfx::Rect contents_bounds = GetContentsBounds(); |
124 gfx::Rect background_bounds, forground_bounds; | 124 gfx::Rect background_bounds, forground_bounds; |
125 | 125 |
126 ShelfAlignment alignment = shelf_view_->shelf()->alignment(); | 126 wm::ShelfAlignment alignment = shelf_view_->shelf()->alignment(); |
127 background_bounds.set_size(background_image->size()); | 127 background_bounds.set_size(background_image->size()); |
128 if (alignment == SHELF_ALIGNMENT_LEFT) { | 128 if (alignment == wm::SHELF_ALIGNMENT_LEFT) { |
129 background_bounds.set_x(contents_bounds.width() - | 129 background_bounds.set_x(contents_bounds.width() - |
130 ShelfLayoutManager::kShelfItemInset - background_image->width()); | 130 ShelfLayoutManager::kShelfItemInset - background_image->width()); |
131 background_bounds.set_y(contents_bounds.y() + | 131 background_bounds.set_y(contents_bounds.y() + |
132 (contents_bounds.height() - background_image->height()) / 2); | 132 (contents_bounds.height() - background_image->height()) / 2); |
133 } else if(alignment == SHELF_ALIGNMENT_RIGHT) { | 133 } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { |
134 background_bounds.set_x(ShelfLayoutManager::kShelfItemInset); | 134 background_bounds.set_x(ShelfLayoutManager::kShelfItemInset); |
135 background_bounds.set_y(contents_bounds.y() + | 135 background_bounds.set_y(contents_bounds.y() + |
136 (contents_bounds.height() - background_image->height()) / 2); | 136 (contents_bounds.height() - background_image->height()) / 2); |
137 } else { | 137 } else { |
138 background_bounds.set_y(ShelfLayoutManager::kShelfItemInset); | 138 background_bounds.set_y(ShelfLayoutManager::kShelfItemInset); |
139 background_bounds.set_x(contents_bounds.x() + | 139 background_bounds.set_x(contents_bounds.x() + |
140 (contents_bounds.width() - background_image->width()) / 2); | 140 (contents_bounds.width() - background_image->width()) / 2); |
141 } | 141 } |
142 | 142 |
143 forground_bounds.set_size(forground_image->size()); | 143 forground_bounds.set_size(forground_image->size()); |
(...skipping 21 matching lines...) Expand all Loading... |
165 | 165 |
166 void AppListButton::SetDrawBackgroundAsActive( | 166 void AppListButton::SetDrawBackgroundAsActive( |
167 bool draw_background_as_active) { | 167 bool draw_background_as_active) { |
168 if (draw_background_as_active_ == draw_background_as_active) | 168 if (draw_background_as_active_ == draw_background_as_active) |
169 return; | 169 return; |
170 draw_background_as_active_ = draw_background_as_active; | 170 draw_background_as_active_ = draw_background_as_active; |
171 SchedulePaint(); | 171 SchedulePaint(); |
172 } | 172 } |
173 | 173 |
174 } // namespace ash | 174 } // namespace ash |
OLD | NEW |