| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 void Close(); | 164 void Close(); |
| 165 void SizeToContents(); | 165 void SizeToContents(); |
| 166 | 166 |
| 167 // BubbleDelegateView: | 167 // BubbleDelegateView: |
| 168 bool ShouldShowCloseButton() const override; | 168 bool ShouldShowCloseButton() const override; |
| 169 bool ShouldShowWindowTitle() const override; | 169 bool ShouldShowWindowTitle() const override; |
| 170 const gfx::FontList& GetTitleFontList() const override; | 170 const gfx::FontList& GetTitleFontList() const override; |
| 171 base::string16 GetWindowTitle() const override; | 171 base::string16 GetWindowTitle() const override; |
| 172 void OnWidgetDestroying(views::Widget* widget) override; | 172 void OnWidgetDestroying(views::Widget* widget) override; |
| 173 gfx::Size GetPreferredSize() const override; |
| 173 void GetAccessibleState(ui::AXViewState* state) override; | 174 void GetAccessibleState(ui::AXViewState* state) override; |
| 174 | 175 |
| 175 // ButtonListener: | 176 // ButtonListener: |
| 176 void ButtonPressed(views::Button* button, const ui::Event& event) override; | 177 void ButtonPressed(views::Button* button, const ui::Event& event) override; |
| 177 | 178 |
| 178 // PermissionCombobox::Listener: | 179 // PermissionCombobox::Listener: |
| 179 void PermissionSelectionChanged(int index, bool allowed) override; | 180 void PermissionSelectionChanged(int index, bool allowed) override; |
| 180 | 181 |
| 181 // Updates the anchor's arrow and view. Also repositions the bubble so it's | 182 // Updates the anchor's arrow and view. Also repositions the bubble so it's |
| 182 // displayed in the correct location. | 183 // displayed in the correct location. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 } | 339 } |
| 339 | 340 |
| 340 void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) { | 341 void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) { |
| 341 views::BubbleDelegateView::OnWidgetDestroying(widget); | 342 views::BubbleDelegateView::OnWidgetDestroying(widget); |
| 342 if (owner_) { | 343 if (owner_) { |
| 343 owner_->Closing(); | 344 owner_->Closing(); |
| 344 owner_ = nullptr; | 345 owner_ = nullptr; |
| 345 } | 346 } |
| 346 } | 347 } |
| 347 | 348 |
| 349 gfx::Size PermissionsBubbleDelegateView::GetPreferredSize() const { |
| 350 // TODO(estade): bubbles should default to this width. |
| 351 const int kWidth = 320 - GetInsets().width(); |
| 352 return gfx::Size(kWidth, GetHeightForWidth(kWidth)); |
| 353 } |
| 354 |
| 348 void PermissionsBubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { | 355 void PermissionsBubbleDelegateView::GetAccessibleState(ui::AXViewState* state) { |
| 349 views::BubbleDelegateView::GetAccessibleState(state); | 356 views::BubbleDelegateView::GetAccessibleState(state); |
| 350 state->role = ui::AX_ROLE_ALERT_DIALOG; | 357 state->role = ui::AX_ROLE_ALERT_DIALOG; |
| 351 } | 358 } |
| 352 | 359 |
| 353 void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button, | 360 void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button, |
| 354 const ui::Event& event) { | 361 const ui::Event& event) { |
| 355 if (!owner_) | 362 if (!owner_) |
| 356 return; | 363 return; |
| 357 | 364 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 496 |
| 490 void PermissionBubbleViewViews::Accept() { | 497 void PermissionBubbleViewViews::Accept() { |
| 491 if (delegate_) | 498 if (delegate_) |
| 492 delegate_->Accept(); | 499 delegate_->Accept(); |
| 493 } | 500 } |
| 494 | 501 |
| 495 void PermissionBubbleViewViews::Deny() { | 502 void PermissionBubbleViewViews::Deny() { |
| 496 if (delegate_) | 503 if (delegate_) |
| 497 delegate_->Deny(); | 504 delegate_->Deny(); |
| 498 } | 505 } |
| OLD | NEW |