| 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/info_bubble.h" | 5 #include "chrome/browser/ui/views/info_bubble.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/window_sizer.h" | 9 #include "chrome/browser/ui/window_sizer.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void BorderContents::Paint(gfx::Canvas* canvas) { | 106 void BorderContents::Paint(gfx::Canvas* canvas) { |
| 107 // The border of this view creates an anti-aliased round-rect region for the | 107 // The border of this view creates an anti-aliased round-rect region for the |
| 108 // contents, which we need to fill with the background color. | 108 // contents, which we need to fill with the background color. |
| 109 // NOTE: This doesn't handle an arrow location of "NONE", which has square top | 109 // NOTE: This doesn't handle an arrow location of "NONE", which has square top |
| 110 // corners. | 110 // corners. |
| 111 SkPaint paint; | 111 SkPaint paint; |
| 112 paint.setAntiAlias(true); | 112 paint.setAntiAlias(true); |
| 113 paint.setStyle(SkPaint::kFill_Style); | 113 paint.setStyle(SkPaint::kFill_Style); |
| 114 paint.setColor(InfoBubble::kBackgroundColor); | 114 paint.setColor(InfoBubble::kBackgroundColor); |
| 115 gfx::Path path; | 115 gfx::Path path; |
| 116 gfx::Rect bounds(GetLocalBounds()); | 116 gfx::Rect bounds(GetContentsBounds()); |
| 117 SkRect rect; | 117 SkRect rect; |
| 118 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 118 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
| 119 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 119 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
| 120 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 120 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
| 121 path.addRoundRect(rect, radius, radius); | 121 path.addRoundRect(rect, radius, radius); |
| 122 canvas->AsCanvasSkia()->drawPath(path, paint); | 122 canvas->AsCanvasSkia()->drawPath(path, paint); |
| 123 | 123 |
| 124 // Now we paint the border, so it will be alpha-blended atop the contents. | 124 // Now we paint the border, so it will be alpha-blended atop the contents. |
| 125 // This looks slightly better in the corners than drawing the contents atop | 125 // This looks slightly better in the corners than drawing the contents atop |
| 126 // the border. | 126 // the border. |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 animation_->Hide(); | 558 animation_->Hide(); |
| 559 } | 559 } |
| 560 | 560 |
| 561 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 561 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 562 if (!delegate_ || delegate_->CloseOnEscape()) { | 562 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 563 DoClose(true); | 563 DoClose(true); |
| 564 return true; | 564 return true; |
| 565 } | 565 } |
| 566 return false; | 566 return false; |
| 567 } | 567 } |
| OLD | NEW |