Chromium Code Reviews| Index: chrome/browser/ui/views/extensions/chooser_dialog_view.h |
| diff --git a/chrome/browser/ui/views/extensions/chooser_dialog_view.h b/chrome/browser/ui/views/extensions/chooser_dialog_view.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7fa18d179622b6c99528b124d1866e970654f450 |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/extensions/chooser_dialog_view.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_CHOOSER_DIALOG_VIEW_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_CHOOSER_DIALOG_VIEW_H_ |
| + |
| +#include "base/macros.h" |
| +#include "ui/views/controls/styled_label_listener.h" |
| +#include "ui/views/controls/table/table_view_observer.h" |
| +#include "ui/views/window/dialog_delegate.h" |
| + |
| +class ChooserContentView; |
| +class ChooserController; |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace ui { |
| +class TableModel; |
| +} |
| + |
| +namespace views { |
| +class TableView; |
| +} |
| + |
| +// Displays a chooser view as a modal dialog constrained |
| +// to the window/tab displaying the given web contents. |
| +class ChooserDialogView : public views::DialogDelegateView, |
| + public views::StyledLabelListener, |
| + public views::TableViewObserver { |
| + public: |
| + ChooserDialogView(content::WebContents* web_contents, |
| + ChooserController* chooser_controller); |
| + ~ChooserDialogView() override; |
| + |
| + // views::View: |
| + gfx::Size GetPreferredSize() const override; |
| + |
| + // views::WidgetDelegate: |
| + base::string16 GetWindowTitle() const override; |
| + bool ShouldShowCloseButton() const override; |
| + ui::ModalType GetModalType() const override; |
| + |
| + // views::DialogDelegate: |
| + base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| + bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| + views::View* CreateFootnoteView() override; |
| + bool Accept() override; |
| + bool Cancel() override; |
| + bool Close() override; |
| + |
| + // views::StyledLabelListener: |
| + void StyledLabelLinkClicked(views::StyledLabel* label, |
| + const gfx::Range& range, |
| + int event_flags) override; |
| + |
| + // views::TableViewObserver: |
| + void OnSelectionChanged() override; |
| + |
| + private: |
| + friend class ChooserDialogViewTest; |
|
msw
2016/06/08 01:16:32
nit: remove this, add public table_view_for_test()
juncai
2016/06/09 01:59:53
Done.
|
| + std::unique_ptr<ChooserContentView> chooser_content_view_; |
| + content::WebContents* web_contents_; |
| + ChooserController* chooser_controller_; |
| + views::TableView* table_view_; |
| + // Weak. Owned by ChooserContentView. |
| + ui::TableModel* table_model_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ChooserDialogView); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_CHOOSER_DIALOG_VIEW_H_ |