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