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

Side by Side Diff: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permission_bubble/permission_prompt_impl.h" 5 #include "chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 public: 145 public:
146 PermissionsBubbleDialogDelegateView( 146 PermissionsBubbleDialogDelegateView(
147 PermissionPromptImpl* owner, 147 PermissionPromptImpl* owner,
148 const std::vector<PermissionRequest*>& requests, 148 const std::vector<PermissionRequest*>& requests,
149 const std::vector<bool>& accept_state); 149 const std::vector<bool>& accept_state);
150 ~PermissionsBubbleDialogDelegateView() override; 150 ~PermissionsBubbleDialogDelegateView() override;
151 151
152 void CloseBubble(); 152 void CloseBubble();
153 void SizeToContents(); 153 void SizeToContents();
154 154
155 // DialogDelegateView:
156 gfx::Size GetUnsnappedPreferredSize() const override;
Peter Kasting 2017/03/30 00:35:35 Nit: Leave as part of the below list
157
155 // BubbleDialogDelegateView: 158 // BubbleDialogDelegateView:
156 bool ShouldShowCloseButton() const override; 159 bool ShouldShowCloseButton() const override;
157 const gfx::FontList& GetTitleFontList() const override; 160 const gfx::FontList& GetTitleFontList() const override;
158 base::string16 GetWindowTitle() const override; 161 base::string16 GetWindowTitle() const override;
159 void OnWidgetDestroying(views::Widget* widget) override; 162 void OnWidgetDestroying(views::Widget* widget) override;
160 gfx::Size GetPreferredSize() const override;
161 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 163 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
162 bool Cancel() override; 164 bool Cancel() override;
163 bool Accept() override; 165 bool Accept() override;
164 bool Close() override; 166 bool Close() override;
165 int GetDefaultDialogButton() const override; 167 int GetDefaultDialogButton() const override;
166 int GetDialogButtons() const override; 168 int GetDialogButtons() const override;
167 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 169 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
168 170
169 // PermissionCombobox::Listener: 171 // PermissionCombobox::Listener:
170 void PermissionSelectionChanged(int index, bool allowed) override; 172 void PermissionSelectionChanged(int index, bool allowed) override;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 301
300 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying( 302 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying(
301 views::Widget* widget) { 303 views::Widget* widget) {
302 views::BubbleDialogDelegateView::OnWidgetDestroying(widget); 304 views::BubbleDialogDelegateView::OnWidgetDestroying(widget);
303 if (owner_) { 305 if (owner_) {
304 owner_->Closing(); 306 owner_->Closing();
305 owner_ = nullptr; 307 owner_ = nullptr;
306 } 308 }
307 } 309 }
308 310
309 gfx::Size PermissionsBubbleDialogDelegateView::GetPreferredSize() const { 311 gfx::Size PermissionsBubbleDialogDelegateView::GetUnsnappedPreferredSize()
312 const {
310 // TODO(estade): bubbles should default to this width. 313 // TODO(estade): bubbles should default to this width.
Peter Kasting 2017/03/30 00:35:35 Nit: This TODO can go away. In fact I think this
311 const int kWidth = 320 - GetInsets().width(); 314 const int kWidth = 320 - GetInsets().width();
Peter Kasting 2017/03/30 00:35:35 I don't understand why this wants to subtract GetI
312 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); 315 return gfx::Size(kWidth, GetHeightForWidth(kWidth));
313 } 316 }
314 317
315 void PermissionsBubbleDialogDelegateView::GetAccessibleNodeData( 318 void PermissionsBubbleDialogDelegateView::GetAccessibleNodeData(
316 ui::AXNodeData* node_data) { 319 ui::AXNodeData* node_data) {
317 views::BubbleDialogDelegateView::GetAccessibleNodeData(node_data); 320 views::BubbleDialogDelegateView::GetAccessibleNodeData(node_data);
318 node_data->role = ui::AX_ROLE_ALERT_DIALOG; 321 node_data->role = ui::AX_ROLE_ALERT_DIALOG;
319 } 322 }
320 323
321 int PermissionsBubbleDialogDelegateView::GetDefaultDialogButton() const { 324 int PermissionsBubbleDialogDelegateView::GetDefaultDialogButton() const {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 494 }
492 495
493 void PermissionPromptImpl::Deny() { 496 void PermissionPromptImpl::Deny() {
494 if (delegate_) 497 if (delegate_)
495 delegate_->Deny(); 498 delegate_->Deny();
496 } 499 }
497 500
498 Profile* PermissionPromptImpl::GetProfile() { 501 Profile* PermissionPromptImpl::GetProfile() {
499 return browser_->profile(); 502 return browser_->profile();
500 } 503 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698