| OLD | NEW | 
|    1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2010 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/importer_list.h" |    5 #include "chrome/browser/importer/importer_list.h" | 
|    6  |    6  | 
|    7 #include "app/l10n_util.h" |    7 #include "app/l10n_util.h" | 
|    8 #include "base/file_util.h" |    8 #include "base/file_util.h" | 
|    9 #include "base/stl_util-inl.h" |    9 #include "base/stl_util-inl.h" | 
|   10 #include "base/values.h" |   10 #include "base/values.h" | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   91   firefox->app_path = FilePath::FromWStringHack( |   91   firefox->app_path = FilePath::FromWStringHack( | 
|   92       GetFirefoxInstallPathFromRegistry()); |   92       GetFirefoxInstallPathFromRegistry()); | 
|   93 #endif |   93 #endif | 
|   94   if (firefox->app_path.empty()) |   94   if (firefox->app_path.empty()) | 
|   95     firefox->app_path = app_path; |   95     firefox->app_path = app_path; | 
|   96   firefox->services_supported = importer::HISTORY | importer::FAVORITES | |   96   firefox->services_supported = importer::HISTORY | importer::FAVORITES | | 
|   97       importer::PASSWORDS | importer::SEARCH_ENGINES; |   97       importer::PASSWORDS | importer::SEARCH_ENGINES; | 
|   98   profiles->push_back(firefox); |   98   profiles->push_back(firefox); | 
|   99 } |   99 } | 
|  100  |  100  | 
|  101 void DetectGoogleToolbarProfiles(std::vector<importer::ProfileInfo*>* profiles) 
     { |  101 void DetectGoogleToolbarProfiles( | 
 |  102     std::vector<importer::ProfileInfo*>* profiles) { | 
|  102   if (FirstRun::IsChromeFirstRun()) |  103   if (FirstRun::IsChromeFirstRun()) | 
|  103     return; |  104     return; | 
|  104  |  105  | 
|  105   importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); |  106   importer::ProfileInfo* google_toolbar = new importer::ProfileInfo(); | 
|  106   google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; |  107   google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5; | 
|  107   google_toolbar->description = l10n_util::GetString( |  108   google_toolbar->description = l10n_util::GetString( | 
|  108                                 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); |  109                                 IDS_IMPORT_FROM_GOOGLE_TOOLBAR); | 
|  109   google_toolbar->source_path.clear(); |  110   google_toolbar->source_path.clear(); | 
|  110   google_toolbar->app_path.clear(); |  111   google_toolbar->app_path.clear(); | 
|  111   google_toolbar->services_supported = importer::FAVORITES; |  112   google_toolbar->services_supported = importer::FAVORITES; | 
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  189  |  190  | 
|  190   int count = GetAvailableProfileCount(); |  191   int count = GetAvailableProfileCount(); | 
|  191   for (int i = 0; i < count; ++i) { |  192   for (int i = 0; i < count; ++i) { | 
|  192     if (source_profiles_[i]->browser_type == browser_type) |  193     if (source_profiles_[i]->browser_type == browser_type) | 
|  193       return *source_profiles_[i]; |  194       return *source_profiles_[i]; | 
|  194   } |  195   } | 
|  195   NOTREACHED(); |  196   NOTREACHED(); | 
|  196   return *(new importer::ProfileInfo()); |  197   return *(new importer::ProfileInfo()); | 
|  197 } |  198 } | 
|  198  |  199  | 
 |  200 bool ImporterList::source_profiles_loaded() const { | 
 |  201   return source_profiles_loaded_; | 
 |  202 } | 
 |  203  | 
|  199 void ImporterList::DetectSourceProfilesWorker() { |  204 void ImporterList::DetectSourceProfilesWorker() { | 
|  200   // TODO(jhawkins): Remove this condition once DetectSourceProfileHack is |  205   // TODO(jhawkins): Remove this condition once DetectSourceProfileHack is | 
|  201   // removed. |observer_| is NULL when said method is called. |  206   // removed. |observer_| is NULL when said method is called. | 
|  202   if (observer_) |  207   if (observer_) | 
|  203     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |  208     DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 
|  204  |  209  | 
|  205   std::vector<importer::ProfileInfo*> profiles; |  210   std::vector<importer::ProfileInfo*> profiles; | 
|  206  |  211  | 
|  207 // The first run import will automatically take settings from the first |  212 // The first run import will automatically take settings from the first | 
|  208 // profile detected, which should be the user's current default. |  213 // profile detected, which should be the user's current default. | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  248   BrowserThread::ID current_thread_id; |  253   BrowserThread::ID current_thread_id; | 
|  249   BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); |  254   BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); | 
|  250   DCHECK_EQ(current_thread_id, source_thread_id_); |  255   DCHECK_EQ(current_thread_id, source_thread_id_); | 
|  251  |  256  | 
|  252   source_profiles_->assign(profiles.begin(), profiles.end()); |  257   source_profiles_->assign(profiles.begin(), profiles.end()); | 
|  253   source_profiles_loaded_ = true; |  258   source_profiles_loaded_ = true; | 
|  254   observer_->SourceProfilesLoaded(); |  259   observer_->SourceProfilesLoaded(); | 
|  255   observer_ = NULL; |  260   observer_ = NULL; | 
|  256   source_thread_id_ = BrowserThread::UI; |  261   source_thread_id_ = BrowserThread::UI; | 
|  257 } |  262 } | 
| OLD | NEW |