| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 7 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 8 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 9 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 10 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" | 10 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" |
| 11 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" | 11 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #import "ui/base/cocoa/nsview_additions.h" |
| 13 | 14 |
| 14 PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window) | 15 PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window) |
| 15 : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {} | 16 : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {} |
| 16 | 17 |
| 17 PermissionBubbleCocoa::~PermissionBubbleCocoa() { | 18 PermissionBubbleCocoa::~PermissionBubbleCocoa() { |
| 18 if (delegate_) | 19 if (delegate_) |
| 19 delegate_->SetView(NULL); | 20 delegate_->SetView(NULL); |
| 20 } | 21 } |
| 21 | 22 |
| 22 void PermissionBubbleCocoa::Show( | 23 void PermissionBubbleCocoa::Show( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 void PermissionBubbleCocoa::SetDelegate(Delegate* delegate) { | 50 void PermissionBubbleCocoa::SetDelegate(Delegate* delegate) { |
| 50 if (delegate_ == delegate) | 51 if (delegate_ == delegate) |
| 51 return; | 52 return; |
| 52 if (delegate_ && delegate) | 53 if (delegate_ && delegate) |
| 53 delegate_->SetView(NULL); | 54 delegate_->SetView(NULL); |
| 54 delegate_ = delegate; | 55 delegate_ = delegate; |
| 55 } | 56 } |
| 56 | 57 |
| 57 bool PermissionBubbleCocoa::CanAcceptRequestUpdate() { | 58 bool PermissionBubbleCocoa::CanAcceptRequestUpdate() { |
| 58 // TODO(gbillock): implement. Should return true if the mouse is not over the | 59 return ![[[bubbleController_ window] contentView] cr_isMouseInView]; |
| 59 // dialog. | |
| 60 return false; | |
| 61 } | 60 } |
| 62 | 61 |
| 63 void PermissionBubbleCocoa::OnBubbleClosing() { | 62 void PermissionBubbleCocoa::OnBubbleClosing() { |
| 64 bubbleController_ = nil; | 63 bubbleController_ = nil; |
| 65 } | 64 } |
| 66 | 65 |
| 67 NSPoint PermissionBubbleCocoa::GetAnchorPoint() { | 66 NSPoint PermissionBubbleCocoa::GetAnchorPoint() { |
| 68 LocationBarViewMac* location_bar = | 67 LocationBarViewMac* location_bar = |
| 69 [[parent_window_ windowController] locationBarBridge]; | 68 [[parent_window_ windowController] locationBarBridge]; |
| 70 NSPoint anchor = location_bar->GetPageInfoBubblePoint(); | 69 NSPoint anchor = location_bar->GetPageInfoBubblePoint(); |
| 71 return [parent_window_ convertBaseToScreen:anchor]; | 70 return [parent_window_ convertBaseToScreen:anchor]; |
| 72 } | 71 } |
| 73 | 72 |
| 74 NSWindow* PermissionBubbleCocoa::window() { | 73 NSWindow* PermissionBubbleCocoa::window() { |
| 75 return [bubbleController_ window]; | 74 return [bubbleController_ window]; |
| 76 } | 75 } |
| OLD | NEW |