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

Side by Side Diff: chrome/browser/importer/in_process_importer_bridge.cc

Issue 579813002: Collect statistics on importing empty usernames and passwords from other browsers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/importer/in_process_importer_bridge.h" 5 #include "chrome/browser/importer/in_process_importer_bridge.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/dump_without_crashing.h"
8 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/importer/external_process_importer_host.h" 12 #include "chrome/browser/importer/external_process_importer_host.h"
12 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 13 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
13 #include "chrome/common/importer/imported_bookmark_entry.h" 14 #include "chrome/common/importer/imported_bookmark_entry.h"
14 #include "chrome/common/importer/imported_favicon_usage.h" 15 #include "chrome/common/importer/imported_favicon_usage.h"
15 #include "chrome/common/importer/importer_autofill_form_data_entry.h" 16 #include "chrome/common/importer/importer_autofill_form_data_entry.h"
16 #include "components/autofill/core/browser/webdata/autofill_entry.h" 17 #include "components/autofill/core/browser/webdata/autofill_entry.h"
17 #include "components/autofill/core/common/password_form.h" 18 #include "components/autofill/core/common/password_form.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return history::SOURCE_FIREFOX_IMPORTED; 56 return history::SOURCE_FIREFOX_IMPORTED;
56 case importer::VISIT_SOURCE_IE_IMPORTED: 57 case importer::VISIT_SOURCE_IE_IMPORTED:
57 return history::SOURCE_IE_IMPORTED; 58 return history::SOURCE_IE_IMPORTED;
58 case importer::VISIT_SOURCE_SAFARI_IMPORTED: 59 case importer::VISIT_SOURCE_SAFARI_IMPORTED:
59 return history::SOURCE_SAFARI_IMPORTED; 60 return history::SOURCE_SAFARI_IMPORTED;
60 } 61 }
61 NOTREACHED(); 62 NOTREACHED();
62 return history::SOURCE_SYNCED; 63 return history::SOURCE_SYNCED;
63 } 64 }
64 65
66 // http://crbug.com/404012. Let's see where the empty fields come from.
67 void CheckForEmptyUsernameAndPassword(const autofill::PasswordForm& form) {
68 if (form.username_value.empty() &&
69 form.password_value.empty() &&
70 !form.blacklisted_by_user) {
71 base::debug::DumpWithoutCrashing();
72 }
73 }
74
65 } // namespace 75 } // namespace
66 76
67 using content::BrowserThread; 77 using content::BrowserThread;
68 78
69 namespace { 79 namespace {
70 80
71 // FirefoxURLParameterFilter is used to remove parameter mentioning Firefox from 81 // FirefoxURLParameterFilter is used to remove parameter mentioning Firefox from
72 // the search URL when importing search engines. 82 // the search URL when importing search engines.
73 class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter { 83 class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter {
74 public: 84 public:
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 std::copy(search_engines.begin(), search_engines.end(), 254 std::copy(search_engines.begin(), search_engines.end(),
245 std::back_inserter(owned_template_urls)); 255 std::back_inserter(owned_template_urls));
246 256
247 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 257 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
248 base::Bind(&ProfileWriter::AddKeywords, writer_, 258 base::Bind(&ProfileWriter::AddKeywords, writer_,
249 base::Passed(&owned_template_urls), true)); 259 base::Passed(&owned_template_urls), true));
250 } 260 }
251 261
252 void InProcessImporterBridge::SetPasswordForm( 262 void InProcessImporterBridge::SetPasswordForm(
253 const autofill::PasswordForm& form) { 263 const autofill::PasswordForm& form) {
264 CheckForEmptyUsernameAndPassword(form);
254 BrowserThread::PostTask( 265 BrowserThread::PostTask(
255 BrowserThread::UI, FROM_HERE, 266 BrowserThread::UI, FROM_HERE,
256 base::Bind(&ProfileWriter::AddPasswordForm, writer_, form)); 267 base::Bind(&ProfileWriter::AddPasswordForm, writer_, form));
257 } 268 }
258 269
259 void InProcessImporterBridge::SetAutofillFormData( 270 void InProcessImporterBridge::SetAutofillFormData(
260 const std::vector<ImporterAutofillFormDataEntry>& entries) { 271 const std::vector<ImporterAutofillFormDataEntry>& entries) {
261 std::vector<autofill::AutofillEntry> autofill_entries; 272 std::vector<autofill::AutofillEntry> autofill_entries;
262 for (size_t i = 0; i < entries.size(); ++i) { 273 for (size_t i = 0; i < entries.size(); ++i) {
263 autofill_entries.push_back(autofill::AutofillEntry( 274 autofill_entries.push_back(autofill::AutofillEntry(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 BrowserThread::PostTask( 308 BrowserThread::PostTask(
298 BrowserThread::UI, FROM_HERE, 309 BrowserThread::UI, FROM_HERE,
299 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); 310 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_));
300 } 311 }
301 312
302 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { 313 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) {
303 return l10n_util::GetStringUTF16(message_id); 314 return l10n_util::GetStringUTF16(message_id);
304 } 315 }
305 316
306 InProcessImporterBridge::~InProcessImporterBridge() {} 317 InProcessImporterBridge::~InProcessImporterBridge() {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698