| 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 #ifndef CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
| 12 #include "ui/views/window/dialog_delegate.h" | 13 #include "ui/views/window/dialog_delegate.h" |
| 13 | 14 |
| 14 class ConfirmBubbleModel; | 15 class ConfirmBubbleModel; |
| 15 | 16 |
| 16 // A dialog (with the standard Title/(x)/[OK]/[Cancel] UI elements), as well as | 17 // A dialog (with the standard Title/(x)/[OK]/[Cancel] UI elements), as well as |
| 17 // a message Label and optional Link. The dialog ultimately appears like this: | 18 // a message Label and optional Link. The dialog ultimately appears like this: |
| 18 // +------------------------+ | 19 // +------------------------+ |
| 19 // | Title (x) | | 20 // | Title (x) | |
| 20 // | Label | | 21 // | Label | |
| 21 // | Link [OK] [Cancel] | | 22 // | Link [OK] [Cancel] | |
| 22 // +------------------------+ | 23 // +------------------------+ |
| 23 // | 24 // |
| 24 // TODO(msw): Remove this class or merge it with DialogDelegateView. | 25 // TODO(msw): Remove this class or merge it with DialogDelegateView. |
| 25 class ConfirmBubbleViews : public views::DialogDelegateView, | 26 class ConfirmBubbleViews : public views::DialogDelegateView, |
| 26 public views::LinkListener { | 27 public views::LinkListener { |
| 27 public: | 28 public: |
| 28 explicit ConfirmBubbleViews(scoped_ptr<ConfirmBubbleModel> model); | 29 explicit ConfirmBubbleViews(std::unique_ptr<ConfirmBubbleModel> model); |
| 29 | 30 |
| 30 protected: | 31 protected: |
| 31 ~ConfirmBubbleViews() override; | 32 ~ConfirmBubbleViews() override; |
| 32 | 33 |
| 33 // views::DialogDelegate implementation. | 34 // views::DialogDelegate implementation. |
| 34 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 35 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 35 bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 36 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 36 views::View* CreateExtraView() override; | 37 views::View* CreateExtraView() override; |
| 37 bool Cancel() override; | 38 bool Cancel() override; |
| 38 bool Accept() override; | 39 bool Accept() override; |
| 39 | 40 |
| 40 // views::WidgetDelegate implementation. | 41 // views::WidgetDelegate implementation. |
| 41 ui::ModalType GetModalType() const override; | 42 ui::ModalType GetModalType() const override; |
| 42 base::string16 GetWindowTitle() const override; | 43 base::string16 GetWindowTitle() const override; |
| 43 | 44 |
| 44 // views::LinkListener implementation. | 45 // views::LinkListener implementation. |
| 45 void LinkClicked(views::Link* source, int event_flags) override; | 46 void LinkClicked(views::Link* source, int event_flags) override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // The model to customize this bubble view. | 49 // The model to customize this bubble view. |
| 49 scoped_ptr<ConfirmBubbleModel> model_; | 50 std::unique_ptr<ConfirmBubbleModel> model_; |
| 50 | 51 |
| 51 views::Link* link_; | 52 views::Link* link_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleViews); | 54 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleViews); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 #endif // CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ | 57 #endif // CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEWS_H_ |
| OLD | NEW |