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

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: rm vector on android 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
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 bubble_delegate_ = new PermissionsBubbleDialogDelegateView(
411 bubble_delegate_->CloseBubble(); 410 this, delegate_->Requests(), delegate_->AcceptStates());
raymes 2017/05/11 01:17:55 Should this be removed?
Timothy Loh 2017/05/11 04:42:08 It's dead code (Show is only called when there's n
412
413 bubble_delegate_ =
414 new PermissionsBubbleDialogDelegateView(this, requests, values);
415 411
416 // Set |parent_window| because some valid anchors can become hidden. 412 // Set |parent_window| because some valid anchors can become hidden.
417 bubble_delegate_->set_parent_window( 413 bubble_delegate_->set_parent_window(
418 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow())); 414 platform_util::GetViewForWindow(browser_->window()->GetNativeWindow()));
419 415
420 // Compensate for vertical padding in the anchor view's image. Note this is 416 // Compensate for vertical padding in the anchor view's image. Note this is
421 // ignored whenever the anchor view is null. 417 // ignored whenever the anchor view is null.
422 bubble_delegate_->set_anchor_view_insets(gfx::Insets( 418 bubble_delegate_->set_anchor_view_insets(gfx::Insets(
423 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 419 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
424 420
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 483 }
488 484
489 void PermissionPromptImpl::Deny() { 485 void PermissionPromptImpl::Deny() {
490 if (delegate_) 486 if (delegate_)
491 delegate_->Deny(); 487 delegate_->Deny();
492 } 488 }
493 489
494 Profile* PermissionPromptImpl::GetProfile() { 490 Profile* PermissionPromptImpl::GetProfile() {
495 return browser_->profile(); 491 return browser_->profile();
496 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698