Chromium Code Reviews| 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 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/browser.h" | |
|
tapted
2016/05/11 07:06:18
I think all the 7 new headers showing up in the di
Elly Fong-Jones
2016/05/11 19:16:37
Done.
| |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | |
| 10 #include "chrome/browser/ui/browser_window.h" | |
| 8 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 12 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | |
| 13 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | |
| 9 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h " | 14 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h " |
| 10 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" | 15 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| 11 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #import "ui/base/cocoa/cocoa_base_utils.h" | |
| 12 #import "ui/base/cocoa/nsview_additions.h" | 18 #import "ui/base/cocoa/nsview_additions.h" |
| 19 #include "ui/gfx/mac/coordinate_conversion.h" | |
| 13 | 20 |
| 14 PermissionBubbleCocoa::PermissionBubbleCocoa(Browser* browser) | 21 PermissionBubbleCocoa::PermissionBubbleCocoa(Browser* browser) |
| 15 : browser_(browser), delegate_(nullptr), bubbleController_(nil) { | 22 : browser_(browser), delegate_(nullptr), bubbleController_(nil) { |
| 16 DCHECK(browser); | 23 DCHECK(browser); |
| 17 } | 24 } |
| 18 | 25 |
| 19 PermissionBubbleCocoa::~PermissionBubbleCocoa() { | 26 PermissionBubbleCocoa::~PermissionBubbleCocoa() { |
| 20 } | 27 } |
| 21 | 28 |
| 22 // static | |
| 23 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( | |
| 24 Browser* browser) { | |
| 25 return base::WrapUnique(new PermissionBubbleCocoa(browser)); | |
| 26 } | |
| 27 | |
| 28 void PermissionBubbleCocoa::Show( | 29 void PermissionBubbleCocoa::Show( |
| 29 const std::vector<PermissionBubbleRequest*>& requests, | 30 const std::vector<PermissionBubbleRequest*>& requests, |
| 30 const std::vector<bool>& accept_state) { | 31 const std::vector<bool>& accept_state) { |
| 31 if (!bubbleController_) { | 32 if (!bubbleController_) { |
| 32 bubbleController_ = | 33 bubbleController_ = |
| 33 [[PermissionBubbleController alloc] initWithBrowser:browser_ | 34 [[PermissionBubbleController alloc] initWithBrowser:browser_ |
| 34 bridge:this]; | 35 bridge:this]; |
| 35 } | 36 } |
| 36 | 37 |
| 37 [bubbleController_ showWithDelegate:delegate_ | 38 [bubbleController_ showWithDelegate:delegate_ |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 61 [bubbleController_ updateAnchorPosition]; | 62 [bubbleController_ updateAnchorPosition]; |
| 62 } | 63 } |
| 63 | 64 |
| 64 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() { | 65 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() { |
| 65 return [bubbleController_ window]; | 66 return [bubbleController_ window]; |
| 66 } | 67 } |
| 67 | 68 |
| 68 void PermissionBubbleCocoa::OnBubbleClosing() { | 69 void PermissionBubbleCocoa::OnBubbleClosing() { |
| 69 bubbleController_ = nil; | 70 bubbleController_ = nil; |
| 70 } | 71 } |
| OLD | NEW |