Chromium Code Reviews| Index: chrome/browser/ui/title_prefix_matcher.h |
| =================================================================== |
| --- chrome/browser/ui/title_prefix_matcher.h (revision 80159) |
| +++ chrome/browser/ui/title_prefix_matcher.h (working copy) |
| @@ -9,6 +9,7 @@ |
| #include <vector> |
| #include "base/string16.h" |
| +#include "googleurl/src/gurl.h" |
| // This class exposes a static method that receives a vector of TitleInfo |
| // objects so that it can find the length of the common prefixes among all |
| @@ -26,11 +27,13 @@ |
| class TitlePrefixMatcher { |
| public: |
| struct TitleInfo { |
| - TitleInfo(const string16* title, int caller_value); |
| + TitleInfo(const string16* title, const GURL& url, int caller_value); |
| // We assume the title string will be valid throughout the execution of |
|
sky
2011/04/04 15:48:17
Add a destructor and move it to the .cc
MAD
2011/04/05 16:13:12
Done.
|
| // the prefix lengths calculation, and so we use a pointer to avoid an |
| // unnecessary string copy. |
| const string16* title; |
| + // We only look for common prefix when the URL has the same hostname. |
| + GURL url; |
| // This contains the number of characters at the beginning of title that |
| // are common with other titles in the TitleInfo vector. |
| size_t prefix_length; |
| @@ -39,6 +42,14 @@ |
| }; |
| static void CalculatePrefixLengths(std::vector<TitleInfo>* title_infos); |
| + // This is the number of common characters at the end of the common prefix |
| + // that tabs should still display. |
| + static const int kCommonCharsToShow; |
| + |
| + // This is the minimum number of common characters we should get before |
| + // enabling the prefix eliding. |
| + static const size_t kMinElidingLength; |
| + |
| private: |
| DISALLOW_IMPLICIT_CONSTRUCTORS(TitlePrefixMatcher); |
| }; |