Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/website_settings/permission_prompt_impl.h" | 5 #include "chrome/browser/ui/views/website_settings/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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 // BubbleDialogDelegateView: | 157 // BubbleDialogDelegateView: |
| 158 bool ShouldShowCloseButton() const override; | 158 bool ShouldShowCloseButton() const override; |
| 159 const gfx::FontList& GetTitleFontList() const override; | 159 const gfx::FontList& GetTitleFontList() const override; |
| 160 base::string16 GetWindowTitle() const override; | 160 base::string16 GetWindowTitle() const override; |
| 161 void OnWidgetDestroying(views::Widget* widget) override; | 161 void OnWidgetDestroying(views::Widget* widget) override; |
| 162 gfx::Size GetPreferredSize() const override; | 162 gfx::Size GetPreferredSize() const override; |
| 163 void GetAccessibleState(ui::AXViewState* state) override; | 163 void GetAccessibleState(ui::AXViewState* state) override; |
| 164 bool Cancel() override; | 164 bool Cancel() override; |
| 165 bool Accept() override; | 165 bool Accept() override; |
| 166 bool Close() override; | 166 bool Close() override; |
| 167 int GetDefaultDialogButton() const override; | |
| 167 int GetDialogButtons() const override; | 168 int GetDialogButtons() const override; |
| 168 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 169 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 169 | 170 |
| 170 // PermissionCombobox::Listener: | 171 // PermissionCombobox::Listener: |
| 171 void PermissionSelectionChanged(int index, bool allowed) override; | 172 void PermissionSelectionChanged(int index, bool allowed) override; |
| 172 | 173 |
| 173 // Updates the anchor's arrow and view. Also repositions the bubble so it's | 174 // Updates the anchor's arrow and view. Also repositions the bubble so it's |
| 174 // displayed in the correct location. | 175 // displayed in the correct location. |
| 175 void UpdateAnchor(views::View* anchor_view, | 176 void UpdateAnchor(views::View* anchor_view, |
| 176 const gfx::Point& anchor_point, | 177 const gfx::Point& anchor_point, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 const int kWidth = 320 - GetInsets().width(); | 298 const int kWidth = 320 - GetInsets().width(); |
| 298 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); | 299 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); |
| 299 } | 300 } |
| 300 | 301 |
| 301 void PermissionsBubbleDialogDelegateView::GetAccessibleState( | 302 void PermissionsBubbleDialogDelegateView::GetAccessibleState( |
| 302 ui::AXViewState* state) { | 303 ui::AXViewState* state) { |
| 303 views::BubbleDialogDelegateView::GetAccessibleState(state); | 304 views::BubbleDialogDelegateView::GetAccessibleState(state); |
| 304 state->role = ui::AX_ROLE_ALERT_DIALOG; | 305 state->role = ui::AX_ROLE_ALERT_DIALOG; |
| 305 } | 306 } |
| 306 | 307 |
| 308 int PermissionsBubbleDialogDelegateView::GetDefaultDialogButton() const { | |
| 309 // To prevent permissions being accepted accidentally, and as a security | |
| 310 // measure against crbug.com/619429, permission prompts should not be accepted | |
| 311 // as the default action. | |
| 312 return ui::DIALOG_BUTTON_NONE; | |
|
felt
2016/08/04 00:17:29
Does this have the side effect of changing the but
benwells
2016/08/04 05:09:00
No, button ordering is controlled here: https://cs
felt
2016/08/04 23:53:29
oh!! that does have the side effect of making this
| |
| 313 } | |
| 314 | |
| 307 int PermissionsBubbleDialogDelegateView::GetDialogButtons() const { | 315 int PermissionsBubbleDialogDelegateView::GetDialogButtons() const { |
| 308 int buttons = ui::DIALOG_BUTTON_OK; | 316 int buttons = ui::DIALOG_BUTTON_OK; |
| 309 if (!multiple_requests_) | 317 if (!multiple_requests_) |
| 310 buttons |= ui::DIALOG_BUTTON_CANCEL; | 318 buttons |= ui::DIALOG_BUTTON_CANCEL; |
| 311 return buttons; | 319 return buttons; |
| 312 } | 320 } |
| 313 | 321 |
| 314 base::string16 PermissionsBubbleDialogDelegateView::GetDialogButtonLabel( | 322 base::string16 PermissionsBubbleDialogDelegateView::GetDialogButtonLabel( |
| 315 ui::DialogButton button) const { | 323 ui::DialogButton button) const { |
| 316 if (button == ui::DIALOG_BUTTON_CANCEL) | 324 if (button == ui::DIALOG_BUTTON_CANCEL) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 | 457 |
| 450 void PermissionPromptImpl::Accept() { | 458 void PermissionPromptImpl::Accept() { |
| 451 if (delegate_) | 459 if (delegate_) |
| 452 delegate_->Accept(); | 460 delegate_->Accept(); |
| 453 } | 461 } |
| 454 | 462 |
| 455 void PermissionPromptImpl::Deny() { | 463 void PermissionPromptImpl::Deny() { |
| 456 if (delegate_) | 464 if (delegate_) |
| 457 delegate_->Deny(); | 465 delegate_->Deny(); |
| 458 } | 466 } |
| OLD | NEW |