| 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" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "chrome/browser/permissions/permission_request.h" | 12 #include "chrome/browser/permissions/permission_request.h" |
| 13 #include "chrome/browser/platform_util.h" | 13 #include "chrome/browser/platform_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/layout_constants.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 18 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | 19 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
| 19 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h" | 20 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h" |
| 20 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser
ver.h" | 21 #include "chrome/browser/ui/views/website_settings/permission_selector_row_obser
ver.h" |
| 21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/strings/grit/components_strings.h" | 23 #include "components/strings/grit/components_strings.h" |
| 23 #include "components/url_formatter/elide_url.h" | 24 #include "components/url_formatter/elide_url.h" |
| 24 #include "ui/accessibility/ax_node_data.h" | 25 #include "ui/accessibility/ax_node_data.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/models/combobox_model.h" | 27 #include "ui/base/models/combobox_model.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (bubble_delegate_) | 417 if (bubble_delegate_) |
| 417 bubble_delegate_->CloseBubble(); | 418 bubble_delegate_->CloseBubble(); |
| 418 | 419 |
| 419 bubble_delegate_ = | 420 bubble_delegate_ = |
| 420 new PermissionsBubbleDialogDelegateView(this, requests, values); | 421 new PermissionsBubbleDialogDelegateView(this, requests, values); |
| 421 | 422 |
| 422 // Set |parent_window| because some valid anchors can become hidden. | 423 // Set |parent_window| because some valid anchors can become hidden. |
| 423 bubble_delegate_->set_parent_window( | 424 bubble_delegate_->set_parent_window( |
| 424 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); | 425 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); |
| 425 | 426 |
| 427 // Compensate for vertical padding in the anchor view's image. Note this is |
| 428 // ignored whenever the anchor view is null. |
| 429 bubble_delegate_->set_anchor_view_insets(gfx::Insets( |
| 430 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 431 |
| 426 views::BubbleDialogDelegateView::CreateBubble(bubble_delegate_)->Show(); | 432 views::BubbleDialogDelegateView::CreateBubble(bubble_delegate_)->Show(); |
| 427 bubble_delegate_->SizeToContents(); | 433 bubble_delegate_->SizeToContents(); |
| 428 | 434 |
| 429 bubble_delegate_->UpdateAnchor(GetAnchorView(), | 435 bubble_delegate_->UpdateAnchor(GetAnchorView(), |
| 430 GetAnchorPoint(), | 436 GetAnchorPoint(), |
| 431 GetAnchorArrow()); | 437 GetAnchorArrow()); |
| 432 } | 438 } |
| 433 | 439 |
| 434 bool PermissionPromptImpl::CanAcceptRequestUpdate() { | 440 bool PermissionPromptImpl::CanAcceptRequestUpdate() { |
| 435 return !(bubble_delegate_ && bubble_delegate_->IsMouseHovered()); | 441 return !(bubble_delegate_ && bubble_delegate_->IsMouseHovered()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 494 } |
| 489 | 495 |
| 490 void PermissionPromptImpl::Deny() { | 496 void PermissionPromptImpl::Deny() { |
| 491 if (delegate_) | 497 if (delegate_) |
| 492 delegate_->Deny(); | 498 delegate_->Deny(); |
| 493 } | 499 } |
| 494 | 500 |
| 495 Profile* PermissionPromptImpl::GetProfile() { | 501 Profile* PermissionPromptImpl::GetProfile() { |
| 496 return browser_->profile(); | 502 return browser_->profile(); |
| 497 } | 503 } |
| OLD | NEW |