OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/info_bubble.h" | 5 #include "chrome/browser/ui/views/autofill/info_bubble.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/geometry/point.h" | 9 #include "ui/gfx/geometry/point.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 widget_->SetVisibilityChangedAnimationsEnabled(false); | 116 widget_->SetVisibilityChangedAnimationsEnabled(false); |
117 widget_->Hide(); | 117 widget_->Hide(); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 views::NonClientFrameView* InfoBubble::CreateNonClientFrameView( | 121 views::NonClientFrameView* InfoBubble::CreateNonClientFrameView( |
122 views::Widget* widget) { | 122 views::Widget* widget) { |
123 DCHECK(!frame_); | 123 DCHECK(!frame_); |
124 frame_ = new InfoBubbleFrame(margins()); | 124 frame_ = new InfoBubbleFrame(margins()); |
125 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen()); | 125 frame_->set_available_bounds(anchor_widget()->GetWindowBoundsInScreen()); |
126 frame_->SetBubbleBorder(scoped_ptr<views::BubbleBorder>( | 126 frame_->SetBubbleBorder(std::unique_ptr<views::BubbleBorder>( |
127 new views::BubbleBorder(arrow(), shadow(), color()))); | 127 new views::BubbleBorder(arrow(), shadow(), color()))); |
128 return frame_; | 128 return frame_; |
129 } | 129 } |
130 | 130 |
131 gfx::Size InfoBubble::GetPreferredSize() const { | 131 gfx::Size InfoBubble::GetPreferredSize() const { |
132 int pref_width = preferred_width_; | 132 int pref_width = preferred_width_; |
133 pref_width -= frame_->GetInsets().width(); | 133 pref_width -= frame_->GetInsets().width(); |
134 pref_width -= 2 * kBubbleBorderVisibleWidth; | 134 pref_width -= 2 * kBubbleBorderVisibleWidth; |
135 return gfx::Size(pref_width, GetHeightForWidth(pref_width)); | 135 return gfx::Size(pref_width, GetHeightForWidth(pref_width)); |
136 } | 136 } |
137 | 137 |
138 void InfoBubble::OnWidgetDestroyed(views::Widget* widget) { | 138 void InfoBubble::OnWidgetDestroyed(views::Widget* widget) { |
139 if (widget == widget_) | 139 if (widget == widget_) |
140 widget_ = NULL; | 140 widget_ = NULL; |
141 } | 141 } |
142 | 142 |
143 void InfoBubble::OnWidgetBoundsChanged(views::Widget* widget, | 143 void InfoBubble::OnWidgetBoundsChanged(views::Widget* widget, |
144 const gfx::Rect& new_bounds) { | 144 const gfx::Rect& new_bounds) { |
145 views::BubbleDelegateView::OnWidgetBoundsChanged(widget, new_bounds); | 145 views::BubbleDelegateView::OnWidgetBoundsChanged(widget, new_bounds); |
146 if (anchor_widget() == widget) | 146 if (anchor_widget() == widget) |
147 frame_->set_available_bounds(widget->GetWindowBoundsInScreen()); | 147 frame_->set_available_bounds(widget->GetWindowBoundsInScreen()); |
148 } | 148 } |
149 | 149 |
150 } // namespace autofill | 150 } // namespace autofill |
OLD | NEW |