diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-13 00:56:27 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-13 00:56:27 +0000 |
commit | 6c9851a40d3f6280dc322c2392d9cfcf8fba1b2d (patch) | |
tree | 91072da4d7f80596bcc437e82685cf7de7944dfe /chrome | |
parent | 231d5a36e476d013a91ca742bb8a0a2973cfee54 (diff) | |
download | chromium_src-6c9851a40d3f6280dc322c2392d9cfcf8fba1b2d.zip chromium_src-6c9851a40d3f6280dc322c2392d9cfcf8fba1b2d.tar.gz chromium_src-6c9851a40d3f6280dc322c2392d9cfcf8fba1b2d.tar.bz2 |
Move importer files into an importer subdirectory.
Also delete title chomper no one uses it.
B=2205
Review URL: http://codereview.chromium.org/3035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.vcproj | 124 | ||||
-rw-r--r-- | chrome/browser/first_run.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/firefox2_importer.cc (renamed from chrome/browser/firefox2_importer.cc) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/firefox2_importer.h (renamed from chrome/browser/firefox2_importer.h) | 8 | ||||
-rw-r--r-- | chrome/browser/importer/firefox3_importer.cc (renamed from chrome/browser/firefox3_importer.cc) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/firefox3_importer.h (renamed from chrome/browser/firefox3_importer.h) | 8 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest.cc (renamed from chrome/browser/firefox_importer_unittest.cc) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.cc (renamed from chrome/browser/firefox_importer_utils.cc) | 2 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_utils.h (renamed from chrome/browser/firefox_importer_utils.h) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_profile_lock.cc (renamed from chrome/browser/firefox_profile_lock.cc) | 2 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_profile_lock.h (renamed from chrome/browser/firefox_profile_lock.h) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.cc (renamed from chrome/browser/ie_importer.cc) | 2 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.h (renamed from chrome/browser/ie_importer.h) | 8 | ||||
-rw-r--r-- | chrome/browser/importer/importer.cc (renamed from chrome/browser/importer.cc) | 12 | ||||
-rw-r--r-- | chrome/browser/importer/importer.h (renamed from chrome/browser/importer.h) | 6 | ||||
-rw-r--r-- | chrome/browser/importer/importer_unittest.cc (renamed from chrome/browser/importer_unittest.cc) | 4 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.cc (renamed from chrome/browser/mork_reader.cc) | 4 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.h (renamed from chrome/browser/mork_reader.h) | 8 | ||||
-rw-r--r-- | chrome/browser/title_chomper.cc | 75 | ||||
-rw-r--r-- | chrome/browser/title_chomper.h | 30 | ||||
-rw-r--r-- | chrome/browser/title_chomper_unittest.cc | 95 | ||||
-rw-r--r-- | chrome/browser/views/first_run_customize_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/first_run_view_base.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/importer_view.h | 2 | ||||
-rw-r--r-- | chrome/test/unit/unittests.vcproj | 12 |
26 files changed, 115 insertions, 326 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 078f95f..e98fea0 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1154,14 +1154,6 @@ > </File> <File - RelativePath=".\title_chomper.cc" - > - </File> - <File - RelativePath=".\title_chomper.h" - > - </File> - <File RelativePath=".\web_app_icon_manager.cc" > </File> @@ -1639,6 +1631,66 @@ </File> </Filter> <Filter + Name="Importer" + > + <File + RelativePath=".\importer\firefox2_importer.cc" + > + </File> + <File + RelativePath=".\importer\firefox2_importer.h" + > + </File> + <File + RelativePath=".\importer\firefox3_importer.cc" + > + </File> + <File + RelativePath=".\importer\firefox3_importer.h" + > + </File> + <File + RelativePath=".\importer\firefox_importer_utils.cc" + > + </File> + <File + RelativePath=".\importer\firefox_importer_utils.h" + > + </File> + <File + RelativePath=".\importer\firefox_profile_lock.cc" + > + </File> + <File + RelativePath=".\importer\firefox_profile_lock.h" + > + </File> + <File + RelativePath=".\importer\ie_importer.cc" + > + </File> + <File + RelativePath=".\importer\ie_importer.h" + > + </File> + <File + RelativePath=".\importer\importer.cc" + > + </File> + <File + RelativePath=".\importer\importer.h" + > + </File> + <File + RelativePath=".\importer\mork_reader.cc" + > + </File> + <File + RelativePath=".\importer\mork_reader.h" + > + </File> + </Filter> + <Filter Name="Drag & Drop" > <File @@ -2079,38 +2131,6 @@ > </File> <File - RelativePath=".\firefox2_importer.cc" - > - </File> - <File - RelativePath=".\firefox2_importer.h" - > - </File> - <File - RelativePath=".\firefox3_importer.cc" - > - </File> - <File - RelativePath=".\firefox3_importer.h" - > - </File> - <File - RelativePath=".\firefox_importer_utils.cc" - > - </File> - <File - RelativePath=".\firefox_importer_utils.h" - > - </File> - <File - RelativePath=".\firefox_profile_lock.cc" - > - </File> - <File - RelativePath=".\firefox_profile_lock.h" - > - </File> - <File RelativePath=".\gears_integration.cc" > </File> @@ -2135,22 +2155,6 @@ > </File> <File - RelativePath=".\ie_importer.cc" - > - </File> - <File - RelativePath=".\ie_importer.h" - > - </File> - <File - RelativePath=".\importer.cc" - > - </File> - <File - RelativePath=".\importer.h" - > - </File> - <File RelativePath=".\interstitial_page_delegate.h" > </File> @@ -2163,14 +2167,6 @@ > </File> <File - RelativePath=".\mork_reader.cc" - > - </File> - <File - RelativePath=".\mork_reader.h" - > - </File> - <File RelativePath=".\page_info_window.cc" > </File> diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc index 097ec77..da1bdd3 100644 --- a/chrome/browser/first_run.cc +++ b/chrome/browser/first_run.cc @@ -19,7 +19,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/hang_monitor/hung_window_detector.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/browser/profile.h" #include "chrome/browser/views/first_run_view.h" #include "chrome/common/chrome_constants.h" diff --git a/chrome/browser/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc index 15e2931..59f1778 100644 --- a/chrome/browser/firefox2_importer.cc +++ b/chrome/browser/importer/firefox2_importer.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/firefox2_importer.h" +#include "chrome/browser/importer/firefox2_importer.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/registry.h" #include "base/string_util.h" #include "base/values.h" -#include "chrome/browser/firefox_importer_utils.h" -#include "chrome/browser/mork_reader.h" +#include "chrome/browser/importer/firefox_importer_utils.h" +#include "chrome/browser/importer/mork_reader.h" #include "chrome/browser/template_url.h" #include "chrome/browser/template_url_parser.h" #include "chrome/common/l10n_util.h" diff --git a/chrome/browser/firefox2_importer.h b/chrome/browser/importer/firefox2_importer.h index ed03e2b..2c44993 100644 --- a/chrome/browser/firefox2_importer.h +++ b/chrome/browser/importer/firefox2_importer.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_FIREFOX2_IMPORTER_H_ -#define CHROME_BROWSER_FIREFOX2_IMPORTER_H_ +#ifndef CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ +#define CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" class TemplateURL; @@ -108,5 +108,5 @@ class Firefox2Importer : public Importer { DISALLOW_EVIL_CONSTRUCTORS(Firefox2Importer); }; -#endif // CHROME_BROWSER_FIREFOX2_IMPORTER_H_ +#endif // CHROME_BROWSER_IMPORTER_FIREFOX2_IMPORTER_H_ diff --git a/chrome/browser/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 8c325bee..3279130 100644 --- a/chrome/browser/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/firefox3_importer.h" +#include "chrome/browser/importer/firefox3_importer.h" #include <set> #include "base/file_util.h" #include "base/scoped_ptr.h" #include "base/string_util.h" -#include "chrome/browser/firefox2_importer.h" -#include "chrome/browser/firefox_importer_utils.h" +#include "chrome/browser/importer/firefox2_importer.h" +#include "chrome/browser/importer/firefox_importer_utils.h" #include "chrome/common/l10n_util.h" #include "chrome/common/time_format.h" #include "generated_resources.h" diff --git a/chrome/browser/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h index 92c8e18..d4cc0bc 100644 --- a/chrome/browser/firefox3_importer.h +++ b/chrome/browser/importer/firefox3_importer.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_FIREFOX3_IMPORTER_H_ -#define CHROME_BROWSER_FIREFOX3_IMPORTER_H_ +#ifndef CHROME_BROWSER_IMPORTER_FIREFOX3_IMPORTER_H_ +#define CHROME_BROWSER_IMPORTER_FIREFOX3_IMPORTER_H_ #include <map> #include <string> #include <vector> #include "base/basictypes.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/common/sqlite_utils.h" #include "googleurl/src/gurl.h" @@ -81,5 +81,5 @@ class Firefox3Importer : public Importer { DISALLOW_EVIL_CONSTRUCTORS(Firefox3Importer); }; -#endif // CHROME_BROWSER_FIREFOX3_IMPORTER_H_ +#endif // CHROME_BROWSER_IMPORTER_FIREFOX3_IMPORTER_H_ diff --git a/chrome/browser/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc index 08209db..d47b133 100644 --- a/chrome/browser/firefox_importer_unittest.cc +++ b/chrome/browser/importer/firefox_importer_unittest.cc @@ -6,9 +6,9 @@ #include "base/file_util.h" #include "base/path_service.h" -#include "chrome/browser/firefox2_importer.h" -#include "chrome/browser/firefox_importer_utils.h" -#include "chrome/browser/firefox_profile_lock.h" +#include "chrome/browser/importer/firefox2_importer.h" +#include "chrome/browser/importer/firefox_importer_utils.h" +#include "chrome/browser/importer/firefox_profile_lock.h" #include "chrome/common/chrome_paths.h" TEST(FirefoxImporterTest, Firefox2NSS3Decryptor) { diff --git a/chrome/browser/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index c21dac6..c9d6caa 100644 --- a/chrome/browser/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/firefox_importer_utils.h" +#include "chrome/browser/importer/firefox_importer_utils.h" #include <shlobj.h> diff --git a/chrome/browser/firefox_importer_utils.h b/chrome/browser/importer/firefox_importer_utils.h index bcadab9..f69a27d 100644 --- a/chrome/browser/firefox_importer_utils.h +++ b/chrome/browser/importer/firefox_importer_utils.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_FIREFOX_IMPORTER_UTILS_H_ -#define CHROME_BROWSER_FIREFOX_IMPORTER_UTILS_H_ +#ifndef CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ +#define CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ #include "base/values.h" #include "webkit/glue/password_form.h" @@ -207,5 +207,5 @@ class NSSDecryptor { DISALLOW_EVIL_CONSTRUCTORS(NSSDecryptor); }; -#endif // CHROME_BROWSER_FIREFOX_IMPORTER_UTILS_H__ +#endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ diff --git a/chrome/browser/firefox_profile_lock.cc b/chrome/browser/importer/firefox_profile_lock.cc index 0a57144..aaab891 100644 --- a/chrome/browser/firefox_profile_lock.cc +++ b/chrome/browser/importer/firefox_profile_lock.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/firefox_profile_lock.h" +#include "chrome/browser/importer/firefox_profile_lock.h" #include "base/file_util.h" diff --git a/chrome/browser/firefox_profile_lock.h b/chrome/browser/importer/firefox_profile_lock.h index f8b91c8..c32d592 100644 --- a/chrome/browser/firefox_profile_lock.h +++ b/chrome/browser/importer/firefox_profile_lock.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_FIREFOX_PROFILE_LOCK_H__ -#define CHROME_BROWSER_FIREFOX_PROFILE_LOCK_H__ +#ifndef CHROME_BROWSER_IMPORTER_FIREFOX_PROFILE_LOCK_H__ +#define CHROME_BROWSER_IMPORTER_FIREFOX_PROFILE_LOCK_H__ #include <windows.h> @@ -90,5 +90,5 @@ class FirefoxProfileLock { DISALLOW_EVIL_CONSTRUCTORS(FirefoxProfileLock); }; -#endif // CHROME_BROWSER_FIREFOX_PROFILE_LOCK_H__ +#endif // CHROME_BROWSER_IMPORTER_FIREFOX_PROFILE_LOCK_H__ diff --git a/chrome/browser/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 374a34d..8e53807 100644 --- a/chrome/browser/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ie_importer.h" +#include "chrome/browser/importer/ie_importer.h" #include <intshcut.h> #include <pstore.h> diff --git a/chrome/browser/ie_importer.h b/chrome/browser/importer/ie_importer.h index ab6f1d5..fce1f8e 100644 --- a/chrome/browser/ie_importer.h +++ b/chrome/browser/importer/ie_importer.h @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_IE_IMPORTER_H_ -#define CHROME_BROWSER_IE_IMPORTER_H_ +#ifndef CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ +#define CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" class IEImporter : public Importer { public: @@ -85,5 +85,5 @@ class IEImporter : public Importer { DISALLOW_EVIL_CONSTRUCTORS(IEImporter); }; -#endif // CHROME_BROWSER_IE_IMPORTER_H_ +#endif // CHROME_BROWSER_IMPORTER_IE_IMPORTER_H_ diff --git a/chrome/browser/importer.cc b/chrome/browser/importer/importer.cc index 47eea2f..45d317f 100644 --- a/chrome/browser/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include <map> @@ -12,11 +12,11 @@ #include "base/string_util.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/firefox2_importer.h" -#include "chrome/browser/firefox3_importer.h" -#include "chrome/browser/firefox_importer_utils.h" -#include "chrome/browser/firefox_profile_lock.h" -#include "chrome/browser/ie_importer.h" +#include "chrome/browser/importer/firefox2_importer.h" +#include "chrome/browser/importer/firefox3_importer.h" +#include "chrome/browser/importer/firefox_importer_utils.h" +#include "chrome/browser/importer/firefox_profile_lock.h" +#include "chrome/browser/importer/ie_importer.h" #include "chrome/browser/template_url_model.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/webdata/web_data_service.h" diff --git a/chrome/browser/importer.h b/chrome/browser/importer/importer.h index 65ba842..37be870 100644 --- a/chrome/browser/importer.h +++ b/chrome/browser/importer/importer.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_IMPORTER_H_ -#define CHROME_BROWSER_IMPORTER_H_ +#ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ +#define CHROME_BROWSER_IMPORTER_IMPORTER_H_ #include <set> #include <vector> @@ -353,5 +353,5 @@ void StartImportingWithUI(HWND parent_window, ImportObserver* observer, bool first_run); -#endif // CHROME_BROWSER_IMPORTER_H__ +#endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ diff --git a/chrome/browser/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 694632f..e7f097e 100644 --- a/chrome/browser/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -14,9 +14,9 @@ #include "base/file_util.h" #include "base/path_service.h" -#include "chrome/browser/ie_importer.h" #include "chrome/browser/ie7_password.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/ie_importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/browser/profile.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/env_util.h" diff --git a/chrome/browser/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index 9a59cf0..3ae4b6c 100644 --- a/chrome/browser/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -40,14 +40,14 @@ // http://mxr.mozilla.org/firefox/source/db/morkreader/nsMorkReader.cpp // This file has been converted to google style. -#include "chrome/browser/mork_reader.h" +#include "chrome/browser/importer/mork_reader.h" #include <algorithm> #include "base/logging.h" #include "base/string_util.h" -#include "chrome/browser/firefox_importer_utils.h" #include "chrome/browser/history/history_types.h" +#include "chrome/browser/importer/firefox_importer_utils.h" namespace { diff --git a/chrome/browser/mork_reader.h b/chrome/browser/importer/mork_reader.h index 6b4b267..1e54b93 100644 --- a/chrome/browser/mork_reader.h +++ b/chrome/browser/importer/mork_reader.h @@ -39,8 +39,8 @@ // Source: // http://mxr.mozilla.org/firefox/source/db/morkreader/nsMorkReader.h -#ifndef MORK_READER_H__ -#define MORK_READER_H__ +#ifndef CHROME_BROWSER_IMPORTER_MORK_READER_H__ +#define CHROME_BROWSER_IMPORTER_MORK_READER_H__ #include <map> #include <iostream> @@ -50,7 +50,7 @@ #include "base/basictypes.h" #include "base/stack_container.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" // The nsMorkReader object allows a consumer to read in a mork-format // file and enumerate the rows that it contains. It does not provide @@ -162,4 +162,4 @@ class MorkReader { void ImportHistoryFromFirefox2(std::wstring file, MessageLoop* loop, ProfileWriter* writer); -#endif // MORK_READER_H__ +#endif // CHROME_BROWSER_IMPORTER_MORK_READER_H__ diff --git a/chrome/browser/title_chomper.cc b/chrome/browser/title_chomper.cc deleted file mode 100644 index 715aeb58..0000000 --- a/chrome/browser/title_chomper.cc +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <algorithm> - -#include "chrome/browser/title_chomper.h" - -#include "base/logging.h" -#include "base/word_iterator.h" - -TitleChomper::TitleChomper() { -} - -void TitleChomper::AddTitle(const std::wstring& title) { - titles_.push_back(title); -} - -void TitleChomper::ChompTitles(std::vector<std::wstring>* chomped_titles) { - std::vector<std::wstring>::iterator title; - for (title = titles_.begin(); title != titles_.end(); ++title) { - std::wstring chomped; - GenerateChompedTitle(*title, &chomped); - chomped_titles->push_back(chomped); - } -} - -void TitleChomper::GenerateChompedTitle(const std::wstring& title, - std::wstring* chomped_title) { - // We don't chomp identical titles, since they would chomp to nothing! - if (title == last_title_) { - *chomped_title = title; - last_words_.clear(); - return; - } - last_title_ = title; - - // TODO(beng): fix locale - WordIterator iter(title, WordIterator::BREAK_WORD); - if (!iter.Init()) - return; - - int chomp_point = 0; - size_t count = 0; - - std::vector<std::wstring> words; - - bool record_next_point = false; - bool found_chomp_point = false; - - while (iter.Advance()) { - if (iter.IsWord()) { - const std::wstring fragment = iter.GetWord(); - words.push_back(fragment); - - size_t last_words_size = last_words_.size(); - bool word_mismatch = - (count < last_words_size && last_words_.at(count) != fragment) || - (last_words_size > 0 && count >= last_words_size); - if (!found_chomp_point && word_mismatch) { - // Need to wait until the next word point so that we skip any spaces or - // punctuation at the start of the string. - record_next_point = true; - } - ++count; - } - if (!found_chomp_point && record_next_point) { - chomp_point = iter.prev(); - found_chomp_point = true; - } - } - last_words_ = words; - chomped_title->assign(title.substr(chomp_point)); -} - diff --git a/chrome/browser/title_chomper.h b/chrome/browser/title_chomper.h deleted file mode 100644 index 621da97..0000000 --- a/chrome/browser/title_chomper.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_TITLE_CHOMPER_H__ -#define CHROME_BROWSER_TITLE_CHOMPER_H__ - -#include <string> -#include <vector> - -class TitleChomper { - public: - TitleChomper(); - - void AddTitle(const std::wstring& title); - - void ChompTitles(std::vector<std::wstring>* chomped_titles); - - private: - void GenerateChompedTitle(const std::wstring& title, - std::wstring* chomped_title); - - private: - std::vector<std::wstring> titles_; - std::vector<std::wstring> last_words_; - std::wstring last_title_; -}; - -#endif // #ifndef CHROME_BROWSER_TITLE_CHOMPER_H__ - diff --git a/chrome/browser/title_chomper_unittest.cc b/chrome/browser/title_chomper_unittest.cc deleted file mode 100644 index 430995a..0000000 --- a/chrome/browser/title_chomper_unittest.cc +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/title_chomper.h" -#include "googleurl/src/gurl.h" -#include "testing/gtest/include/gtest/gtest.h" - -class TitleChomperTest : public testing::Test { -}; - -TEST_F(TitleChomperTest, BasicCase) { - TitleChomper chomper; - chomper.AddTitle(L"A"); - chomper.AddTitle(L"A B"); - chomper.AddTitle(L"A B C"); - chomper.AddTitle(L"A B C D"); - - std::vector<std::wstring> chomped_titles; - chomper.ChompTitles(&chomped_titles); - - EXPECT_EQ(L"A", chomped_titles.at(0)); - EXPECT_EQ(L"B", chomped_titles.at(1)); - EXPECT_EQ(L"C", chomped_titles.at(2)); - EXPECT_EQ(L"D", chomped_titles.at(3)); -} - -TEST_F(TitleChomperTest, LongerTitleBasicCase) { - TitleChomper chomper; - chomper.AddTitle(L"A Q"); - chomper.AddTitle(L"A B Q"); - chomper.AddTitle(L"A B C Q"); - chomper.AddTitle(L"A B C D Q"); - - std::vector<std::wstring> chomped_titles; - chomper.ChompTitles(&chomped_titles); - - EXPECT_EQ(L"A Q", chomped_titles.at(0)); - EXPECT_EQ(L"B Q", chomped_titles.at(1)); - EXPECT_EQ(L"C Q", chomped_titles.at(2)); - EXPECT_EQ(L"D Q", chomped_titles.at(3)); -} - -TEST_F(TitleChomperTest, PunctuationCase) { - TitleChomper chomper; - // There should be able to be wacky punctuation and it should still work - chomper.AddTitle(L"A, Q."); - chomper.AddTitle(L"A, B:- Q."); - chomper.AddTitle(L"A, B:- C; Q"); - chomper.AddTitle(L"A B. C D; Q"); - - std::vector<std::wstring> chomped_titles; - chomper.ChompTitles(&chomped_titles); - - EXPECT_EQ(L"A, Q.", chomped_titles.at(0)); - EXPECT_EQ(L"B:- Q.", chomped_titles.at(1)); - EXPECT_EQ(L"C; Q", chomped_titles.at(2)); - EXPECT_EQ(L"D; Q", chomped_titles.at(3)); -} - -TEST_F(TitleChomperTest, IdentiticalTitleCase) { - TitleChomper chomper; - chomper.AddTitle(L"A Q"); - chomper.AddTitle(L"A Q"); - chomper.AddTitle(L"A B C Q"); - chomper.AddTitle(L"A B C Q"); - chomper.AddTitle(L"A B C Q"); - - std::vector<std::wstring> chomped_titles; - chomper.ChompTitles(&chomped_titles); - - EXPECT_EQ(L"A Q", chomped_titles.at(0)); - EXPECT_EQ(L"A Q", chomped_titles.at(1)); - EXPECT_EQ(L"A B C Q", chomped_titles.at(2)); - EXPECT_EQ(L"A B C Q", chomped_titles.at(3)); - EXPECT_EQ(L"A B C Q", chomped_titles.at(4)); -} - -TEST_F(TitleChomperTest, CraigslistCase) { - TitleChomper chomper; - chomper.AddTitle(L"craigslist: san francisco bay area classifieds for jobs, apartments, personals, for sale, services, community, and events"); - chomper.AddTitle(L"craigslist | cars & trucks"); - chomper.AddTitle(L"s.f. bayarea craigslist > > cars & trucks: search"); - chomper.AddTitle(L"s.f. bayarea craigslist > peninsula > cars & trucks: search"); - chomper.AddTitle(L"s.f. bayarea craigslist > peninsula > cars & trucks: search for \"tacoma\""); - - std::vector<std::wstring> chomped_titles; - chomper.ChompTitles(&chomped_titles); - - EXPECT_EQ(L"craigslist: san francisco bay area classifieds for jobs, apartments, personals, for sale, services, community, and events", chomped_titles.at(0)); - EXPECT_EQ(L"cars & trucks", chomped_titles.at(1)); - EXPECT_EQ(L"s.f. bayarea craigslist > > cars & trucks: search", chomped_titles.at(2)); - EXPECT_EQ(L"peninsula > cars & trucks: search", chomped_titles.at(3)); - EXPECT_EQ(L"for \"tacoma\"", chomped_titles.at(4)); -} diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index a23524e..d5c91351 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -6,7 +6,7 @@ #include "chrome/app/locales/locale_settings.h" #include "chrome/app/theme/theme_resources.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/browser/first_run.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/standard_layout.h" diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index 690cd72..e4fc454 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -6,7 +6,7 @@ #include "chrome/app/locales/locale_settings.h" #include "chrome/app/theme/theme_resources.h" -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/browser/first_run.h" #include "chrome/browser/standard_layout.h" #include "chrome/browser/views/first_run_customize_view.h" diff --git a/chrome/browser/views/first_run_view_base.h b/chrome/browser/views/first_run_view_base.h index d0fb0fe..da0fe65 100644 --- a/chrome/browser/views/first_run_view_base.h +++ b/chrome/browser/views/first_run_view_base.h @@ -4,7 +4,8 @@ #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H__ #define CHROME_BROWSER_VIEWS_FIRST_RUN_VIEW_BASE_H__ -#include "chrome/browser/importer.h" + +#include "chrome/browser/importer/importer.h" #include "chrome/views/dialog_delegate.h" #include "chrome/views/view.h" diff --git a/chrome/browser/views/importer_view.h b/chrome/browser/views/importer_view.h index 8f40a4b..18219f9 100644 --- a/chrome/browser/views/importer_view.h +++ b/chrome/browser/views/importer_view.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_VIEWS_IMPORTER_VIEW_H__ #define CHROME_BROWSER_VIEWS_IMPORTER_VIEW_H__ -#include "chrome/browser/importer.h" +#include "chrome/browser/importer/importer.h" #include "chrome/views/combo_box.h" #include "chrome/views/dialog_delegate.h" #include "chrome/views/native_button.h" diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index 39bb9b2..aa849f3 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -523,14 +523,6 @@ </File> </Filter> <Filter - Name="TestTitleChomper" - > - <File - RelativePath="..\..\browser\title_chomper_unittest.cc" - > - </File> - </Filter> - <Filter Name="TestTemplateURLParser" > <File @@ -850,11 +842,11 @@ Name="TestImporter" > <File - RelativePath="..\..\browser\firefox_importer_unittest.cc" + RelativePath="..\..\browser\importer\firefox_importer_unittest.cc" > </File> <File - RelativePath="..\..\browser\importer_unittest.cc" + RelativePath="..\..\browser\importer\importer_unittest.cc" > </File> </Filter> |