| 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/web_data_service_factory.h" | 5 #include "chrome/browser/web_data_service_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/incognito_helpers.h" | 12 #include "chrome/browser/profiles/incognito_helpers.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/sql_init_error_message_ids.h" |
| 14 #include "chrome/browser/sync/glue/sync_start_util.h" | 15 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 15 #include "chrome/browser/ui/profile_error_dialog.h" | 16 #include "chrome/browser/ui/profile_error_dialog.h" |
| 16 #include "chrome/grit/chromium_strings.h" | |
| 17 #include "chrome/grit/generated_resources.h" | |
| 18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 19 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 18 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 20 #include "components/search_engines/keyword_web_data_service.h" | 19 #include "components/search_engines/keyword_web_data_service.h" |
| 21 #include "components/signin/core/browser/webdata/token_web_data.h" | 20 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 22 #include "components/webdata_services/web_data_service_wrapper.h" | 21 #include "components/webdata_services/web_data_service_wrapper.h" |
| 23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 24 | 23 |
| 25 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 26 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" | 25 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" |
| 27 #endif | 26 #endif |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 << "Unknown WebDataServiceWrapper::ErrorType: " << error_type; | 50 << "Unknown WebDataServiceWrapper::ErrorType: " << error_type; |
| 52 return PROFILE_ERROR_DB_WEB_DATA; | 51 return PROFILE_ERROR_DB_WEB_DATA; |
| 53 } | 52 } |
| 54 } | 53 } |
| 55 | 54 |
| 56 // Callback to show error dialog on profile load error. | 55 // Callback to show error dialog on profile load error. |
| 57 void ProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, | 56 void ProfileErrorCallback(WebDataServiceWrapper::ErrorType error_type, |
| 58 sql::InitStatus status, | 57 sql::InitStatus status, |
| 59 const std::string& diagnostics) { | 58 const std::string& diagnostics) { |
| 60 ShowProfileErrorDialog(ProfileErrorFromWebDataServiceWrapperError(error_type), | 59 ShowProfileErrorDialog(ProfileErrorFromWebDataServiceWrapperError(error_type), |
| 61 (status == sql::INIT_FAILURE) | 60 SqlInitStatusToMessageId(status), diagnostics); |
| 62 ? IDS_COULDNT_OPEN_PROFILE_ERROR | |
| 63 : IDS_PROFILE_TOO_NEW_ERROR, | |
| 64 diagnostics); | |
| 65 } | 61 } |
| 66 | 62 |
| 67 } // namespace | 63 } // namespace |
| 68 | 64 |
| 69 WebDataServiceFactory::WebDataServiceFactory() | 65 WebDataServiceFactory::WebDataServiceFactory() |
| 70 : BrowserContextKeyedServiceFactory( | 66 : BrowserContextKeyedServiceFactory( |
| 71 "WebDataService", | 67 "WebDataService", |
| 72 BrowserContextDependencyManager::GetInstance()) { | 68 BrowserContextDependencyManager::GetInstance()) { |
| 73 // WebDataServiceFactory has no dependecies. | 69 // WebDataServiceFactory has no dependecies. |
| 74 } | 70 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 profile_path, g_browser_process->GetApplicationLocale(), | 167 profile_path, g_browser_process->GetApplicationLocale(), |
| 172 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), | 168 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 173 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), | 169 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
| 174 sync_start_util::GetFlareForSyncableService(profile_path), | 170 sync_start_util::GetFlareForSyncableService(profile_path), |
| 175 &ProfileErrorCallback); | 171 &ProfileErrorCallback); |
| 176 } | 172 } |
| 177 | 173 |
| 178 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { | 174 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { |
| 179 return true; | 175 return true; |
| 180 } | 176 } |
| OLD | NEW |