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

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

Issue 2253953003: Disable AutoImport: experiment and histogram for analysis. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restricted experiment to autoImport from IE Created 4 years, 4 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
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/profile_writer.h" 5 #include "chrome/browser/importer/profile_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/metrics/histogram.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
19 #include "chrome/browser/chrome_notification_types.h" 20 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/favicon/favicon_service_factory.h" 21 #include "chrome/browser/favicon/favicon_service_factory.h"
22 #include "chrome/browser/first_run/first_run.h"
21 #include "chrome/browser/history/history_service_factory.h" 23 #include "chrome/browser/history/history_service_factory.h"
22 #include "chrome/browser/password_manager/password_store_factory.h" 24 #include "chrome/browser/password_manager/password_store_factory.h"
23 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/search_engines/template_url_service_factory.h" 26 #include "chrome/browser/search_engines/template_url_service_factory.h"
25 #include "chrome/browser/web_data_service_factory.h" 27 #include "chrome/browser/web_data_service_factory.h"
26 #include "chrome/common/importer/imported_bookmark_entry.h" 28 #include "chrome/common/importer/imported_bookmark_entry.h"
27 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
28 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 30 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
29 #include "components/bookmarks/browser/bookmark_model.h" 31 #include "components/bookmarks/browser/bookmark_model.h"
30 #include "components/bookmarks/common/bookmark_pref_names.h" 32 #include "components/bookmarks/common/bookmark_pref_names.h"
31 #include "components/favicon/core/favicon_service.h" 33 #include "components/favicon/core/favicon_service.h"
32 #include "components/history/core/browser/history_service.h" 34 #include "components/history/core/browser/history_service.h"
33 #include "components/password_manager/core/browser/password_store.h" 35 #include "components/password_manager/core/browser/password_store.h"
34 #include "components/prefs/pref_service.h" 36 #include "components/prefs/pref_service.h"
35 #include "components/search_engines/template_url.h" 37 #include "components/search_engines/template_url.h"
36 #include "components/search_engines/template_url_service.h" 38 #include "components/search_engines/template_url_service.h"
37 39
38 #if defined(OS_WIN) 40 #if defined(OS_WIN)
39 #include "chrome/browser/web_data_service_factory.h"
40 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h" 41 #include "components/password_manager/core/browser/webdata/password_web_data_ser vice_win.h"
41 #endif 42 #endif
42 43
43 using bookmarks::BookmarkModel; 44 using bookmarks::BookmarkModel;
44 using bookmarks::BookmarkNode; 45 using bookmarks::BookmarkNode;
45 46
46 namespace { 47 namespace {
47 48
48 // Generates a unique folder name. If |folder_name| is not unique, then this 49 // Generates a unique folder name. If |folder_name| is not unique, then this
49 // repeatedly tests for '|folder_name| + (i)' until a unique name is found. 50 // repeatedly tests for '|folder_name| + (i)' until a unique name is found.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 WebDataServiceFactory::GetPasswordWebDataForProfile( 102 WebDataServiceFactory::GetPasswordWebDataForProfile(
102 profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddIE7Login(info); 103 profile_, ServiceAccessType::EXPLICIT_ACCESS)->AddIE7Login(info);
103 } 104 }
104 #endif 105 #endif
105 106
106 void ProfileWriter::AddHistoryPage(const history::URLRows& page, 107 void ProfileWriter::AddHistoryPage(const history::URLRows& page,
107 history::VisitSource visit_source) { 108 history::VisitSource visit_source) {
108 HistoryServiceFactory::GetForProfile(profile_, 109 HistoryServiceFactory::GetForProfile(profile_,
109 ServiceAccessType::EXPLICIT_ACCESS) 110 ServiceAccessType::EXPLICIT_ACCESS)
110 ->AddPagesWithDetails(page, visit_source); 111 ->AddPagesWithDetails(page, visit_source);
112 // Measure the size of the history page after AutoImport from IE
113 // on first run.
114 if (first_run::IsChromeFirstRun() &&
115 visit_source == history::SOURCE_IE_IMPORTED) {
116 UMA_HISTOGRAM_COUNTS("Import.SizeImportedHistory.AutoImportIE",
117 page.size());
118 }
111 } 119 }
112 120
113 void ProfileWriter::AddHomepage(const GURL& home_page) { 121 void ProfileWriter::AddHomepage(const GURL& home_page) {
114 DCHECK(profile_); 122 DCHECK(profile_);
115 123
116 PrefService* prefs = profile_->GetPrefs(); 124 PrefService* prefs = profile_->GetPrefs();
117 // NOTE: We set the kHomePage value, but keep the NewTab page as the homepage. 125 // NOTE: We set the kHomePage value, but keep the NewTab page as the homepage.
118 const PrefService::Preference* pref = prefs->FindPreference(prefs::kHomePage); 126 const PrefService::Preference* pref = prefs->FindPreference(prefs::kHomePage);
119 if (pref && !pref->IsManaged()) { 127 if (pref && !pref->IsManaged()) {
120 prefs->SetString(prefs::kHomePage, home_page.spec()); 128 prefs->SetString(prefs::kHomePage, home_page.spec());
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 void ProfileWriter::AddAutofillFormDataEntries( 350 void ProfileWriter::AddAutofillFormDataEntries(
343 const std::vector<autofill::AutofillEntry>& autofill_entries) { 351 const std::vector<autofill::AutofillEntry>& autofill_entries) {
344 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 352 scoped_refptr<autofill::AutofillWebDataService> web_data_service =
345 WebDataServiceFactory::GetAutofillWebDataForProfile( 353 WebDataServiceFactory::GetAutofillWebDataForProfile(
346 profile_, ServiceAccessType::EXPLICIT_ACCESS); 354 profile_, ServiceAccessType::EXPLICIT_ACCESS);
347 if (web_data_service.get()) 355 if (web_data_service.get())
348 web_data_service->UpdateAutofillEntries(autofill_entries); 356 web_data_service->UpdateAutofillEntries(autofill_entries);
349 } 357 }
350 358
351 ProfileWriter::~ProfileWriter() {} 359 ProfileWriter::~ProfileWriter() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698