OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/login/login_prompt.h" | 5 #include "chrome/browser/ui/login/login_prompt.h" |
6 #import "chrome/browser/ui/login/login_prompt_mac.h" | 6 #import "chrome/browser/ui/login/login_prompt_mac.h" |
7 | 7 |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/password_manager/password_manager.h" | 12 #include "chrome/browser/password_manager/password_manager.h" |
13 #include "chrome/browser/tab_contents/tab_util.h" | 13 #include "chrome/browser/tab_contents/tab_util.h" |
14 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" | 14 #include "chrome/browser/ui/cocoa/constrained_window_mac.h" |
15 #include "chrome/browser/ui/login/login_model.h" | 15 #include "chrome/browser/ui/login/login_model.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
16 #include "content/browser/browser_thread.h" | 17 #include "content/browser/browser_thread.h" |
17 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 18 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
18 #include "content/browser/tab_contents/navigation_controller.h" | 19 #include "content/browser/tab_contents/navigation_controller.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
22 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 23 #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 | 25 |
25 using webkit_glue::PasswordForm; | 26 using webkit_glue::PasswordForm; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 SetModel(manager); | 66 SetModel(manager); |
66 | 67 |
67 [sheet_controller_ setExplanation:base::SysUTF16ToNSString(explanation)]; | 68 [sheet_controller_ setExplanation:base::SysUTF16ToNSString(explanation)]; |
68 | 69 |
69 // Scary thread safety note: This can potentially be called *after* SetAuth | 70 // Scary thread safety note: This can potentially be called *after* SetAuth |
70 // or CancelAuth (say, if the request was cancelled before the UI thread got | 71 // or CancelAuth (say, if the request was cancelled before the UI thread got |
71 // control). However, that's OK since any UI interaction in those functions | 72 // control). However, that's OK since any UI interaction in those functions |
72 // will occur via an InvokeLater on the UI thread, which is guaranteed | 73 // will occur via an InvokeLater on the UI thread, which is guaranteed |
73 // to happen after this is called (since this was InvokeLater'd first). | 74 // to happen after this is called (since this was InvokeLater'd first). |
74 SetDialog(new ConstrainedWindowMac(GetTabContentsForLogin(), this)); | 75 TabContents* requesting_contents = GetTabContentsForLogin(); |
| 76 DCHECK(requesting_contents); |
| 77 |
| 78 TabContentsWrapper* wrapper = |
| 79 TabContentsWrapper::GetCurrentWrapperForContents(requesting_contents); |
| 80 SetDialog(new ConstrainedWindowMac(wrapper, this)); |
75 | 81 |
76 NotifyAuthNeeded(); | 82 NotifyAuthNeeded(); |
77 } | 83 } |
78 | 84 |
79 // Overridden from ConstrainedWindowMacDelegate: | 85 // Overridden from ConstrainedWindowMacDelegate: |
80 virtual void DeleteDelegate() { | 86 virtual void DeleteDelegate() { |
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 87 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
82 | 88 |
83 // The constrained window is going to delete itself; clear our pointer. | 89 // The constrained window is going to delete itself; clear our pointer. |
84 SetDialog(NULL); | 90 SetDialog(NULL); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 sizeToFitFixedWidthTextField:explanationField_]; | 188 sizeToFitFixedWidthTextField:explanationField_]; |
183 | 189 |
184 // Resize the window (no shifting needed due to window layout). | 190 // Resize the window (no shifting needed due to window layout). |
185 NSSize windowDelta = NSMakeSize(0, explanationShift); | 191 NSSize windowDelta = NSMakeSize(0, explanationShift); |
186 [GTMUILocalizerAndLayoutTweaker | 192 [GTMUILocalizerAndLayoutTweaker |
187 resizeWindowWithoutAutoResizingSubViews:[self window] | 193 resizeWindowWithoutAutoResizingSubViews:[self window] |
188 delta:windowDelta]; | 194 delta:windowDelta]; |
189 } | 195 } |
190 | 196 |
191 @end | 197 @end |
OLD | NEW |