Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc

Issue 2868783002: Move requests from Show() argument to PermissionPrompt::Delegate (Closed)
Patch Set: tweak comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 delegate_(nullptr), 395 delegate_(nullptr),
396 bubble_delegate_(nullptr) {} 396 bubble_delegate_(nullptr) {}
397 397
398 PermissionPromptImpl::~PermissionPromptImpl() { 398 PermissionPromptImpl::~PermissionPromptImpl() {
399 } 399 }
400 400
401 void PermissionPromptImpl::SetDelegate(Delegate* delegate) { 401 void PermissionPromptImpl::SetDelegate(Delegate* delegate) {
402 delegate_ = delegate; 402 delegate_ = delegate;
403 } 403 }
404 404
405 void PermissionPromptImpl::Show(const std::vector<PermissionRequest*>& requests, 405 void PermissionPromptImpl::Show() {
406 const std::vector<bool>& values) {
407 DCHECK(browser_); 406 DCHECK(browser_);
408 DCHECK(browser_->window()); 407 DCHECK(browser_->window());
409 408
410 if (bubble_delegate_) 409 if (bubble_delegate_)
411 bubble_delegate_->CloseBubble(); 410 bubble_delegate_->CloseBubble();
412 411
413 bubble_delegate_ = 412 bubble_delegate_ = new PermissionsBubbleDialogDelegateView(
414 new PermissionsBubbleDialogDelegateView(this, requests, values); 413 this, delegate_->Requests(), delegate_->AcceptStates());
415 414
416 // Set |parent_window| because some valid anchors can become hidden. 415 // Set |parent_window| because some valid anchors can become hidden.
417 bubble_delegate_->set_parent_window( 416 bubble_delegate_->set_parent_window(
418 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); 417 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow()));
419 418
420 // Compensate for vertical padding in the anchor view's image. Note this is 419 // Compensate for vertical padding in the anchor view's image. Note this is
421 // ignored whenever the anchor view is null. 420 // ignored whenever the anchor view is null.
422 bubble_delegate_->set_anchor_view_insets(gfx::Insets( 421 bubble_delegate_->set_anchor_view_insets(gfx::Insets(
423 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 422 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
424 423
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 486 }
488 487
489 void PermissionPromptImpl::Deny() { 488 void PermissionPromptImpl::Deny() {
490 if (delegate_) 489 if (delegate_)
491 delegate_->Deny(); 490 delegate_->Deny();
492 } 491 }
493 492
494 Profile* PermissionPromptImpl::GetProfile() { 493 Profile* PermissionPromptImpl::GetProfile() {
495 return browser_->profile(); 494 return browser_->profile();
496 } 495 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698