| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/importer/bookmarks_file_importer.h" | 5 #include "chrome/utility/importer/bookmarks_file_importer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/common/importer/imported_bookmark_entry.h" | 8 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 9 #include "chrome/common/importer/importer_bridge.h" | 9 #include "chrome/common/importer/importer_bridge.h" |
| 10 #include "chrome/common/importer/importer_data_types.h" | 10 #include "chrome/common/importer/importer_data_types.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "chrome/utility/importer/bookmark_html_reader.h" | 13 #include "chrome/utility/importer/bookmark_html_reader.h" |
| 14 #include "components/favicon_base/favicon_usage_data.h" | 14 #include "components/favicon_base/favicon_usage_data.h" |
| 15 #include "components/url_formatter/url_fixer.h" | 15 #include "components/url_fixer/url_fixer.h" |
| 16 #include "content/public/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool IsImporterCancelled(BookmarksFileImporter* importer) { | 20 bool IsImporterCancelled(BookmarksFileImporter* importer) { |
| 21 return importer->cancelled(); | 21 return importer->cancelled(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 return true; | 44 return true; |
| 45 | 45 |
| 46 // If |url| starts with chrome:// or about:, check if it's one of the URLs | 46 // If |url| starts with chrome:// or about:, check if it's one of the URLs |
| 47 // that we support. | 47 // that we support. |
| 48 if (url.SchemeIs(content::kChromeUIScheme) || | 48 if (url.SchemeIs(content::kChromeUIScheme) || |
| 49 url.SchemeIs(url::kAboutScheme)) { | 49 url.SchemeIs(url::kAboutScheme)) { |
| 50 if (url.host() == chrome::kChromeUIUberHost || | 50 if (url.host() == chrome::kChromeUIUberHost || |
| 51 url.host() == chrome::kChromeUIAboutHost) | 51 url.host() == chrome::kChromeUIAboutHost) |
| 52 return true; | 52 return true; |
| 53 | 53 |
| 54 GURL fixed_url(url_formatter::FixupURL(url.spec(), std::string())); | 54 GURL fixed_url(url_fixer::FixupURL(url.spec(), std::string())); |
| 55 for (size_t i = 0; i < chrome::kNumberOfChromeHostURLs; ++i) { | 55 for (size_t i = 0; i < chrome::kNumberOfChromeHostURLs; ++i) { |
| 56 if (fixed_url.DomainIs(chrome::kChromeHostURLs[i])) | 56 if (fixed_url.DomainIs(chrome::kChromeHostURLs[i])) |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { | 60 for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { |
| 61 if (fixed_url == GURL(chrome::kChromeDebugURLs[i])) | 61 if (fixed_url == GURL(chrome::kChromeDebugURLs[i])) |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 bridge->AddBookmarks(bookmarks, first_folder_name); | 107 bridge->AddBookmarks(bookmarks, first_folder_name); |
| 108 } | 108 } |
| 109 if (!search_engines.empty()) | 109 if (!search_engines.empty()) |
| 110 bridge->SetKeywords(search_engines, false); | 110 bridge->SetKeywords(search_engines, false); |
| 111 if (!favicons.empty()) | 111 if (!favicons.empty()) |
| 112 bridge->SetFavicons(favicons); | 112 bridge->SetFavicons(favicons); |
| 113 | 113 |
| 114 bridge->NotifyItemEnded(importer::FAVORITES); | 114 bridge->NotifyItemEnded(importer::FAVORITES); |
| 115 bridge->NotifyEnded(); | 115 bridge->NotifyEnded(); |
| 116 } | 116 } |
| OLD | NEW |