Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/ui/views/status_bubble_views.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 int height = popup_bounds.height(); 405 int height = popup_bounds.height();
406 SkRect rect; 406 SkRect rect;
407 rect.set(0, 0, 407 rect.set(0, 0,
408 SkIntToScalar(width), 408 SkIntToScalar(width),
409 SkIntToScalar(height)); 409 SkIntToScalar(height));
410 SkPath shadow_path; 410 SkPath shadow_path;
411 shadow_path.addRoundRect(rect, rad, SkPath::kCW_Direction); 411 shadow_path.addRoundRect(rect, rad, SkPath::kCW_Direction);
412 SkPaint shadow_paint; 412 SkPaint shadow_paint;
413 shadow_paint.setFlags(SkPaint::kAntiAlias_Flag); 413 shadow_paint.setFlags(SkPaint::kAntiAlias_Flag);
414 shadow_paint.setColor(kShadowColor); 414 shadow_paint.setColor(kShadowColor);
415 canvas->AsCanvasSkia()->drawPath(shadow_path, shadow_paint); 415 canvas->GetSkCanvas()->drawPath(shadow_path, shadow_paint);
416 416
417 // Draw the bubble. 417 // Draw the bubble.
418 rect.set(SkIntToScalar(kShadowThickness), 418 rect.set(SkIntToScalar(kShadowThickness),
419 SkIntToScalar(kShadowThickness), 419 SkIntToScalar(kShadowThickness),
420 SkIntToScalar(width - kShadowThickness), 420 SkIntToScalar(width - kShadowThickness),
421 SkIntToScalar(height - kShadowThickness)); 421 SkIntToScalar(height - kShadowThickness));
422 SkPath path; 422 SkPath path;
423 path.addRoundRect(rect, rad, SkPath::kCW_Direction); 423 path.addRoundRect(rect, rad, SkPath::kCW_Direction);
424 canvas->AsCanvasSkia()->drawPath(path, paint); 424 canvas->GetSkCanvas()->drawPath(path, paint);
425 425
426 // Draw highlight text and then the text body. In order to make sure the text 426 // Draw highlight text and then the text body. In order to make sure the text
427 // is aligned to the right on RTL UIs, we mirror the text bounds if the 427 // is aligned to the right on RTL UIs, we mirror the text bounds if the
428 // locale is RTL. 428 // locale is RTL.
429 int text_width = std::min( 429 int text_width = std::min(
430 views::Label::font().GetStringWidth(text_), 430 views::Label::font().GetStringWidth(text_),
431 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding); 431 width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding);
432 int text_height = height - (kShadowThickness * 2); 432 int text_height = height - (kShadowThickness * 2);
433 gfx::Rect body_bounds(kShadowThickness + kTextPositionX, 433 gfx::Rect body_bounds(kShadowThickness + kTextPositionX,
434 kShadowThickness, 434 kShadowThickness,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 void StatusBubbleViews::SetBubbleWidth(int width) { 826 void StatusBubbleViews::SetBubbleWidth(int width) {
827 size_.set_width(width); 827 size_.set_width(width);
828 SetBounds(original_position_.x(), original_position_.y(), 828 SetBounds(original_position_.x(), original_position_.y(),
829 size_.width(), size_.height()); 829 size_.width(), size_.height());
830 } 830 }
831 831
832 void StatusBubbleViews::CancelExpandTimer() { 832 void StatusBubbleViews::CancelExpandTimer() {
833 if (!expand_timer_factory_.empty()) 833 if (!expand_timer_factory_.empty())
834 expand_timer_factory_.RevokeAll(); 834 expand_timer_factory_.RevokeAll();
835 } 835 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698