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

Side by Side Diff: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc

Issue 2907873002: views: impose minimum width on non-Harmony snappables (Closed)
Patch Set: Created 3 years, 7 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ~PermissionsBubbleDialogDelegateView() override; 150 ~PermissionsBubbleDialogDelegateView() override;
151 151
152 void CloseBubble(); 152 void CloseBubble();
153 void SizeToContents(); 153 void SizeToContents();
154 154
155 // BubbleDialogDelegateView: 155 // BubbleDialogDelegateView:
156 bool ShouldShowCloseButton() const override; 156 bool ShouldShowCloseButton() const override;
157 const gfx::FontList& GetTitleFontList() const override; 157 const gfx::FontList& GetTitleFontList() const override;
158 base::string16 GetWindowTitle() const override; 158 base::string16 GetWindowTitle() const override;
159 void OnWidgetDestroying(views::Widget* widget) override; 159 void OnWidgetDestroying(views::Widget* widget) override;
160 gfx::Size GetPreferredSize() const override;
161 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 160 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
162 bool Cancel() override; 161 bool Cancel() override;
163 bool Accept() override; 162 bool Accept() override;
164 bool Close() override; 163 bool Close() override;
165 int GetDefaultDialogButton() const override; 164 int GetDefaultDialogButton() const override;
166 int GetDialogButtons() const override; 165 int GetDialogButtons() const override;
167 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; 166 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
168 167
169 // PermissionCombobox::Listener: 168 // PermissionCombobox::Listener:
170 void PermissionSelectionChanged(int index, bool allowed) override; 169 void PermissionSelectionChanged(int index, bool allowed) override;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 296
298 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying( 297 void PermissionsBubbleDialogDelegateView::OnWidgetDestroying(
299 views::Widget* widget) { 298 views::Widget* widget) {
300 views::BubbleDialogDelegateView::OnWidgetDestroying(widget); 299 views::BubbleDialogDelegateView::OnWidgetDestroying(widget);
301 if (owner_) { 300 if (owner_) {
302 owner_->Closing(); 301 owner_->Closing();
303 owner_ = nullptr; 302 owner_ = nullptr;
304 } 303 }
305 } 304 }
306 305
307 gfx::Size PermissionsBubbleDialogDelegateView::GetPreferredSize() const {
308 // TODO(estade): bubbles should default to this width.
309 const int kWidth = 320 - GetInsets().width();
310 return gfx::Size(kWidth, GetHeightForWidth(kWidth));
311 }
312
313 void PermissionsBubbleDialogDelegateView::GetAccessibleNodeData( 306 void PermissionsBubbleDialogDelegateView::GetAccessibleNodeData(
314 ui::AXNodeData* node_data) { 307 ui::AXNodeData* node_data) {
315 views::BubbleDialogDelegateView::GetAccessibleNodeData(node_data); 308 views::BubbleDialogDelegateView::GetAccessibleNodeData(node_data);
316 node_data->role = ui::AX_ROLE_ALERT_DIALOG; 309 node_data->role = ui::AX_ROLE_ALERT_DIALOG;
317 } 310 }
318 311
319 int PermissionsBubbleDialogDelegateView::GetDefaultDialogButton() const { 312 int PermissionsBubbleDialogDelegateView::GetDefaultDialogButton() const {
320 // To prevent permissions being accepted accidentally, and as a security 313 // To prevent permissions being accepted accidentally, and as a security
321 // measure against crbug.com/619429, permission prompts should not be accepted 314 // measure against crbug.com/619429, permission prompts should not be accepted
322 // as the default action. 315 // as the default action.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 481 }
489 482
490 void PermissionPromptImpl::Deny() { 483 void PermissionPromptImpl::Deny() {
491 if (delegate_) 484 if (delegate_)
492 delegate_->Deny(); 485 delegate_->Deny();
493 } 486 }
494 487
495 Profile* PermissionPromptImpl::GetProfile() { 488 Profile* PermissionPromptImpl::GetProfile() {
496 return browser_->profile(); 489 return browser_->profile();
497 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698