OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/bubble/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/base/animation/slide_animation.h" | 7 #include "ui/base/animation/slide_animation.h" |
8 #include "ui/gfx/color_utils.h" | 8 #include "ui/gfx/color_utils.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/native_theme/native_theme.h" | 10 #include "ui/native_theme/native_theme.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 bool BubbleDelegateView::CanActivate() const { | 177 bool BubbleDelegateView::CanActivate() const { |
178 return !use_focusless(); | 178 return !use_focusless(); |
179 } | 179 } |
180 | 180 |
181 View* BubbleDelegateView::GetContentsView() { | 181 View* BubbleDelegateView::GetContentsView() { |
182 return this; | 182 return this; |
183 } | 183 } |
184 | 184 |
185 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( | 185 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
186 Widget* widget) { | 186 Widget* widget) { |
187 BubbleBorder::ArrowLocation arrow_loc = arrow_location(); | 187 BubbleFrameView* frame = new BubbleFrameView(margins()); |
188 if (base::i18n::IsRTL()) | 188 BubbleBorder::ArrowLocation arrow = base::i18n::IsRTL() ? |
189 arrow_loc = BubbleBorder::horizontal_mirror(arrow_loc); | 189 BubbleBorder::horizontal_mirror(arrow_location()) : arrow_location(); |
190 BubbleBorder* border = new BubbleBorder(arrow_loc, shadow_); | 190 frame->SetBubbleBorder(new BubbleBorder(arrow, shadow(), color())); |
191 border->set_background_color(color()); | 191 return frame; |
192 BubbleFrameView* frame_view = new BubbleFrameView(margins(), border); | |
193 frame_view->set_background(new BubbleBackground(border)); | |
194 return frame_view; | |
195 } | 192 } |
196 | 193 |
197 void BubbleDelegateView::OnWidgetClosing(Widget* widget) { | 194 void BubbleDelegateView::OnWidgetClosing(Widget* widget) { |
198 if (anchor_widget() == widget) { | 195 if (anchor_widget() == widget) { |
199 anchor_widget_->RemoveObserver(this); | 196 anchor_widget_->RemoveObserver(this); |
200 anchor_view_ = NULL; | 197 anchor_view_ = NULL; |
201 anchor_widget_ = NULL; | 198 anchor_widget_ = NULL; |
202 } | 199 } |
203 } | 200 } |
204 | 201 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 #if defined(OS_WIN) && !defined(USE_AURA) | 355 #if defined(OS_WIN) && !defined(USE_AURA) |
359 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 356 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
360 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 357 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
361 client_bounds.Offset( | 358 client_bounds.Offset( |
362 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); | 359 border_widget_->GetWindowBoundsInScreen().OffsetFromOrigin()); |
363 return client_bounds; | 360 return client_bounds; |
364 } | 361 } |
365 #endif | 362 #endif |
366 | 363 |
367 } // namespace views | 364 } // namespace views |
OLD | NEW |