1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/importer/importer_type.h" 6 7 #include "base/logging.h" 8 #include "chrome/browser/importer/firefox2_importer.h" 9 #include "chrome/browser/importer/firefox3_importer.h" 10 #include "chrome/browser/importer/toolbar_importer.h" 11 12 #if defined(OS_WIN) 13 #include "chrome/browser/importer/ie_importer.h" 14 #endif 15 16 #if defined(OS_MACOSX) 17 #include <CoreFoundation/CoreFoundation.h> 18 #include "base/mac/foundation_util.h" 19 #include "chrome/browser/importer/safari_importer.h" 20 #endif 21 22 namespace importer { 23 CreateImporterByType(ImporterType type)24Importer* CreateImporterByType(ImporterType type) { 25 switch (type) { 26 #if defined(OS_WIN) 27 case MS_IE: 28 return new IEImporter(); 29 #endif 30 case BOOKMARKS_HTML: 31 case FIREFOX2: 32 return new Firefox2Importer(); 33 case FIREFOX3: 34 return new Firefox3Importer(); 35 case GOOGLE_TOOLBAR5: 36 return new Toolbar5Importer(); 37 #if defined(OS_MACOSX) 38 case SAFARI: 39 return new SafariImporter(base::mac::GetUserLibraryPath()); 40 #endif // OS_MACOSX 41 case NONE_IMPORTER: 42 NOTREACHED(); 43 return NULL; 44 } 45 NOTREACHED(); 46 return NULL; 47 } 48 49 } // namespace importer 50