| 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/bubble/border_contents.h" | 5 #include "chrome/browser/ui/views/bubble/border_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/ui/window_sizer.h" | 10 #include "chrome/browser/ui/window_sizer.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 bubble_border_ = new views::BubbleBorder(arrow_location); | 32 bubble_border_ = new views::BubbleBorder(arrow_location); |
| 33 set_border(bubble_border_); | 33 set_border(bubble_border_); |
| 34 set_background(new views::BubbleBackground(bubble_border_)); | 34 set_background(new views::BubbleBackground(bubble_border_)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void BorderContents::SetBackgroundColor(SkColor color) { | 37 void BorderContents::SetBackgroundColor(SkColor color) { |
| 38 bubble_border_->set_background_color(color); | 38 bubble_border_->set_background_color(color); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void BorderContents::SetAlignment( |
| 42 views::BubbleBorder::BubbleAlignment alignment) { |
| 43 bubble_border_->set_alignment(alignment); |
| 44 } |
| 45 |
| 41 void BorderContents::SizeAndGetBounds( | 46 void BorderContents::SizeAndGetBounds( |
| 42 const gfx::Rect& position_relative_to, | 47 const gfx::Rect& position_relative_to, |
| 43 views::BubbleBorder::ArrowLocation arrow_location, | 48 views::BubbleBorder::ArrowLocation arrow_location, |
| 44 bool allow_bubble_offscreen, | 49 bool allow_bubble_offscreen, |
| 45 const gfx::Size& contents_size, | 50 const gfx::Size& contents_size, |
| 46 gfx::Rect* contents_bounds, | 51 gfx::Rect* contents_bounds, |
| 47 gfx::Rect* window_bounds) { | 52 gfx::Rect* window_bounds) { |
| 48 if (base::i18n::IsRTL()) | 53 if (base::i18n::IsRTL()) |
| 49 arrow_location = views::BubbleBorder::horizontal_mirror(arrow_location); | 54 arrow_location = views::BubbleBorder::horizontal_mirror(arrow_location); |
| 50 bubble_border_->set_arrow_location(arrow_location); | 55 bubble_border_->set_arrow_location(arrow_location); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 int right = std::max(0, window_bounds.right() - monitor_bounds.right()); | 156 int right = std::max(0, window_bounds.right() - monitor_bounds.right()); |
| 152 | 157 |
| 153 offscreen_insets->Set(top, left, bottom, right); | 158 offscreen_insets->Set(top, left, bottom, right); |
| 154 return true; | 159 return true; |
| 155 } | 160 } |
| 156 | 161 |
| 157 // static | 162 // static |
| 158 int BorderContents::GetInsetsLength(const gfx::Insets& insets, bool vertical) { | 163 int BorderContents::GetInsetsLength(const gfx::Insets& insets, bool vertical) { |
| 159 return vertical ? insets.height() : insets.width(); | 164 return vertical ? insets.height() : insets.width(); |
| 160 } | 165 } |
| OLD | NEW |