OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/password_manager/password_manager.h" | 11 #include "chrome/browser/password_manager/password_manager.h" |
12 #include "chrome/browser/tab_contents/tab_util.h" | 12 #include "chrome/browser/tab_contents/tab_util.h" |
13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
14 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.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.h" | |
17 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
20 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
21 #include "net/url_request/url_request.h" | 20 #include "net/url_request/url_request.h" |
22 #include "ui/base/gtk/gtk_compat.h" | 21 #include "ui/base/gtk/gtk_compat.h" |
23 #include "ui/base/gtk/gtk_hig_constants.h" | 22 #include "ui/base/gtk/gtk_hig_constants.h" |
24 #include "ui/base/gtk/gtk_signal.h" | 23 #include "ui/base/gtk/gtk_signal.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 | 25 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 SetModel(manager); | 105 SetModel(manager); |
107 | 106 |
108 // Scary thread safety note: This can potentially be called *after* SetAuth | 107 // Scary thread safety note: This can potentially be called *after* SetAuth |
109 // or CancelAuth (say, if the request was cancelled before the UI thread got | 108 // or CancelAuth (say, if the request was cancelled before the UI thread got |
110 // control). However, that's OK since any UI interaction in those functions | 109 // control). However, that's OK since any UI interaction in those functions |
111 // will occur via an InvokeLater on the UI thread, which is guaranteed | 110 // will occur via an InvokeLater on the UI thread, which is guaranteed |
112 // to happen after this is called (since this was InvokeLater'd first). | 111 // to happen after this is called (since this was InvokeLater'd first). |
113 WebContents* requesting_contents = GetWebContentsForLogin(); | 112 WebContents* requesting_contents = GetWebContentsForLogin(); |
114 DCHECK(requesting_contents); | 113 DCHECK(requesting_contents); |
115 | 114 |
116 TabContents* tab_contents = | 115 SetDialog(new ConstrainedWindowGtk(requesting_contents, this)); |
117 TabContents::FromWebContents(requesting_contents); | |
118 SetDialog(new ConstrainedWindowGtk(tab_contents, this)); | |
119 NotifyAuthNeeded(); | 116 NotifyAuthNeeded(); |
120 } | 117 } |
121 | 118 |
122 // Overridden from ConstrainedWindowGtkDelegate: | 119 // Overridden from ConstrainedWindowGtkDelegate: |
123 virtual GtkWidget* GetWidgetRoot() { | 120 virtual GtkWidget* GetWidgetRoot() { |
124 return root_.get(); | 121 return root_.get(); |
125 } | 122 } |
126 | 123 |
127 virtual GtkWidget* GetFocusWidget() { | 124 virtual GtkWidget* GetFocusWidget() { |
128 return username_entry_; | 125 return username_entry_; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // button the default action and mess with the focus. | 181 // button the default action and mess with the focus. |
185 gtk_widget_set_can_default(ok_, TRUE); | 182 gtk_widget_set_can_default(ok_, TRUE); |
186 gtk_widget_grab_default(ok_); | 183 gtk_widget_grab_default(ok_); |
187 } | 184 } |
188 | 185 |
189 // static | 186 // static |
190 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, | 187 LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info, |
191 net::URLRequest* request) { | 188 net::URLRequest* request) { |
192 return new LoginHandlerGtk(auth_info, request); | 189 return new LoginHandlerGtk(auth_info, request); |
193 } | 190 } |
OLD | NEW |