OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/passwords/password_prompt_view_bridge.h" | 5 #include "chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" | 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" |
10 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" | 10 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h" |
11 #include "chrome/browser/ui/passwords/password_dialog_controller.h" | 11 #include "chrome/browser/ui/passwords/password_dialog_controller.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 | 13 |
14 PasswordPromptViewBridge::PasswordPromptViewBridge( | 14 PasswordPromptViewBridge::PasswordPromptViewBridge( |
15 PasswordDialogController* controller, | 15 PasswordDialogController* controller, |
16 content::WebContents* web_contents) | 16 content::WebContents* web_contents) |
17 : controller_(controller), | 17 : controller_(controller), |
18 web_contents_(web_contents) { | 18 web_contents_(web_contents) { |
19 } | 19 } |
20 | 20 |
21 PasswordPromptViewBridge::~PasswordPromptViewBridge() = default; | 21 PasswordPromptViewBridge::~PasswordPromptViewBridge() { |
| 22 [view_controller_ setBridge:nil]; |
| 23 } |
22 | 24 |
23 void PasswordPromptViewBridge::Show() { | 25 void PasswordPromptViewBridge::Show() { |
24 view_controller_.reset( | 26 view_controller_.reset( |
25 [[AccountChooserViewController alloc] initWithBridge:this]); | 27 [[AccountChooserViewController alloc] initWithBridge:this]); |
26 // Setup the constrained window that will show the view. | 28 // Setup the constrained window that will show the view. |
27 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] | 29 base::scoped_nsobject<NSWindow> window([[ConstrainedWindowCustomWindow alloc] |
28 initWithContentRect:[[view_controller_ view] bounds]]); | 30 initWithContentRect:[[view_controller_ view] bounds]]); |
29 [window setContentView:[view_controller_ view]]; | 31 [window setContentView:[view_controller_ view]]; |
30 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 32 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
31 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); | 33 [[CustomConstrainedWindowSheet alloc] initWithCustomWindow:window]); |
(...skipping 25 matching lines...) Expand all Loading... |
57 net::URLRequestContextGetter* | 59 net::URLRequestContextGetter* |
58 PasswordPromptViewBridge::GetRequestContext() const { | 60 PasswordPromptViewBridge::GetRequestContext() const { |
59 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> | 61 return Profile::FromBrowserContext(web_contents_->GetBrowserContext())-> |
60 GetRequestContext(); | 62 GetRequestContext(); |
61 } | 63 } |
62 | 64 |
63 AccountChooserPrompt* CreateAccountChooserPromptView( | 65 AccountChooserPrompt* CreateAccountChooserPromptView( |
64 PasswordDialogController* controller, content::WebContents* web_contents) { | 66 PasswordDialogController* controller, content::WebContents* web_contents) { |
65 return new PasswordPromptViewBridge(controller, web_contents); | 67 return new PasswordPromptViewBridge(controller, web_contents); |
66 } | 68 } |
OLD | NEW |