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_bubble.h" | 5 #include "ash/system/tray/system_tray_bubble.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(), | 203 canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(), |
204 kBottomLineHeight), kBorderDarkColor); | 204 kBottomLineHeight), kBorderDarkColor); |
205 | 205 |
206 if (!Shell::GetInstance()->shelf()->IsVisible()) | 206 if (!Shell::GetInstance()->shelf()->IsVisible()) |
207 return; | 207 return; |
208 | 208 |
209 // Draw the arrow. | 209 // Draw the arrow. |
210 if (arrow_type_ == ARROW_TYPE_BOTTOM) { | 210 if (arrow_type_ == ARROW_TYPE_BOTTOM) { |
211 int tip_x = base::i18n::IsRTL() ? arrow_offset_ : | 211 int tip_x = base::i18n::IsRTL() ? arrow_offset_ : |
212 owner_->width() - arrow_offset_; | 212 owner_->width() - arrow_offset_; |
| 213 if (tip_x < kArrowPaddingFromRight + kArrowWidth / 2) |
| 214 tip_x = kArrowPaddingFromRight + kArrowWidth / 2; |
| 215 if (tip_x > owner_->width() - kArrowPaddingFromRight - kArrowWidth / 2) |
| 216 tip_x = owner_->width() - kArrowPaddingFromRight - kArrowWidth / 2; |
213 int left_base_x = tip_x - kArrowWidth / 2; | 217 int left_base_x = tip_x - kArrowWidth / 2; |
214 int left_base_y = y; | 218 int left_base_y = y; |
215 int tip_y = left_base_y + kArrowHeight; | 219 int tip_y = left_base_y + kArrowHeight; |
216 | 220 |
217 SkPath path; | 221 SkPath path; |
218 path.incReserve(4); | 222 path.incReserve(4); |
219 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y)); | 223 path.moveTo(SkIntToScalar(left_base_x), SkIntToScalar(left_base_y)); |
220 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); | 224 path.lineTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); |
221 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), | 225 path.lineTo(SkIntToScalar(left_base_x + kArrowWidth), |
222 SkIntToScalar(left_base_y)); | 226 SkIntToScalar(left_base_y)); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 507 } |
504 | 508 |
505 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { | 509 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { |
506 CHECK_EQ(bubble_widget_, widget); | 510 CHECK_EQ(bubble_widget_, widget); |
507 bubble_widget_ = NULL; | 511 bubble_widget_ = NULL; |
508 tray_->RemoveBubble(this); | 512 tray_->RemoveBubble(this); |
509 } | 513 } |
510 | 514 |
511 } // namespace internal | 515 } // namespace internal |
512 } // namespace ash | 516 } // namespace ash |
OLD | NEW |