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 "chrome/browser/ui/views/status_bubble_views.h" | 5 #include "chrome/browser/ui/views/status_bubble_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 // Draw the bubble's shadow. | 393 // Draw the bubble's shadow. |
394 int width = popup_bounds.width(); | 394 int width = popup_bounds.width(); |
395 int height = popup_bounds.height(); | 395 int height = popup_bounds.height(); |
396 gfx::Rect rect(gfx::Rect(popup_bounds.size())); | 396 gfx::Rect rect(gfx::Rect(popup_bounds.size())); |
397 SkPaint shadow_paint; | 397 SkPaint shadow_paint; |
398 shadow_paint.setAntiAlias(true); | 398 shadow_paint.setAntiAlias(true); |
399 shadow_paint.setColor(kShadowColor); | 399 shadow_paint.setColor(kShadowColor); |
400 | 400 |
401 SkRRect rrect; | 401 SkRRect rrect; |
402 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); | 402 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); |
403 canvas->sk_canvas()->drawRRect(rrect, paint); | 403 canvas->sk_canvas()->drawRRect(rrect, shadow_paint); |
404 | 404 |
405 // Draw the bubble. | 405 // Draw the bubble. |
406 rect.SetRect(SkIntToScalar(kShadowThickness), | 406 rect.SetRect(SkIntToScalar(kShadowThickness), SkIntToScalar(kShadowThickness), |
407 SkIntToScalar(kShadowThickness), | 407 SkIntToScalar(width - 2), SkIntToScalar(height - 2)); |
msw
2014/12/12 19:10:09
Should these subtract 2*StatusBubbleViews::kShadow
| |
408 SkIntToScalar(width), | |
409 SkIntToScalar(height)); | |
410 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); | 408 rrect.setRectRadii(RectToSkRect(rect), (const SkVector*)rad); |
411 canvas->sk_canvas()->drawRRect(rrect, paint); | 409 canvas->sk_canvas()->drawRRect(rrect, paint); |
412 | 410 |
413 // Draw highlight text and then the text body. In order to make sure the text | 411 // Draw highlight text and then the text body. In order to make sure the text |
414 // is aligned to the right on RTL UIs, we mirror the text bounds if the | 412 // is aligned to the right on RTL UIs, we mirror the text bounds if the |
415 // locale is RTL. | 413 // locale is RTL. |
416 const gfx::FontList font_list; | 414 const gfx::FontList font_list; |
417 int text_width = std::min( | 415 int text_width = std::min( |
418 gfx::GetStringWidth(text_, font_list), | 416 gfx::GetStringWidth(text_, font_list), |
419 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding); | 417 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
864 void StatusBubbleViews::SetBubbleWidth(int width) { | 862 void StatusBubbleViews::SetBubbleWidth(int width) { |
865 size_.set_width(width); | 863 size_.set_width(width); |
866 SetBounds(original_position_.x(), original_position_.y(), | 864 SetBounds(original_position_.x(), original_position_.y(), |
867 size_.width(), size_.height()); | 865 size_.width(), size_.height()); |
868 } | 866 } |
869 | 867 |
870 void StatusBubbleViews::CancelExpandTimer() { | 868 void StatusBubbleViews::CancelExpandTimer() { |
871 if (expand_timer_factory_.HasWeakPtrs()) | 869 if (expand_timer_factory_.HasWeakPtrs()) |
872 expand_timer_factory_.InvalidateWeakPtrs(); | 870 expand_timer_factory_.InvalidateWeakPtrs(); |
873 } | 871 } |
OLD | NEW |