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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm

Issue 2335623002: Use WebContents instead of Browser to construct PermissionPrompt (Closed)
Patch Set: Created 4 years, 3 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/cocoa/website_settings/permission_bubble_cocoa.h" 5 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #import "chrome/browser/ui/browser_finder.h"
8 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
9 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h " 10 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h "
10 #import "chrome/browser/ui/website_settings/permission_prompt.h" 11 #import "chrome/browser/ui/website_settings/permission_prompt.h"
11 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
12 #import "ui/base/cocoa/nsview_additions.h" 13 #import "ui/base/cocoa/nsview_additions.h"
13 14
14 PermissionBubbleCocoa::PermissionBubbleCocoa(Browser* browser) 15 PermissionBubbleCocoa::PermissionBubbleCocoa(content::WebContents* web_contents)
15 : browser_(browser), delegate_(nullptr), bubbleController_(nil) { 16 : browser_(chrome::FindBrowserWithWebContents(web_contents)),
16 DCHECK(browser); 17 delegate_(nullptr),
18 bubbleController_(nil) {
19 DCHECK(browser_);
17 } 20 }
18 21
19 PermissionBubbleCocoa::~PermissionBubbleCocoa() { 22 PermissionBubbleCocoa::~PermissionBubbleCocoa() {
20 } 23 }
21 24
22 void PermissionBubbleCocoa::Show( 25 void PermissionBubbleCocoa::Show(
23 const std::vector<PermissionRequest*>& requests, 26 const std::vector<PermissionRequest*>& requests,
24 const std::vector<bool>& accept_state) { 27 const std::vector<bool>& accept_state) {
25 if (!bubbleController_) { 28 if (!bubbleController_) {
26 bubbleController_ = 29 bubbleController_ =
(...skipping 28 matching lines...) Expand all
55 [bubbleController_ updateAnchorPosition]; 58 [bubbleController_ updateAnchorPosition];
56 } 59 }
57 60
58 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() { 61 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() {
59 return [bubbleController_ window]; 62 return [bubbleController_ window];
60 } 63 }
61 64
62 void PermissionBubbleCocoa::OnBubbleClosing() { 65 void PermissionBubbleCocoa::OnBubbleClosing() {
63 bubbleController_ = nil; 66 bubbleController_ = nil;
64 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698