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/window_sizer.h" | 8 #include "chrome/browser/window_sizer.h" |
9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
10 #include "gfx/canvas_skia.h" | 10 #include "gfx/canvas.h" |
11 #include "gfx/color_utils.h" | 11 #include "gfx/color_utils.h" |
12 #include "gfx/path.h" | 12 #include "gfx/path.h" |
13 #include "third_party/skia/include/core/SkPaint.h" | 13 #include "third_party/skia/include/core/SkPaint.h" |
14 #include "views/fill_layout.h" | 14 #include "views/fill_layout.h" |
15 #include "views/widget/root_view.h" | 15 #include "views/widget/root_view.h" |
16 #include "views/widget/widget.h" | 16 #include "views/widget/widget.h" |
17 #include "views/window/client_view.h" | 17 #include "views/window/client_view.h" |
18 #include "views/window/window.h" | 18 #include "views/window/window.h" |
19 | 19 |
20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 paint.setAntiAlias(true); | 107 paint.setAntiAlias(true); |
108 paint.setStyle(SkPaint::kFill_Style); | 108 paint.setStyle(SkPaint::kFill_Style); |
109 paint.setColor(InfoBubble::kBackgroundColor); | 109 paint.setColor(InfoBubble::kBackgroundColor); |
110 gfx::Path path; | 110 gfx::Path path; |
111 gfx::Rect bounds(GetLocalBounds(false)); | 111 gfx::Rect bounds(GetLocalBounds(false)); |
112 SkRect rect; | 112 SkRect rect; |
113 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 113 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
114 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 114 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
115 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 115 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
116 path.addRoundRect(rect, radius, radius); | 116 path.addRoundRect(rect, radius, radius); |
117 canvas->AsCanvasSkia()->drawPath(path, paint); | 117 canvas->drawPath(path, paint); |
118 | 118 |
119 // Now we paint the border, so it will be alpha-blended atop the contents. | 119 // Now we paint the border, so it will be alpha-blended atop the contents. |
120 // This looks slightly better in the corners than drawing the contents atop | 120 // This looks slightly better in the corners than drawing the contents atop |
121 // the border. | 121 // the border. |
122 PaintBorder(canvas); | 122 PaintBorder(canvas); |
123 } | 123 } |
124 | 124 |
125 void BorderContents::MirrorArrowIfOffScreen( | 125 void BorderContents::MirrorArrowIfOffScreen( |
126 bool vertical, | 126 bool vertical, |
127 const gfx::Rect& position_relative_to, | 127 const gfx::Rect& position_relative_to, |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 animation_->Hide(); | 533 animation_->Hide(); |
534 } | 534 } |
535 | 535 |
536 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 536 bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
537 if (!delegate_ || delegate_->CloseOnEscape()) { | 537 if (!delegate_ || delegate_->CloseOnEscape()) { |
538 DoClose(true); | 538 DoClose(true); |
539 return true; | 539 return true; |
540 } | 540 } |
541 return false; | 541 return false; |
542 } | 542 } |
OLD | NEW |