Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/ui/login/login_prompt.cc

Issue 231283003: Password manager: introduce logging for the internals page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 14 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
15 #include "chrome/browser/prerender/prerender_contents.h" 15 #include "chrome/browser/prerender/prerender_contents.h"
16 #include "chrome/browser/tab_contents/tab_util.h" 16 #include "chrome/browser/tab_contents/tab_util.h"
17 #include "components/password_manager/core/browser/browser_save_password_progres s_logger.h"
17 #include "components/password_manager/core/browser/password_manager.h" 18 #include "components/password_manager/core/browser/password_manager.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/render_frame_host.h" 22 #include "content/public/browser/render_frame_host.h"
22 #include "content/public/browser/resource_dispatcher_host.h" 23 #include "content/public/browser/resource_dispatcher_host.h"
23 #include "content/public/browser/resource_request_info.h" 24 #include "content/public/browser/resource_request_info.h"
24 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "net/base/auth.h" 27 #include "net/base/auth.h"
27 #include "net/base/net_util.h" 28 #include "net/base/net_util.h"
28 #include "net/http/http_transaction_factory.h" 29 #include "net/http/http_transaction_factory.h"
29 #include "net/url_request/url_request.h" 30 #include "net/url_request/url_request.h"
30 #include "net/url_request/url_request_context.h" 31 #include "net/url_request/url_request_context.h"
31 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
32 #include "ui/gfx/text_elider.h" 33 #include "ui/gfx/text_elider.h"
33 34
34 using autofill::PasswordForm; 35 using autofill::PasswordForm;
36 using autofill::SavePasswordProgressLogger;
35 using content::BrowserThread; 37 using content::BrowserThread;
36 using content::NavigationController; 38 using content::NavigationController;
37 using content::RenderViewHost; 39 using content::RenderViewHost;
38 using content::RenderViewHostDelegate; 40 using content::RenderViewHostDelegate;
39 using content::ResourceDispatcherHost; 41 using content::ResourceDispatcherHost;
40 using content::ResourceRequestInfo; 42 using content::ResourceRequestInfo;
41 using content::WebContents; 43 using content::WebContents;
42 44
43 class LoginHandlerImpl; 45 class LoginHandlerImpl;
44 46
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 130
129 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID( 131 content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(
130 render_process_host_id_, render_frame_id_); 132 render_process_host_id_, render_frame_id_);
131 return WebContents::FromRenderFrameHost(rfh); 133 return WebContents::FromRenderFrameHost(rfh);
132 } 134 }
133 135
134 void LoginHandler::SetAuth(const base::string16& username, 136 void LoginHandler::SetAuth(const base::string16& username,
135 const base::string16& password) { 137 const base::string16& password) {
136 DCHECK_CURRENTLY_ON(BrowserThread::UI); 138 DCHECK_CURRENTLY_ON(BrowserThread::UI);
137 139
138 if (TestAndSetAuthHandled()) 140 scoped_ptr<password_manager::BrowserSavePasswordProgressLogger> logger;
141 if (password_manager_ && password_manager_->client()->IsLoggingActive()) {
142 logger.reset(new password_manager::BrowserSavePasswordProgressLogger(
143 password_manager_->client()));
144 logger->LogMessage(SavePasswordProgressLogger::STRING_SET_AUTH_METHOD);
145 }
146
147 bool already_handled = TestAndSetAuthHandled();
148 if (logger) {
149 logger->LogBoolean(
150 SavePasswordProgressLogger::STRING_AUTHENTICATION_HANDLED,
151 already_handled);
152 }
153 if (already_handled)
139 return; 154 return;
140 155
141 // Tell the password manager the credentials were submitted / accepted. 156 // Tell the password manager the credentials were submitted / accepted.
142 if (password_manager_) { 157 if (password_manager_) {
143 password_form_.username_value = username; 158 password_form_.username_value = username;
144 password_form_.password_value = password; 159 password_form_.password_value = password;
145 password_manager_->ProvisionallySavePassword(password_form_); 160 password_manager_->ProvisionallySavePassword(password_form_);
161 if (logger) {
162 logger->LogPasswordForm(
163 SavePasswordProgressLogger::STRING_LOGINHANDLER_FORM, password_form_);
164 }
146 } 165 }
147 166
148 // Calling NotifyAuthSupplied() directly instead of posting a task 167 // Calling NotifyAuthSupplied() directly instead of posting a task
149 // allows other LoginHandler instances to queue their 168 // allows other LoginHandler instances to queue their
150 // CloseContentsDeferred() before ours. Closing dialogs in the 169 // CloseContentsDeferred() before ours. Closing dialogs in the
151 // opposite order as they were created avoids races where remaining 170 // opposite order as they were created avoids races where remaining
152 // dialogs in the same tab may be briefly displayed to the user 171 // dialogs in the same tab may be briefly displayed to the user
153 // before they are removed. 172 // before they are removed.
154 NotifyAuthSupplied(username, password); 173 NotifyAuthSupplied(username, password);
155 174
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 489
471 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info, 490 LoginHandler* CreateLoginPrompt(net::AuthChallengeInfo* auth_info,
472 net::URLRequest* request) { 491 net::URLRequest* request) {
473 LoginHandler* handler = LoginHandler::Create(auth_info, request); 492 LoginHandler* handler = LoginHandler::Create(auth_info, request);
474 BrowserThread::PostTask( 493 BrowserThread::PostTask(
475 BrowserThread::UI, FROM_HERE, 494 BrowserThread::UI, FROM_HERE,
476 base::Bind(&LoginDialogCallback, request->url(), 495 base::Bind(&LoginDialogCallback, request->url(),
477 make_scoped_refptr(auth_info), make_scoped_refptr(handler))); 496 make_scoped_refptr(auth_info), make_scoped_refptr(handler)));
478 return handler; 497 return handler;
479 } 498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698