Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "chrome/browser/ui/cocoa/permission_bubble/chooser_bubble_ui_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/permission_bubble/chooser_bubble_ui_cocoa.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
|
tapted
2017/05/03 01:10:53
nit: remove?
varkha
2017/05/03 05:01:20
Done.
| |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "chrome/browser/chooser_controller/chooser_controller.h" | 15 #include "chrome/browser/chooser_controller/chooser_controller.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 18 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 19 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 19 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 20 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 21 #import "chrome/browser/ui/cocoa/device_chooser_content_view_cocoa.h" | 21 #import "chrome/browser/ui/cocoa/device_chooser_content_view_cocoa.h" |
| 22 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 22 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 23 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 23 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 24 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 24 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 25 #include "chrome/browser/ui/permission_bubble/chooser_bubble_delegate.h" | |
| 26 #include "components/bubble/bubble_controller.h" | 25 #include "components/bubble/bubble_controller.h" |
| 27 #include "content/public/browser/native_web_keyboard_event.h" | 26 #include "content/public/browser/native_web_keyboard_event.h" |
| 28 #include "ui/base/cocoa/cocoa_base_utils.h" | 27 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 29 #include "ui/base/cocoa/window_size_constants.h" | 28 #include "ui/base/cocoa/window_size_constants.h" |
| 30 | 29 |
| 31 std::unique_ptr<BubbleUi> ChooserBubbleDelegate::BuildBubbleUi() { | |
| 32 return base::MakeUnique<ChooserBubbleUiCocoa>(browser_, | |
| 33 std::move(chooser_controller_)); | |
| 34 } | |
| 35 | |
| 36 @interface ChooserBubbleUiController | 30 @interface ChooserBubbleUiController |
| 37 : BaseBubbleController<NSTableViewDataSource, NSTableViewDelegate> { | 31 : BaseBubbleController<NSTableViewDataSource, NSTableViewDelegate> { |
| 38 @private | 32 @private |
| 39 // Bridge to the C++ class that created this object. | 33 // Bridge to the C++ class that created this object. |
| 40 ChooserBubbleUiCocoa* bridge_; // Weak. | 34 ChooserBubbleUiCocoa* bridge_; // Weak. |
| 41 bool buttonPressed_; | 35 bool buttonPressed_; |
| 42 | 36 |
| 43 base::scoped_nsobject<DeviceChooserContentViewCocoa> | 37 base::scoped_nsobject<DeviceChooserContentViewCocoa> |
| 44 deviceChooserContentView_; | 38 deviceChooserContentView_; |
| 45 NSTableView* tableView_; // Weak. | 39 NSTableView* tableView_; // Weak. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 } | 318 } |
| 325 | 319 |
| 326 void ChooserBubbleUiCocoa::UpdateAnchorPosition() { | 320 void ChooserBubbleUiCocoa::UpdateAnchorPosition() { |
| 327 if (chooser_bubble_ui_controller_) | 321 if (chooser_bubble_ui_controller_) |
| 328 [chooser_bubble_ui_controller_ updateAnchorPosition]; | 322 [chooser_bubble_ui_controller_ updateAnchorPosition]; |
| 329 } | 323 } |
| 330 | 324 |
| 331 void ChooserBubbleUiCocoa::OnBubbleClosing() { | 325 void ChooserBubbleUiCocoa::OnBubbleClosing() { |
| 332 chooser_bubble_ui_controller_ = nil; | 326 chooser_bubble_ui_controller_ = nil; |
| 333 } | 327 } |
| OLD | NEW |