OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/tab_dialogs_views_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_dialogs_views_mac.h" |
6 | 6 |
| 7 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 8 #import "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h" |
7 #include "chrome/browser/ui/views/collected_cookies_views.h" | 9 #include "chrome/browser/ui/views/collected_cookies_views.h" |
| 10 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
8 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.
h" | 11 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.
h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/material_design/material_design_controller.h" |
9 | 14 |
10 TabDialogsViewsMac::TabDialogsViewsMac(content::WebContents* contents) | 15 TabDialogsViewsMac::TabDialogsViewsMac(content::WebContents* contents) |
11 : TabDialogsCocoa(contents) {} | 16 : TabDialogsCocoa(contents) {} |
12 | 17 |
13 TabDialogsViewsMac::~TabDialogsViewsMac() {} | 18 TabDialogsViewsMac::~TabDialogsViewsMac() {} |
14 | 19 |
15 void TabDialogsViewsMac::ShowCollectedCookies() { | 20 void TabDialogsViewsMac::ShowCollectedCookies() { |
16 // Deletes itself on close. | 21 // Deletes itself on close. |
17 new CollectedCookiesViews(web_contents()); | 22 new CollectedCookiesViews(web_contents()); |
18 } | 23 } |
19 | 24 |
20 void TabDialogsViewsMac::ShowProfileSigninConfirmation( | 25 void TabDialogsViewsMac::ShowProfileSigninConfirmation( |
21 Browser* browser, | 26 Browser* browser, |
22 Profile* profile, | 27 Profile* profile, |
23 const std::string& username, | 28 const std::string& username, |
24 std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) { | 29 std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) { |
25 ProfileSigninConfirmationDialogViews::ShowDialog(browser, profile, username, | 30 ProfileSigninConfirmationDialogViews::ShowDialog(browser, profile, username, |
26 std::move(delegate)); | 31 std::move(delegate)); |
27 } | 32 } |
| 33 |
| 34 void TabDialogsViewsMac::ShowManagePasswordsBubble(bool user_action) { |
| 35 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 36 TabDialogsCocoa::ShowManagePasswordsBubble(user_action); |
| 37 return; |
| 38 } |
| 39 NSWindow* window = [web_contents()->GetNativeView() window]; |
| 40 if (!window) { |
| 41 // The tab isn't active right now. |
| 42 return; |
| 43 } |
| 44 BrowserWindowController* bwc = |
| 45 [BrowserWindowController browserWindowControllerForWindow:window]; |
| 46 NSPoint anchor_point = [bwc bookmarkBubblePoint]; |
| 47 ShowViewsManagePasswordsBubbleOnCocoaBrowser(anchor_point, web_contents(), |
| 48 user_action); |
| 49 } |
| 50 |
| 51 void TabDialogsViewsMac::HideManagePasswordsBubble() { |
| 52 // Close toolkit-views bubble. |
| 53 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 54 TabDialogsCocoa::HideManagePasswordsBubble(); |
| 55 return; |
| 56 } |
| 57 ManagePasswordsBubbleView::CloseCurrentBubble(); |
| 58 } |
OLD | NEW |