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_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
10 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/path.h" | 13 #include "ui/gfx/path.h" |
13 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
14 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
15 #include "ui/native_theme/native_theme.h" | 16 #include "ui/native_theme/native_theme.h" |
16 #include "ui/resources/grit/ui_resources.h" | 17 #include "ui/resources/grit/ui_resources.h" |
17 #include "ui/strings/grit/ui_strings.h" | 18 #include "ui/strings/grit/ui_strings.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 324 |
324 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) { | 325 void BubbleFrameView::ButtonPressed(Button* sender, const ui::Event& event) { |
325 if (sender == close_) { | 326 if (sender == close_) { |
326 close_button_clicked_ = true; | 327 close_button_clicked_ = true; |
327 GetWidget()->Close(); | 328 GetWidget()->Close(); |
328 } | 329 } |
329 } | 330 } |
330 | 331 |
331 void BubbleFrameView::SetBubbleBorder(scoped_ptr<BubbleBorder> border) { | 332 void BubbleFrameView::SetBubbleBorder(scoped_ptr<BubbleBorder> border) { |
332 bubble_border_ = border.get(); | 333 bubble_border_ = border.get(); |
333 SetBorder(border.Pass()); | 334 SetBorder(std::move(border)); |
334 | 335 |
335 // Update the background, which relies on the border. | 336 // Update the background, which relies on the border. |
336 set_background(new views::BubbleBackground(bubble_border_)); | 337 set_background(new views::BubbleBackground(bubble_border_)); |
337 } | 338 } |
338 | 339 |
339 void BubbleFrameView::SetTitlebarExtraView(View* view) { | 340 void BubbleFrameView::SetTitlebarExtraView(View* view) { |
340 DCHECK(view); | 341 DCHECK(view); |
341 DCHECK(!titlebar_extra_view_); | 342 DCHECK(!titlebar_extra_view_); |
342 AddChildView(view); | 343 AddChildView(view); |
343 titlebar_extra_view_ = view; | 344 titlebar_extra_view_ = view; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 if (titlebar_extra_view_ != NULL) | 466 if (titlebar_extra_view_ != NULL) |
466 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); | 467 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); |
467 gfx::Size size(client_size); | 468 gfx::Size size(client_size); |
468 size.SetToMax(gfx::Size(title_bar_width, 0)); | 469 size.SetToMax(gfx::Size(title_bar_width, 0)); |
469 const gfx::Insets insets(GetInsets()); | 470 const gfx::Insets insets(GetInsets()); |
470 size.Enlarge(insets.width(), insets.height()); | 471 size.Enlarge(insets.width(), insets.height()); |
471 return size; | 472 return size; |
472 } | 473 } |
473 | 474 |
474 } // namespace views | 475 } // namespace views |
OLD | NEW |