| 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 | 13 |
| 14 PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window) | 14 PermissionBubbleCocoa::PermissionBubbleCocoa(NSWindow* parent_window) |
| 15 : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {} | 15 : parent_window_(parent_window), delegate_(NULL), bubbleController_(nil) {} |
| 16 | 16 |
| 17 PermissionBubbleCocoa::~PermissionBubbleCocoa() { | 17 PermissionBubbleCocoa::~PermissionBubbleCocoa() { |
| 18 if (delegate_) | 18 if (delegate_) |
| 19 delegate_->SetView(NULL); | 19 delegate_->SetView(NULL); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void PermissionBubbleCocoa::Show( | 22 void PermissionBubbleCocoa::Show( |
| 23 const std::vector<PermissionBubbleRequest*>& requests, | 23 const std::vector<PermissionBubbleRequest*>& requests, |
| 24 const std::vector<bool>& accept_state, | 24 const std::vector<bool>& accept_state) { |
| 25 bool customization_mode) { | |
| 26 DCHECK(parent_window_); | 25 DCHECK(parent_window_); |
| 27 | 26 |
| 28 if (!bubbleController_) { | 27 if (!bubbleController_) { |
| 29 bubbleController_ = [[PermissionBubbleController alloc] | 28 bubbleController_ = [[PermissionBubbleController alloc] |
| 30 initWithParentWindow:parent_window_ | 29 initWithParentWindow:parent_window_ |
| 31 bridge:this]; | 30 bridge:this]; |
| 32 } | 31 } |
| 33 | 32 |
| 34 [bubbleController_ showAtAnchor:GetAnchorPoint() | 33 [bubbleController_ showAtAnchor:GetAnchorPoint() |
| 35 withDelegate:delegate_ | 34 withDelegate:delegate_ |
| 36 forRequests:requests | 35 forRequests:requests |
| 37 acceptStates:accept_state | 36 acceptStates:accept_state]; |
| 38 customizationMode:customization_mode]; | |
| 39 } | 37 } |
| 40 | 38 |
| 41 void PermissionBubbleCocoa::Hide() { | 39 void PermissionBubbleCocoa::Hide() { |
| 42 [bubbleController_ close]; | 40 [bubbleController_ close]; |
| 43 } | 41 } |
| 44 | 42 |
| 45 bool PermissionBubbleCocoa::IsVisible() { | 43 bool PermissionBubbleCocoa::IsVisible() { |
| 46 return bubbleController_ != nil; | 44 return bubbleController_ != nil; |
| 47 } | 45 } |
| 48 | 46 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 NSPoint PermissionBubbleCocoa::GetAnchorPoint() { | 65 NSPoint PermissionBubbleCocoa::GetAnchorPoint() { |
| 68 LocationBarViewMac* location_bar = | 66 LocationBarViewMac* location_bar = |
| 69 [[parent_window_ windowController] locationBarBridge]; | 67 [[parent_window_ windowController] locationBarBridge]; |
| 70 NSPoint anchor = location_bar->GetPageInfoBubblePoint(); | 68 NSPoint anchor = location_bar->GetPageInfoBubblePoint(); |
| 71 return [parent_window_ convertBaseToScreen:anchor]; | 69 return [parent_window_ convertBaseToScreen:anchor]; |
| 72 } | 70 } |
| 73 | 71 |
| 74 NSWindow* PermissionBubbleCocoa::window() { | 72 NSWindow* PermissionBubbleCocoa::window() { |
| 75 return [bubbleController_ window]; | 73 return [bubbleController_ window]; |
| 76 } | 74 } |
| OLD | NEW |