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

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

Issue 2478863003: Fix the Web Bluetooth chooser when it is used on Chrome apps on non-Mac (Closed)
Patch Set: fix the Web Bluetooth chooser when it is used on Chrome apps on non-Mac Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/extensions/chooser_dialog_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/constrained_window/constrained_window_views.h" 11 #include "components/constrained_window/constrained_window_views.h"
12 #include "components/web_modal/web_contents_modal_dialog_manager.h" 12 #include "components/web_modal/web_contents_modal_dialog_manager.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "ui/gfx/color_palette.h"
15 #include "ui/views/bubble/bubble_border.h"
16 #include "ui/views/bubble/bubble_frame_view.h"
14 #include "ui/views/controls/link.h" 17 #include "ui/views/controls/link.h"
15 #include "ui/views/controls/styled_label.h" 18 #include "ui/views/controls/styled_label.h"
19 #include "ui/views/layout/layout_constants.h"
16 #include "ui/views/window/dialog_client_view.h" 20 #include "ui/views/window/dialog_client_view.h"
17 21
18 ChooserDialogView::ChooserDialogView( 22 ChooserDialogView::ChooserDialogView(
19 std::unique_ptr<ChooserController> chooser_controller) { 23 std::unique_ptr<ChooserController> chooser_controller) {
20 // ------------------------------------ 24 // ------------------------------------
21 // | Chooser dialog title | 25 // | Chooser dialog title |
22 // | -------------------------------- | 26 // | -------------------------------- |
23 // | | option 0 | | 27 // | | option 0 | |
24 // | | option 1 | | 28 // | | option 1 | |
25 // | | option 2 | | 29 // | | option 2 | |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 61 }
58 62
59 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const { 63 bool ChooserDialogView::IsDialogButtonEnabled(ui::DialogButton button) const {
60 return chooser_content_view_->IsDialogButtonEnabled(button); 64 return chooser_content_view_->IsDialogButtonEnabled(button);
61 } 65 }
62 66
63 views::View* ChooserDialogView::CreateFootnoteView() { 67 views::View* ChooserDialogView::CreateFootnoteView() {
64 return chooser_content_view_->CreateFootnoteView(); 68 return chooser_content_view_->CreateFootnoteView();
65 } 69 }
66 70
71 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) {
72 views::DialogClientView* client =
73 new views::DialogClientView(widget, GetContentsView());
74 client->set_button_row_insets(gfx::Insets());
sky 2016/11/04 21:35:35 It would be nice not to have explicitly set this.
juncai 2016/11/05 00:34:23 The DialogDelegate::CreateClientView() doesn't cal
75 return client;
76 }
77
78 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView(
79 views::Widget* widget) {
80 views::BubbleFrameView* frame = new views::BubbleFrameView(
sky 2016/11/04 21:35:35 Isn't this the same as DialogDelegate::CreateDialo
juncai 2016/11/05 00:34:23 Yes, it is the same as DialogDelegate::CreateDialo
81 gfx::Insets(views::kPanelVertMargin, views::kButtonHEdgeMarginNew, 0,
82 views::kButtonHEdgeMarginNew),
83 gfx::Insets(views::kPanelVertMargin, views::kPanelHorizMargin,
84 views::kPanelVertMargin, views::kPanelHorizMargin));
85 const views::BubbleBorder::Shadow kShadow = views::BubbleBorder::SMALL_SHADOW;
86 std::unique_ptr<views::BubbleBorder> border(new views::BubbleBorder(
87 views::BubbleBorder::FLOAT, kShadow, gfx::kPlaceholderColor));
88 border->set_use_theme_background_color(true);
89 frame->SetBubbleBorder(std::move(border));
90 views::DialogDelegate* delegate =
91 widget->widget_delegate()->AsDialogDelegate();
92 if (delegate)
93 frame->SetFootnoteView(delegate->CreateFootnoteView());
94 return frame;
95 }
96
67 bool ChooserDialogView::Accept() { 97 bool ChooserDialogView::Accept() {
68 chooser_content_view_->Accept(); 98 chooser_content_view_->Accept();
69 return true; 99 return true;
70 } 100 }
71 101
72 bool ChooserDialogView::Cancel() { 102 bool ChooserDialogView::Cancel() {
73 chooser_content_view_->Cancel(); 103 chooser_content_view_->Cancel();
74 return true; 104 return true;
75 } 105 }
76 106
(...skipping 27 matching lines...) Expand all
104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 134 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
105 DCHECK(chooser_controller); 135 DCHECK(chooser_controller);
106 136
107 web_modal::WebContentsModalDialogManager* manager = 137 web_modal::WebContentsModalDialogManager* manager =
108 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_); 138 web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
109 if (manager) { 139 if (manager) {
110 constrained_window::ShowWebModalDialogViews( 140 constrained_window::ShowWebModalDialogViews(
111 new ChooserDialogView(std::move(chooser_controller)), web_contents_); 141 new ChooserDialogView(std::move(chooser_controller)), web_contents_);
112 } 142 }
113 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/chooser_dialog_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698