Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / website_settings / permission_bubble_cocoa.mm
index 1d67b3c..4370ec2 100644 (file)
@@ -31,10 +31,7 @@ void PermissionBubbleCocoa::Show(
                       bridge:this];
   }
 
-  LocationBarViewMac* location_bar =
-      [[parent_window_ windowController] locationBarBridge];
-  NSPoint anchor = location_bar->GetPageInfoBubblePoint();
-  [bubbleController_ showAtAnchor:[parent_window_ convertBaseToScreen:anchor]
+  [bubbleController_ showAtAnchor:GetAnchorPoint()
                      withDelegate:delegate_
                       forRequests:requests
                      acceptStates:accept_state
@@ -45,6 +42,10 @@ void PermissionBubbleCocoa::Hide() {
   [bubbleController_ close];
 }
 
+bool PermissionBubbleCocoa::IsVisible() {
+  return bubbleController_ != nil;
+}
+
 void PermissionBubbleCocoa::SetDelegate(Delegate* delegate) {
   if (delegate_ == delegate)
     return;
@@ -62,3 +63,14 @@ bool PermissionBubbleCocoa::CanAcceptRequestUpdate() {
 void PermissionBubbleCocoa::OnBubbleClosing() {
   bubbleController_ = nil;
 }
+
+NSPoint PermissionBubbleCocoa::GetAnchorPoint() {
+  LocationBarViewMac* location_bar =
+      [[parent_window_ windowController] locationBarBridge];
+  NSPoint anchor = location_bar->GetPageInfoBubblePoint();
+  return [parent_window_ convertBaseToScreen:anchor];
+}
+
+NSWindow* PermissionBubbleCocoa::window() {
+  return [bubbleController_ window];
+}