OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/info_bubble.h" | 5 #include "chrome/browser/views/info_bubble.h" |
6 | 6 |
7 #include "base/keyboard_codes.h" | 7 #include "base/keyboard_codes.h" |
8 #include "chrome/browser/views/bubble_border.h" | 8 #include "chrome/browser/views/bubble_border.h" |
9 #include "chrome/browser/window_sizer.h" | 9 #include "chrome/browser/window_sizer.h" |
10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 *contents_bounds = gfx::Rect(gfx::Point(), window_bounds->size()); | 121 *contents_bounds = gfx::Rect(gfx::Point(), window_bounds->size()); |
122 gfx::Insets insets; | 122 gfx::Insets insets; |
123 bubble_border->GetInsets(&insets); | 123 bubble_border->GetInsets(&insets); |
124 contents_bounds->Inset(insets.left() + kLeftMargin, insets.top() + kTopMargin, | 124 contents_bounds->Inset(insets.left() + kLeftMargin, insets.top() + kTopMargin, |
125 insets.right() + kRightMargin, insets.bottom() + kBottomMargin); | 125 insets.right() + kRightMargin, insets.bottom() + kBottomMargin); |
126 } | 126 } |
127 | 127 |
128 void BorderContents::Paint(gfx::Canvas* canvas) { | 128 void BorderContents::Paint(gfx::Canvas* canvas) { |
129 // The border of this view creates an anti-aliased round-rect region for the | 129 // The border of this view creates an anti-aliased round-rect region for the |
130 // contents, which we need to fill with the background color. | 130 // contents, which we need to fill with the background color. |
| 131 // NOTE: This doesn't handle an arrow location of "NONE", which has square top |
| 132 // corners. |
131 SkPaint paint; | 133 SkPaint paint; |
132 paint.setAntiAlias(true); | 134 paint.setAntiAlias(true); |
133 paint.setStyle(SkPaint::kFill_Style); | 135 paint.setStyle(SkPaint::kFill_Style); |
134 paint.setColor(InfoBubble::kBackgroundColor); | 136 paint.setColor(InfoBubble::kBackgroundColor); |
135 gfx::Path path; | 137 gfx::Path path; |
136 gfx::Rect bounds(GetLocalBounds(false)); | 138 gfx::Rect bounds(GetLocalBounds(false)); |
137 SkRect rect; | 139 SkRect rect; |
138 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 140 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
139 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 141 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
140 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 142 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 #endif | 349 #endif |
348 } | 350 } |
349 | 351 |
350 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 352 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
351 if (!delegate_ || delegate_->CloseOnEscape()) { | 353 if (!delegate_ || delegate_->CloseOnEscape()) { |
352 Close(true); | 354 Close(true); |
353 return true; | 355 return true; |
354 } | 356 } |
355 return false; | 357 return false; |
356 } | 358 } |
OLD | NEW |