OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overflow_button.h" | 5 #include "ash/shelf/overflow_button.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 int background_image_id = 0; | 85 int background_image_id = 0; |
86 if (shelf_->IsShowingOverflowBubble()) | 86 if (shelf_->IsShowingOverflowBubble()) |
87 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; | 87 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_PRESSED; |
88 else if (shelf_->shelf_widget()->GetDimsShelf()) | 88 else if (shelf_->shelf_widget()->GetDimsShelf()) |
89 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; | 89 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_ON_BLACK; |
90 else | 90 else |
91 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; | 91 background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; |
92 | 92 |
93 const gfx::ImageSkia* background = | 93 const gfx::ImageSkia* background = |
94 rb.GetImageNamed(background_image_id).ToImageSkia(); | 94 rb.GetImageNamed(background_image_id).ToImageSkia(); |
95 ShelfAlignment alignment = shelf_->alignment(); | 95 wm::ShelfAlignment alignment = shelf_->alignment(); |
96 if (alignment == SHELF_ALIGNMENT_LEFT) { | 96 if (alignment == wm::SHELF_ALIGNMENT_LEFT) { |
97 bounds = gfx::Rect( | 97 bounds = gfx::Rect( |
98 bounds.right() - background->width() - | 98 bounds.right() - background->width() - |
99 ShelfLayoutManager::kShelfItemInset, | 99 ShelfLayoutManager::kShelfItemInset, |
100 bounds.y() + (bounds.height() - background->height()) / 2, | 100 bounds.y() + (bounds.height() - background->height()) / 2, |
101 background->width(), background->height()); | 101 background->width(), background->height()); |
102 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { | 102 } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { |
103 bounds = gfx::Rect( | 103 bounds = gfx::Rect( |
104 bounds.x() + ShelfLayoutManager::kShelfItemInset, | 104 bounds.x() + ShelfLayoutManager::kShelfItemInset, |
105 bounds.y() + (bounds.height() - background->height()) / 2, | 105 bounds.y() + (bounds.height() - background->height()) / 2, |
106 background->width(), background->height()); | 106 background->width(), background->height()); |
107 } else { | 107 } else { |
108 bounds = gfx::Rect( | 108 bounds = gfx::Rect( |
109 bounds.x() + (bounds.width() - background->width()) / 2, | 109 bounds.x() + (bounds.width() - background->width()) / 2, |
110 bounds.y() + ShelfLayoutManager::kShelfItemInset, | 110 bounds.y() + ShelfLayoutManager::kShelfItemInset, |
111 background->width(), background->height()); | 111 background->width(), background->height()); |
112 } | 112 } |
113 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); | 113 canvas->DrawImageInt(*background, bounds.x(), bounds.y()); |
114 | 114 |
115 if (height() < kButtonHoverSize) | 115 if (height() < kButtonHoverSize) |
116 return; | 116 return; |
117 | 117 |
118 const gfx::ImageSkia* image = NULL; | 118 const gfx::ImageSkia* image = NULL; |
119 | 119 |
120 switch(alignment) { | 120 switch(alignment) { |
121 case SHELF_ALIGNMENT_LEFT: | 121 case wm::SHELF_ALIGNMENT_LEFT: |
122 if (left_image_.isNull()) { | 122 if (left_image_.isNull()) { |
123 left_image_ = gfx::ImageSkiaOperations::CreateRotatedImage( | 123 left_image_ = gfx::ImageSkiaOperations::CreateRotatedImage( |
124 *bottom_image_, SkBitmapOperations::ROTATION_90_CW); | 124 *bottom_image_, SkBitmapOperations::ROTATION_90_CW); |
125 } | 125 } |
126 image = &left_image_; | 126 image = &left_image_; |
127 break; | 127 break; |
128 case SHELF_ALIGNMENT_RIGHT: | 128 case wm::SHELF_ALIGNMENT_RIGHT: |
129 if (right_image_.isNull()) { | 129 if (right_image_.isNull()) { |
130 right_image_ = gfx::ImageSkiaOperations::CreateRotatedImage( | 130 right_image_ = gfx::ImageSkiaOperations::CreateRotatedImage( |
131 *bottom_image_, SkBitmapOperations::ROTATION_270_CW); | 131 *bottom_image_, SkBitmapOperations::ROTATION_270_CW); |
132 } | 132 } |
133 image = &right_image_; | 133 image = &right_image_; |
134 break; | 134 break; |
135 default: | 135 default: |
136 image = bottom_image_; | 136 image = bottom_image_; |
137 break; | 137 break; |
138 } | 138 } |
139 | 139 |
140 canvas->DrawImageInt(*image, | 140 canvas->DrawImageInt(*image, |
141 bounds.x() + ((bounds.width() - image->width()) / 2), | 141 bounds.x() + ((bounds.width() - image->width()) / 2), |
142 bounds.y() + ((bounds.height() - image->height()) / 2)); | 142 bounds.y() + ((bounds.height() - image->height()) / 2)); |
143 } | 143 } |
144 | 144 |
145 } // namespace ash | 145 } // namespace ash |
OLD | NEW |