| 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 #ifndef APP_TEXT_ELIDER_H_ | 5 #ifndef APP_TEXT_ELIDER_H_ |
| 6 #define APP_TEXT_ELIDER_H_ | 6 #define APP_TEXT_ELIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <unicode/coll.h> | 9 #include <unicode/coll.h> |
| 10 #include <unicode/uchar.h> | 10 #include <unicode/uchar.h> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 int available_pixel_width); | 56 int available_pixel_width); |
| 57 | 57 |
| 58 // SortedDisplayURL maintains a string from a URL suitable for display to the | 58 // SortedDisplayURL maintains a string from a URL suitable for display to the |
| 59 // use. SortedDisplayURL also provides a function used for comparing two | 59 // use. SortedDisplayURL also provides a function used for comparing two |
| 60 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. | 60 // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. |
| 61 // | 61 // |
| 62 // SortedDisplayURL is relatively cheap and supports value semantics. | 62 // SortedDisplayURL is relatively cheap and supports value semantics. |
| 63 class SortedDisplayURL { | 63 class SortedDisplayURL { |
| 64 public: | 64 public: |
| 65 SortedDisplayURL(const GURL& url, const std::wstring& languages); | 65 SortedDisplayURL(const GURL& url, const std::wstring& languages); |
| 66 SortedDisplayURL() {} | 66 SortedDisplayURL(); |
| 67 ~SortedDisplayURL(); |
| 67 | 68 |
| 68 // Compares this SortedDisplayURL to |url| using |collator|. Returns a value | 69 // Compares this SortedDisplayURL to |url| using |collator|. Returns a value |
| 69 // < 0, = 1 or > 0 as to whether this url is less then, equal to or greater | 70 // < 0, = 1 or > 0 as to whether this url is less then, equal to or greater |
| 70 // than the supplied url. | 71 // than the supplied url. |
| 71 int Compare(const SortedDisplayURL& other, icu::Collator* collator) const; | 72 int Compare(const SortedDisplayURL& other, icu::Collator* collator) const; |
| 72 | 73 |
| 73 // Returns the display string for the URL. | 74 // Returns the display string for the URL. |
| 74 const string16& display_url() const { return display_url_; } | 75 const string16& display_url() const { return display_url_; } |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 // Returns everything after the host. This is used by Compare if the hosts | 78 // Returns everything after the host. This is used by Compare if the hosts |
| 78 // match. | 79 // match. |
| 79 string16 AfterHost() const; | 80 string16 AfterHost() const; |
| 80 | 81 |
| 81 // Host name minus 'www.'. Used by Compare. | 82 // Host name minus 'www.'. Used by Compare. |
| 82 string16 sort_host_; | 83 string16 sort_host_; |
| 83 | 84 |
| 84 // End of the prefix (spec and separator) in display_url_. | 85 // End of the prefix (spec and separator) in display_url_. |
| 85 size_t prefix_end_; | 86 size_t prefix_end_; |
| 86 | 87 |
| 87 string16 display_url_; | 88 string16 display_url_; |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 } // namespace gfx. | 91 } // namespace gfx. |
| 91 | 92 |
| 92 #endif // APP_TEXT_ELIDER_H_ | 93 #endif // APP_TEXT_ELIDER_H_ |
| OLD | NEW |