Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/ui/views/extensions/chooser_dialog_view.cc

Issue 2155743002: Add throbber and status text to WebBluetooth chooser UI on non-Mac desktops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/extensions/chooser_dialog_view.h" 5 #include "chrome/browser/ui/views/extensions/chooser_dialog_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/chooser_controller/chooser_controller.h" 8 #include "chrome/browser/chooser_controller/chooser_controller.h"
9 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" 9 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h"
10 #include "chrome/browser/ui/views/chooser_content_view.h" 10 #include "chrome/browser/ui/views/chooser_content_view.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "components/constrained_window/constrained_window_views.h" 12 #include "components/constrained_window/constrained_window_views.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager.h" 13 #include "components/web_modal/web_contents_modal_dialog_manager.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "ui/views/controls/styled_label.h" 15 #include "ui/views/controls/styled_label.h"
msw 2016/07/18 23:01:31 nit: remove
juncai 2016/07/19 20:42:46 If removed, return chooser_content_view_->CreateFo
16 #include "ui/views/window/dialog_client_view.h" 16 #include "ui/views/window/dialog_client_view.h"
17 17
18 ChooserDialogView::ChooserDialogView( 18 ChooserDialogView::ChooserDialogView(
19 std::unique_ptr<ChooserController> chooser_controller) { 19 std::unique_ptr<ChooserController> chooser_controller) {
20 // ------------------------------------ 20 // ------------------------------------
21 // | Chooser dialog title | 21 // | Chooser dialog title |
22 // | -------------------------------- | 22 // | -------------------------------- |
23 // | | option 0 | | 23 // | | option 0 | |
24 // | | option 1 | | 24 // | | option 1 | |
25 // | | option 2 | | 25 // | | option 2 | |
(...skipping 27 matching lines...) Expand all
53 53
54 base::string16 ChooserDialogView::GetDialogButtonLabel( 54 base::string16 ChooserDialogView::GetDialogButtonLabel(
55 ui::DialogButton button) const { 55 ui::DialogButton button) const {
56 return chooser_content_view_->GetDialogButtonLabel(button); 56 return chooser_content_view_->GetDialogButtonLabel(button);
57 } 57 }
58 58
59 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const { 59 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const {
60 return chooser_content_view_->IsDialogButtonEnabled(button); 60 return chooser_content_view_->IsDialogButtonEnabled(button);
61 } 61 }
62 62
63 views::View* ChooserDialogView::CreateExtraView() {
64 return chooser_content_view_->CreateExtraView();
65 }
66
63 views::View* ChooserDialogView::CreateFootnoteView() { 67 views::View* ChooserDialogView::CreateFootnoteView() {
64 return chooser_content_view_->CreateFootnoteView(this); 68 return chooser_content_view_->CreateFootnoteView();
65 } 69 }
66 70
67 bool ChooserDialogView::Accept() { 71 bool ChooserDialogView::Accept() {
68 chooser_content_view_->Accept(); 72 chooser_content_view_->Accept();
69 return true; 73 return true;
70 } 74 }
71 75
72 bool ChooserDialogView::Cancel() { 76 bool ChooserDialogView::Cancel() {
73 chooser_content_view_->Cancel(); 77 chooser_content_view_->Cancel();
74 return true; 78 return true;
75 } 79 }
76 80
77 bool ChooserDialogView::Close() { 81 bool ChooserDialogView::Close() {
78 chooser_content_view_->Close(); 82 chooser_content_view_->Close();
79 return true; 83 return true;
80 } 84 }
81 85
82 views::View* ChooserDialogView::GetContentsView() { 86 views::View* ChooserDialogView::GetContentsView() {
83 return chooser_content_view_; 87 return chooser_content_view_;
84 } 88 }
85 89
86 views::Widget* ChooserDialogView::GetWidget() { 90 views::Widget* ChooserDialogView::GetWidget() {
87 return chooser_content_view_->GetWidget(); 91 return chooser_content_view_->GetWidget();
88 } 92 }
89 93
90 const views::Widget* ChooserDialogView::GetWidget() const { 94 const views::Widget* ChooserDialogView::GetWidget() const {
91 return chooser_content_view_->GetWidget(); 95 return chooser_content_view_->GetWidget();
92 } 96 }
93 97
94 void ChooserDialogView::StyledLabelLinkClicked(views::StyledLabel* label,
95 const gfx::Range& range,
96 int event_flags) {
97 chooser_content_view_->StyledLabelLinkClicked();
98 }
99
100 void ChooserDialogView::OnSelectionChanged() { 98 void ChooserDialogView::OnSelectionChanged() {
101 GetDialogClientView()->UpdateDialogButtons(); 99 GetDialogClientView()->UpdateDialogButtons();
102 } 100 }
103 101
104 views::TableView* ChooserDialogView::table_view_for_test() const { 102 views::TableView* ChooserDialogView::table_view_for_test() const {
105 return chooser_content_view_->table_view_for_test(); 103 return chooser_content_view_->table_view_for_test();
106 } 104 }
107 105
108 void ChromeExtensionChooserDialog::ShowDialogImpl( 106 void ChromeExtensionChooserDialog::ShowDialogImpl(
109 std::unique_ptr<ChooserController> chooser_controller) const { 107 std::unique_ptr<ChooserController> chooser_controller) const {
110 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
111 DCHECK(chooser_controller); 109 DCHECK(chooser_controller);
112 110
113 web_modal::WebContentsModalDialogManager* manager = 111 web_modal::WebContentsModalDialogManager* manager =
114 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); 112 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
115 if (manager) { 113 if (manager) {
116 constrained_window::ShowWebModalDialogViews( 114 constrained_window::ShowWebModalDialogViews(
117 new ChooserDialogView(std::move(chooser_controller)), web_contents_); 115 new ChooserDialogView(std::move(chooser_controller)), web_contents_);
118 } 116 }
119 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698