| 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 "chrome/browser/ui/views/confirm_bubble_views.h" | 5 #include "chrome/browser/ui/views/confirm_bubble_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 9 #include "chrome/browser/ui/confirm_bubble.h" | 10 #include "chrome/browser/ui/confirm_bubble.h" |
| 10 #include "chrome/browser/ui/confirm_bubble_model.h" | 11 #include "chrome/browser/ui/confirm_bubble_model.h" |
| 11 #include "components/constrained_window/constrained_window_views.h" | 12 #include "components/constrained_window/constrained_window_views.h" |
| 12 #include "ui/base/ui_features.h" | 13 #include "ui/base/ui_features.h" |
| 13 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/controls/link.h" | 15 #include "ui/views/controls/link.h" |
| 15 #include "ui/views/layout/grid_layout.h" | 16 #include "ui/views/layout/grid_layout.h" |
| 16 #include "ui/views/layout/layout_constants.h" | 17 #include "ui/views/layout/layout_constants.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 | 19 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 34 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 34 label->SetMultiLine(true); | 35 label->SetMultiLine(true); |
| 35 label->SizeToFit(kMaxMessageWidth); | 36 label->SizeToFit(kMaxMessageWidth); |
| 36 layout->StartRow(0, 0); | 37 layout->StartRow(0, 0); |
| 37 layout->AddView(label); | 38 layout->AddView(label); |
| 38 | 39 |
| 39 // Initialize the link. | 40 // Initialize the link. |
| 40 link_ = new views::Link(model_->GetLinkText()); | 41 link_ = new views::Link(model_->GetLinkText()); |
| 41 link_->set_listener(this); | 42 link_->set_listener(this); |
| 42 link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 43 link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 44 |
| 45 chrome::RecordDialogCreation(chrome::DialogIdentifier::CONFIRM_BUBBLE); |
| 43 } | 46 } |
| 44 | 47 |
| 45 ConfirmBubbleViews::~ConfirmBubbleViews() { | 48 ConfirmBubbleViews::~ConfirmBubbleViews() { |
| 46 } | 49 } |
| 47 | 50 |
| 48 base::string16 ConfirmBubbleViews::GetDialogButtonLabel( | 51 base::string16 ConfirmBubbleViews::GetDialogButtonLabel( |
| 49 ui::DialogButton button) const { | 52 ui::DialogButton button) const { |
| 50 switch (button) { | 53 switch (button) { |
| 51 case ui::DIALOG_BUTTON_OK: | 54 case ui::DIALOG_BUTTON_OK: |
| 52 return model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_OK); | 55 return model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_OK); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 gfx::NativeView anchor_view, | 109 gfx::NativeView anchor_view, |
| 107 const gfx::Point& origin, | 110 const gfx::Point& origin, |
| 108 std::unique_ptr<ConfirmBubbleModel> model) { | 111 std::unique_ptr<ConfirmBubbleModel> model) { |
| 109 constrained_window::CreateBrowserModalDialogViews( | 112 constrained_window::CreateBrowserModalDialogViews( |
| 110 new ConfirmBubbleViews(std::move(model)), window) | 113 new ConfirmBubbleViews(std::move(model)), window) |
| 111 ->Show(); | 114 ->Show(); |
| 112 } | 115 } |
| 113 #endif // !OS_MACOSX || MAC_VIEWS_BROWSER | 116 #endif // !OS_MACOSX || MAC_VIEWS_BROWSER |
| 114 | 117 |
| 115 } // namespace chrome | 118 } // namespace chrome |
| OLD | NEW |