| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 int height = popup_bounds.height(); | 407 int height = popup_bounds.height(); |
| 408 SkRect rect; | 408 SkRect rect; |
| 409 rect.set(0, 0, | 409 rect.set(0, 0, |
| 410 SkIntToScalar(width), | 410 SkIntToScalar(width), |
| 411 SkIntToScalar(height)); | 411 SkIntToScalar(height)); |
| 412 SkPath shadow_path; | 412 SkPath shadow_path; |
| 413 shadow_path.addRoundRect(rect, rad, SkPath::kCW_Direction); | 413 shadow_path.addRoundRect(rect, rad, SkPath::kCW_Direction); |
| 414 SkPaint shadow_paint; | 414 SkPaint shadow_paint; |
| 415 shadow_paint.setFlags(SkPaint::kAntiAlias_Flag); | 415 shadow_paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 416 shadow_paint.setColor(kShadowColor); | 416 shadow_paint.setColor(kShadowColor); |
| 417 canvas->AsCanvasSkia()->drawPath(shadow_path, shadow_paint); | 417 canvas->AsCanvasSkia()->skia_canvas()->drawPath(shadow_path, shadow_paint); |
| 418 | 418 |
| 419 // Draw the bubble. | 419 // Draw the bubble. |
| 420 rect.set(SkIntToScalar(kShadowThickness), | 420 rect.set(SkIntToScalar(kShadowThickness), |
| 421 SkIntToScalar(kShadowThickness), | 421 SkIntToScalar(kShadowThickness), |
| 422 SkIntToScalar(width - kShadowThickness), | 422 SkIntToScalar(width - kShadowThickness), |
| 423 SkIntToScalar(height - kShadowThickness)); | 423 SkIntToScalar(height - kShadowThickness)); |
| 424 SkPath path; | 424 SkPath path; |
| 425 path.addRoundRect(rect, rad, SkPath::kCW_Direction); | 425 path.addRoundRect(rect, rad, SkPath::kCW_Direction); |
| 426 canvas->AsCanvasSkia()->drawPath(path, paint); | 426 canvas->AsCanvasSkia()->skia_canvas()->drawPath(path, paint); |
| 427 | 427 |
| 428 // Draw highlight text and then the text body. In order to make sure the text | 428 // Draw highlight text and then the text body. In order to make sure the text |
| 429 // is aligned to the right on RTL UIs, we mirror the text bounds if the | 429 // is aligned to the right on RTL UIs, we mirror the text bounds if the |
| 430 // locale is RTL. | 430 // locale is RTL. |
| 431 int text_width = std::min( | 431 int text_width = std::min( |
| 432 views::Label::font().GetStringWidth(text_), | 432 views::Label::font().GetStringWidth(text_), |
| 433 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding); | 433 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding); |
| 434 int text_height = height - (kShadowThickness * 2); | 434 int text_height = height - (kShadowThickness * 2); |
| 435 gfx::Rect body_bounds(kShadowThickness + kTextPositionX, | 435 gfx::Rect body_bounds(kShadowThickness + kTextPositionX, |
| 436 kShadowThickness, | 436 kShadowThickness, |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void StatusBubbleViews::SetBubbleWidth(int width) { | 828 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 829 size_.set_width(width); | 829 size_.set_width(width); |
| 830 SetBounds(original_position_.x(), original_position_.y(), | 830 SetBounds(original_position_.x(), original_position_.y(), |
| 831 size_.width(), size_.height()); | 831 size_.width(), size_.height()); |
| 832 } | 832 } |
| 833 | 833 |
| 834 void StatusBubbleViews::CancelExpandTimer() { | 834 void StatusBubbleViews::CancelExpandTimer() { |
| 835 if (!expand_timer_factory_.empty()) | 835 if (!expand_timer_factory_.empty()) |
| 836 expand_timer_factory_.RevokeAll(); | 836 expand_timer_factory_.RevokeAll(); |
| 837 } | 837 } |
| OLD | NEW |