OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell/panel_window.h" | 8 #include "ash/shell/panel_window.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 // Draw a line first. | 210 // Draw a line first. |
211 int y = owner_->height() + 1; | 211 int y = owner_->height() + 1; |
212 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(), | 212 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(), |
213 kBottomLineHeight), kBorderDarkColor); | 213 kBottomLineHeight), kBorderDarkColor); |
214 | 214 |
215 // Now, draw a shadow. | 215 // Now, draw a shadow. |
216 canvas->FillRect(gfx::Rect(kLeftPadding + kShadowOffset, y, | 216 canvas->FillRect(gfx::Rect(kLeftPadding + kShadowOffset, y, |
217 owner_->width() - kShadowOffset, kShadowHeight), | 217 owner_->width() - kShadowOffset, kShadowHeight), |
218 kShadowColor); | 218 kShadowColor); |
219 | 219 |
220 // Draw the arrow. | 220 internal::ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
221 int left_base_x = owner_->width() - kArrowPaddingFromRight - kArrowWidth; | 221 if (shelf->visibility_state() == internal::ShelfLayoutManager::VISIBLE || |
222 int left_base_y = y; | 222 (shelf->visibility_state() == internal::ShelfLayoutManager::AUTO_HIDE && |
223 int tip_x = left_base_x + kArrowWidth / 2; | 223 shelf->auto_hide_state() == |
224 int tip_y = left_base_y + kArrowHeight; | 224 internal::ShelfLayoutManager::AUTO_HIDE_SHOWN)) { |
sadrul
2012/03/28 05:38:47
Is there a better way of determining if the tray/s
sky
2012/03/28 15:31:11
No. I'm not opposed to you adding a method is_visi
| |
225 SkPath path; | 225 // Draw the arrow. |
226 path.incReserve(4); | 226 int left_base_x = owner_->width() - kArrowPaddingFromRight - kArrowWidth; |
227 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y)); | 227 int left_base_y = y; |
228 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); | 228 int tip_x = left_base_x + kArrowWidth / 2; |
229 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), | 229 int tip_y = left_base_y + kArrowHeight; |
230 SkIntToScalar(left_base_y)); | 230 SkPath path; |
231 path.incReserve(4); | |
232 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y)); | |
233 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); | |
234 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), | |
235 SkIntToScalar(left_base_y)); | |
231 | 236 |
232 SkPaint paint; | 237 SkPaint paint; |
233 paint.setStyle(SkPaint::kFill_Style); | 238 paint.setStyle(SkPaint::kFill_Style); |
234 paint.setColor(kBackgroundColor); | 239 paint.setColor(kBackgroundColor); |
235 canvas->sk_canvas()->drawPath(path, paint); | 240 canvas->sk_canvas()->drawPath(path, paint); |
236 | 241 |
237 // Now the draw the outline. | 242 // Now the draw the outline. |
238 paint.setStyle(SkPaint::kStroke_Style); | 243 paint.setStyle(SkPaint::kStroke_Style); |
239 paint.setColor(kBorderDarkColor); | 244 paint.setColor(kBorderDarkColor); |
240 canvas->sk_canvas()->drawPath(path, paint); | 245 canvas->sk_canvas()->drawPath(path, paint); |
246 } | |
241 } | 247 } |
242 | 248 |
243 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE { | 249 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE { |
244 insets->Set(0, 0, kArrowHeight, 0); | 250 insets->Set(0, 0, kArrowHeight, 0); |
245 } | 251 } |
246 | 252 |
247 views::View* owner_; | 253 views::View* owner_; |
248 | 254 |
249 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleBorder); | 255 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleBorder); |
250 }; | 256 }; |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 popup_->Hide(); | 666 popup_->Hide(); |
661 } | 667 } |
662 } | 668 } |
663 return base::EVENT_CONTINUE; | 669 return base::EVENT_CONTINUE; |
664 } | 670 } |
665 | 671 |
666 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { | 672 void SystemTray::DidProcessEvent(const base::NativeEvent& event) { |
667 } | 673 } |
668 | 674 |
669 } // namespace ash | 675 } // namespace ash |
OLD | NEW |