Index: chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fdf2a643dadb8a0c06213b05ebc80102a6f30fec |
--- /dev/null |
+++ b/chrome/browser/ui/cocoa/website_settings/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/website_settings/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/website_settings/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 = |
groby-ooo-7-16
2014/02/11 20:10:06
nit: Move down in front of NSPoint - declare close
leng
2014/02/11 22:45:48
Done.
|
+ [[parent_window_ windowController] locationBarBridge]; |
+ |
+ 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; |
+} |