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

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

Issue 2821413002: views: support dialog width snapping once and for all (Closed)
Patch Set: DialogDelegateView -> BubbleDialogDelegateView 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));
79 constexpr int kMinHeight = 320;
80 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
81 int min_width = provider->GetDialogPreferredWidth(DialogWidth::MEDIUM);
82 if (!min_width)
83 min_width = kMinWidth;
84 client->set_minimum_size(gfx::Size(min_width, kMinHeight));
85 79
86 client->set_button_row_insets(gfx::Insets( 80 client->set_button_row_insets(
87 provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_VERTICAL), 0, 0, 81 gfx::Insets(views::LayoutProvider::Get()->GetDistanceMetric(
88 0)); 82 DISTANCE_UNRELATED_CONTROL_VERTICAL),
83 0, 0, 0));
89 return client; 84 return client;
90 } 85 }
91 86
92 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView( 87 views::NonClientFrameView* ChooserDialogView::CreateNonClientFrameView(
93 views::Widget* widget) { 88 views::Widget* widget) {
94 // ChooserDialogView always has a parent, so ShouldUseCustomFrame() should 89 // ChooserDialogView always has a parent, so ShouldUseCustomFrame() should
95 // always be true. 90 // always be true.
96 DCHECK(ShouldUseCustomFrame()); 91 DCHECK(ShouldUseCustomFrame());
97 return views::DialogDelegate::CreateDialogFrameView( 92 return views::DialogDelegate::CreateDialogFrameView(
98 widget, gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric( 93 widget, gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void ChromeDevicePermissionsPrompt::ShowDialogViews() { 146 void ChromeDevicePermissionsPrompt::ShowDialogViews() {
152 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 147 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
153 148
154 std::unique_ptr<ChooserController> chooser_controller( 149 std::unique_ptr<ChooserController> chooser_controller(
155 new DevicePermissionsDialogController(web_contents()->GetMainFrame(), 150 new DevicePermissionsDialogController(web_contents()->GetMainFrame(),
156 prompt())); 151 prompt()));
157 152
158 constrained_window::ShowWebModalDialogViews( 153 constrained_window::ShowWebModalDialogViews(
159 new ChooserDialogView(std::move(chooser_controller)), web_contents()); 154 new ChooserDialogView(std::move(chooser_controller)), web_contents());
160 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698