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

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

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "chrome/browser/chooser_controller/chooser_controller.h" 9 #include "chrome/browser/chooser_controller/chooser_controller.h"
10 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h" 10 #include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 views::View* ChooserDialogView::CreateFootnoteView() { 70 views::View* ChooserDialogView::CreateFootnoteView() {
71 return device_chooser_content_view_->footnote_link(); 71 return device_chooser_content_view_->footnote_link();
72 } 72 }
73 73
74 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) { 74 views::ClientView* ChooserDialogView::CreateClientView(views::Widget* widget) {
75 views::DialogClientView* client = 75 views::DialogClientView* client =
76 new views::DialogClientView(widget, GetContentsView()); 76 new views::DialogClientView(widget, GetContentsView());
77 77
78 constexpr int kMinWidth = 402; 78 client->set_minimum_size(gfx::Size(402, 320));
Peter Kasting 2017/03/30 00:35:35 I think this line may not be needed at all. If it
79 constexpr int kMinHeight = 320;
80 int min_width = LayoutDelegate::Get()->GetDialogPreferredWidth(
81 LayoutDelegate::DialogWidth::MEDIUM);
82 if (!min_width)
83 min_width = kMinWidth;
84 client->set_minimum_size(gfx::Size(min_width, kMinHeight));
85 79
86 LayoutDelegate* delegate = LayoutDelegate::Get(); 80 LayoutDelegate* delegate = LayoutDelegate::Get();
87 client->set_button_row_insets(gfx::Insets( 81 client->set_button_row_insets(gfx::Insets(
88 delegate->GetMetric( 82 delegate->GetMetric(
89 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING), 83 LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING),
90 0, 0, 0)); 84 0, 0, 0));
91 return client; 85 return client;
92 } 86 }
93 87
94 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( 88 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void ChromeDevicePermissionsPrompt::ShowDialogViews() { 147 void ChromeDevicePermissionsPrompt::ShowDialogViews() {
154 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 148 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
155 149
156 std::unique_ptr<ChooserController> chooser_controller( 150 std::unique_ptr<ChooserController> chooser_controller(
157 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), 151 new DevicePermissionsDialogController(web_contents()->GetMainFrame(),
158 prompt())); 152 prompt()));
159 153
160 constrained_window::ShowWebModalDialogViews( 154 constrained_window::ShowWebModalDialogViews(
161 new ChooserDialogView(std::move(chooser_controller)), web_contents()); 155 new ChooserDialogView(std::move(chooser_controller)), web_contents());
162 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698