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

Unified Diff: chrome/browser/ui/cocoa/permission_bubble_cocoa.mm

Issue 151593005: Implement permission bubble view for Cocoa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more feedback addressed Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/permission_bubble_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/permission_bubble_cocoa.mm b/chrome/browser/ui/cocoa/permission_bubble_cocoa.mm
new file mode 100644
index 0000000000000000000000000000000000000000..3725c295867482f190b941f72bc356766bf17f2e
--- /dev/null
+++ b/chrome/browser/ui/cocoa/permission_bubble_cocoa.mm
@@ -0,0 +1,52 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/cocoa/permission_bubble_cocoa.h"
+
+#import "chrome/browser/ui/cocoa/base_bubble_controller.h"
+#import "chrome/browser/ui/cocoa/browser_window_controller.h"
+#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
+#import "chrome/browser/ui/cocoa/permission_bubble_controller.h"
+#import "chrome/browser/ui/website_settings/permission_bubble_view.h"
+#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
+
+PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window)
+ : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {}
+
+PermissionBubbleCocoa::~PermissionBubbleCocoa() {}
+
+void PermissionBubbleCocoa::Show(
+ const std::vector<PermissionBubbleDelegate*>& delegates,
+ const std::vector<bool>& accept_state,
+ bool customization_mode) {
+ DCHECK(parent_window_);
+ LocationBarViewMac* location_bar =
+ [[parent_window_ windowController] locationBarBridge];
groby-ooo-7-16 2014/02/04 02:39:30 I'm surprised - does this not warn at compile time
leng 2014/02/04 21:48:22 Nope. <shrug>?
+
+ if (!bubbleController_) {
+ bubbleController_ = [[PermissionBubbleController alloc]
+ initWithParentWindow:parent_window_
+ bridge:this];
+ }
+
+ NSPoint anchor = location_bar->GetPageInfoBubblePoint();
+ [bubbleController_ showAtAnchor:[parent_window_ convertBaseToScreen:anchor]
+ withDelegate:delegate_
+ forRequests:delegates
+ acceptStates:accept_state
+ customizationMode:customization_mode];
+}
+
+void PermissionBubbleCocoa::Hide() {
+ [bubbleController_ close];
+}
+
+void PermissionBubbleCocoa::SetDelegate(Delegate* delegate) {
+ delegate_ = delegate;
+}
+
+void PermissionBubbleCocoa::OnBubbleClosing() {
+ bubbleController_ = nil;
+}

Powered by Google App Engine
This is Rietveld 408576698