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" | |
| 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" | |
| 14 #include "chrome/browser/ui/cocoa/website_settings/permission_bubble_anchor_dele gate_views_cocoa.h" | |
| 9 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h " | 15 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h " |
| 10 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" | 16 #import "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| 11 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #import "ui/base/cocoa/cocoa_base_utils.h" | |
| 12 #import "ui/base/cocoa/nsview_additions.h" | 19 #import "ui/base/cocoa/nsview_additions.h" |
| 20 #include "ui/gfx/mac/coordinate_conversion.h" | |
| 13 | 21 |
| 14 PermissionBubbleCocoa::PermissionBubbleCocoa(Browser* browser) | 22 PermissionBubbleCocoa::PermissionBubbleCocoa(Browser* browser) |
| 15 : browser_(browser), delegate_(nullptr), bubbleController_(nil) { | 23 : browser_(browser), delegate_(nullptr), bubbleController_(nil) { |
| 16 DCHECK(browser); | 24 DCHECK(browser); |
| 17 } | 25 } |
| 18 | 26 |
| 19 PermissionBubbleCocoa::~PermissionBubbleCocoa() { | 27 PermissionBubbleCocoa::~PermissionBubbleCocoa() { |
| 20 } | 28 } |
| 21 | 29 |
| 22 // static | 30 // static |
| 23 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( | 31 std::unique_ptr<PermissionBubbleView> PermissionBubbleView::Create( |
| 24 Browser* browser) { | 32 Browser* browser) { |
| 33 if (chrome::ToolkitViewsWebUIDialogsEnabled()) { | |
| 34 std::unique_ptr<PermissionBubbleViewViews::AnchorDelegate> delegate( | |
| 35 new PermissionBubbleAnchorDelegateViewsCocoa(browser)); | |
| 36 return base::WrapUnique( | |
| 37 new PermissionBubbleViewViews(browser, std::move(delegate))); | |
|
tapted
2016/05/03 12:02:38
so... for IWYU, permission_bubble_cocoa.mm really
Elly Fong-Jones
2016/05/10 21:21:02
Done.
| |
| 38 } | |
| 25 return base::WrapUnique(new PermissionBubbleCocoa(browser)); | 39 return base::WrapUnique(new PermissionBubbleCocoa(browser)); |
| 26 } | 40 } |
| 27 | 41 |
| 28 void PermissionBubbleCocoa::Show( | 42 void PermissionBubbleCocoa::Show( |
| 29 const std::vector<PermissionBubbleRequest*>& requests, | 43 const std::vector<PermissionBubbleRequest*>& requests, |
| 30 const std::vector<bool>& accept_state) { | 44 const std::vector<bool>& accept_state) { |
| 31 if (!bubbleController_) { | 45 if (!bubbleController_) { |
| 32 bubbleController_ = | 46 bubbleController_ = |
| 33 [[PermissionBubbleController alloc] initWithBrowser:browser_ | 47 [[PermissionBubbleController alloc] initWithBrowser:browser_ |
| 34 bridge:this]; | 48 bridge:this]; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 61 [bubbleController_ updateAnchorPosition]; | 75 [bubbleController_ updateAnchorPosition]; |
| 62 } | 76 } |
| 63 | 77 |
| 64 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() { | 78 gfx::NativeWindow PermissionBubbleCocoa::GetNativeWindow() { |
| 65 return [bubbleController_ window]; | 79 return [bubbleController_ window]; |
| 66 } | 80 } |
| 67 | 81 |
| 68 void PermissionBubbleCocoa::OnBubbleClosing() { | 82 void PermissionBubbleCocoa::OnBubbleClosing() { |
| 69 bubbleController_ = nil; | 83 bubbleController_ = nil; |
| 70 } | 84 } |
| OLD | NEW |