| 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/permissions_bubble_view.h" | 5 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 void Close(); | 161 void Close(); |
| 162 void SizeToContents(); | 162 void SizeToContents(); |
| 163 | 163 |
| 164 // BubbleDelegateView: | 164 // BubbleDelegateView: |
| 165 bool ShouldShowCloseButton() const override; | 165 bool ShouldShowCloseButton() const override; |
| 166 bool ShouldShowWindowTitle() const override; | 166 bool ShouldShowWindowTitle() const override; |
| 167 const gfx::FontList& GetTitleFontList() const override; | 167 const gfx::FontList& GetTitleFontList() const override; |
| 168 base::string16 GetWindowTitle() const override; | 168 base::string16 GetWindowTitle() const override; |
| 169 void OnWidgetDestroying(views::Widget* widget) override; | 169 void OnWidgetDestroying(views::Widget* widget) override; |
| 170 void GetAccessibleState(ui::AXViewState* state) override; | |
| 171 | 170 |
| 172 // ButtonListener: | 171 // ButtonListener: |
| 173 void ButtonPressed(views::Button* button, const ui::Event& event) override; | 172 void ButtonPressed(views::Button* button, const ui::Event& event) override; |
| 174 | 173 |
| 175 // PermissionCombobox::Listener: | 174 // PermissionCombobox::Listener: |
| 176 void PermissionSelectionChanged(int index, bool allowed) override; | 175 void PermissionSelectionChanged(int index, bool allowed) override; |
| 177 | 176 |
| 178 // Updates the anchor's arrow and view. Also repositions the bubble so it's | 177 // Updates the anchor's arrow and view. Also repositions the bubble so it's |
| 179 // displayed in the correct location. | 178 // displayed in the correct location. |
| 180 void UpdateAnchor(views::View* anchor_view, | 179 void UpdateAnchor(views::View* anchor_view, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 344 } |
| 346 | 345 |
| 347 void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) { | 346 void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) { |
| 348 views::BubbleDelegateView::OnWidgetDestroying(widget); | 347 views::BubbleDelegateView::OnWidgetDestroying(widget); |
| 349 if (owner_) { | 348 if (owner_) { |
| 350 owner_->Closing(); | 349 owner_->Closing(); |
| 351 owner_ = nullptr; | 350 owner_ = nullptr; |
| 352 } | 351 } |
| 353 } | 352 } |
| 354 | 353 |
| 355 void PermissionsBubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { | |
| 356 views::BubbleDelegateView::GetAccessibleState(state); | |
| 357 state->role = ui::AX_ROLE_ALERT_DIALOG; | |
| 358 } | |
| 359 | |
| 360 void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button, | 354 void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button, |
| 361 const ui::Event& event) { | 355 const ui::Event& event) { |
| 362 if (!owner_) | 356 if (!owner_) |
| 363 return; | 357 return; |
| 364 | 358 |
| 365 if (button == allow_) | 359 if (button == allow_) |
| 366 owner_->Accept(); | 360 owner_->Accept(); |
| 367 else if (button == deny_) | 361 else if (button == deny_) |
| 368 owner_->Deny(); | 362 owner_->Deny(); |
| 369 } | 363 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 476 |
| 483 void PermissionBubbleViewViews::Accept() { | 477 void PermissionBubbleViewViews::Accept() { |
| 484 if (delegate_) | 478 if (delegate_) |
| 485 delegate_->Accept(); | 479 delegate_->Accept(); |
| 486 } | 480 } |
| 487 | 481 |
| 488 void PermissionBubbleViewViews::Deny() { | 482 void PermissionBubbleViewViews::Deny() { |
| 489 if (delegate_) | 483 if (delegate_) |
| 490 delegate_->Deny(); | 484 delegate_->Deny(); |
| 491 } | 485 } |
| OLD | NEW |