| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 | 440 |
| 441 void PermissionPromptImpl::Hide() { | 441 void PermissionPromptImpl::Hide() { |
| 442 if (bubble_delegate_) { | 442 if (bubble_delegate_) { |
| 443 bubble_delegate_->CloseBubble(); | 443 bubble_delegate_->CloseBubble(); |
| 444 bubble_delegate_ = nullptr; | 444 bubble_delegate_ = nullptr; |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 | 447 |
| 448 bool PermissionPromptImpl::IsVisible() { | |
| 449 return bubble_delegate_ != nullptr; | |
| 450 } | |
| 451 | |
| 452 void PermissionPromptImpl::UpdateAnchorPosition() { | 448 void PermissionPromptImpl::UpdateAnchorPosition() { |
| 453 DCHECK(browser_); | 449 DCHECK(browser_); |
| 454 DCHECK(browser_->window()); | 450 DCHECK(browser_->window()); |
| 455 | 451 |
| 456 if (IsVisible()) { | 452 if (bubble_delegate_) { |
| 457 bubble_delegate_->set_parent_window( | 453 bubble_delegate_->set_parent_window( |
| 458 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); | 454 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); |
| 459 bubble_delegate_->UpdateAnchor(GetAnchorView(), | 455 bubble_delegate_->UpdateAnchor(GetAnchorView(), |
| 460 GetAnchorPoint(), | 456 GetAnchorPoint(), |
| 461 GetAnchorArrow()); | 457 GetAnchorArrow()); |
| 462 } | 458 } |
| 463 } | 459 } |
| 464 | 460 |
| 465 gfx::NativeWindow PermissionPromptImpl::GetNativeWindow() { | 461 gfx::NativeWindow PermissionPromptImpl::GetNativeWindow() { |
| 466 if (bubble_delegate_ && bubble_delegate_->GetWidget()) | 462 if (bubble_delegate_ && bubble_delegate_->GetWidget()) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 491 } | 487 } |
| 492 | 488 |
| 493 void PermissionPromptImpl::Deny() { | 489 void PermissionPromptImpl::Deny() { |
| 494 if (delegate_) | 490 if (delegate_) |
| 495 delegate_->Deny(); | 491 delegate_->Deny(); |
| 496 } | 492 } |
| 497 | 493 |
| 498 Profile* PermissionPromptImpl::GetProfile() { | 494 Profile* PermissionPromptImpl::GetProfile() { |
| 499 return browser_->profile(); | 495 return browser_->profile(); |
| 500 } | 496 } |
| OLD | NEW |