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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h

Issue 2752623003: [Mac] Fix for the security chip (Closed)
Patch Set: . Created 3 years, 9 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/omnibox_decoration_bubble_controller.h" 8 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
9 #include "chrome/browser/ui/website_settings/permission_prompt.h" 9 #include "chrome/browser/ui/website_settings/permission_prompt.h"
10 #include "ui/base/models/simple_menu_model.h" 10 #include "ui/base/models/simple_menu_model.h"
11 11
12 class Browser; 12 class Browser;
13 class LocationBarDecoration;
13 @class MenuController; 14 @class MenuController;
14 class PermissionBubbleCocoa; 15 class PermissionBubbleCocoa;
15 class PermissionRequest; 16 class PermissionRequest;
16 17
17 @interface PermissionBubbleController 18 @interface PermissionBubbleController
18 : OmniboxDecorationBubbleController<NSTextViewDelegate> { 19 : BaseBubbleController<NSTextViewDelegate> {
19 @private 20 @private
20 // Array of views that are the checkboxes for every requested permission. 21 // Array of views that are the checkboxes for every requested permission.
21 // Only populated if multiple requests are shown at once. 22 // Only populated if multiple requests are shown at once.
22 base::scoped_nsobject<NSMutableArray> checkboxes_; 23 base::scoped_nsobject<NSMutableArray> checkboxes_;
23 24
24 // Delegate to be informed of user actions. 25 // Delegate to be informed of user actions.
25 PermissionPrompt::Delegate* delegate_; // Weak. 26 PermissionPrompt::Delegate* delegate_; // Weak.
26 27
27 // Used to determine the correct anchor location and parent window. 28 // Used to determine the correct anchor location and parent window.
28 Browser* browser_; // Weak. 29 Browser* browser_; // Weak.
29 30
30 // Delegate that receives menu events on behalf of this. 31 // Delegate that receives menu events on behalf of this.
31 std::unique_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_; 32 std::unique_ptr<ui::SimpleMenuModel::Delegate> menuDelegate_;
32 33
33 // Bridge to the C++ class that created this object. 34 // Bridge to the C++ class that created this object.
34 PermissionBubbleCocoa* bridge_; // Weak. 35 PermissionBubbleCocoa* bridge_; // Weak.
36
37 // The omnibox icon the bubble is anchored to. The icon is set as active
38 // when the bubble is opened, and inactive when the bubble is closed.
39 // Usually we would override OmniboxDecorationBubbleController but the page
40 // info icon has a special case where it might cause a race condition.
41 LocationBarDecoration* decoration_;
Robert Sesek 2017/03/15 17:35:09 // Weak.
spqchan 2017/03/15 21:18:47 Done.
35 } 42 }
36 43
37 // Designated initializer. |browser| and |bridge| must both be non-nil. 44 // Designated initializer. |browser| and |bridge| must both be non-nil.
38 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge; 45 - (id)initWithBrowser:(Browser*)browser bridge:(PermissionBubbleCocoa*)bridge;
39 46
40 // Returns the anchor point to use for the given Cocoa |browser|. 47 // Returns the anchor point to use for the given Cocoa |browser|.
41 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser; 48 + (NSPoint)getAnchorPointForBrowser:(Browser*)browser;
42 49
43 // Returns true if |browser| has a visible location bar. 50 // Returns true if |browser| has a visible location bar.
44 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser; 51 + (bool)hasVisibleLocationBarForBrowser:(Browser*)browser;
45 52
46 // Makes the bubble visible. The bubble will be populated with text retrieved 53 // Makes the bubble visible. The bubble will be populated with text retrieved
47 // from |requests|. |delegate| will receive callbacks for user actions. 54 // from |requests|. |delegate| will receive callbacks for user actions.
48 - (void)showWithDelegate:(PermissionPrompt::Delegate*)delegate 55 - (void)showWithDelegate:(PermissionPrompt::Delegate*)delegate
49 forRequests:(const std::vector<PermissionRequest*>&)requests 56 forRequests:(const std::vector<PermissionRequest*>&)requests
50 acceptStates:(const std::vector<bool>&)acceptStates; 57 acceptStates:(const std::vector<bool>&)acceptStates;
51 58
52 // Will reposition the bubble based in case the anchor or parent should change. 59 // Will reposition the bubble based in case the anchor or parent should change.
53 - (void)updateAnchorPosition; 60 - (void)updateAnchorPosition;
54 61
55 // Will calculate the expected anchor point for this bubble. 62 // Will calculate the expected anchor point for this bubble.
56 // Should only be used outside this class for tests. 63 // Should only be used outside this class for tests.
57 - (NSPoint)getExpectedAnchorPoint; 64 - (NSPoint)getExpectedAnchorPoint;
58 65
59 // Returns true if the browser has a visible location bar. 66 // Returns true if the browser has a visible location bar.
60 // Should only be used outside this class for tests. 67 // Should only be used outside this class for tests.
61 - (bool)hasVisibleLocationBar; 68 - (bool)hasVisibleLocationBar;
62 69
63 @end 70 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698