summaryrefslogtreecommitdiffstats
path: root/chrome/common/gfx
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 01:51:23 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-23 01:51:23 +0000
commitb1c33f8b46f7f2b2a4489609c4b8d6e0d6905f25 (patch)
tree960b966701601a19072ea06648e19bc991060d35 /chrome/common/gfx
parent3efc4679d44aa442d4ae35ed95dff3ef0cf5ded6 (diff)
downloadchromium_src-b1c33f8b46f7f2b2a4489609c4b8d6e0d6905f25.zip
chromium_src-b1c33f8b46f7f2b2a4489609c4b8d6e0d6905f25.tar.gz
chromium_src-b1c33f8b46f7f2b2a4489609c4b8d6e0d6905f25.tar.bz2
Fix strings in url_fixer_upper.
* change URLs from wstring to string * change filenames from wstring to FilePath * url_fixer_upper{_unittest}.cc building on posix Review URL: http://codereview.chromium.org/18525 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8536 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gfx')
-rw-r--r--chrome/common/gfx/text_elider.cc18
-rw-r--r--chrome/common/gfx/text_elider.h15
2 files changed, 24 insertions, 9 deletions
diff --git a/chrome/common/gfx/text_elider.cc b/chrome/common/gfx/text_elider.cc
index a3d1c5d..70f7250 100644
--- a/chrome/common/gfx/text_elider.cc
+++ b/chrome/common/gfx/text_elider.cc
@@ -8,7 +8,9 @@
#include "chrome/common/gfx/text_elider.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
+#if defined(OS_WIN)
#include "chrome/views/label.h"
+#endif // defined(OS_WIN)
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"
@@ -35,15 +37,6 @@ static void AppendFormattedComponent(const std::string& spec,
std::wstring* output,
url_parse::Component* out_component);
-// A helper function to get Clean Url String from a GURL. The parsing of the
-// URL may change because various parts of the string will change lengths. The
-// new parsing will be placed in the given out parameter. |prefix_end| is set
-// to the end of the prefix (spec and separator characters before host).
-static std::wstring GetCleanStringFromUrl(const GURL& url,
- const std::wstring& languages,
- url_parse::Parsed* new_parsed,
- size_t* prefix_end);
-
// This function takes a GURL object and elides it. It returns a string
// which composed of parts from subdomain, domain, path, filename and query.
// A "..." is added automatically at the end if the elided string is bigger
@@ -396,6 +389,10 @@ std::wstring GetCleanStringFromUrl(const GURL& url,
const std::wstring& languages,
url_parse::Parsed* new_parsed,
size_t* prefix_end) {
+ url_parse::Parsed parsed_temp;
+ if (!new_parsed)
+ new_parsed = &parsed_temp;
+
std::wstring url_string;
// Check for empty URLs or 0 available text width.
@@ -452,6 +449,8 @@ std::wstring GetCleanStringFromUrl(const GURL& url,
return url_string;
}
+// TODO(port): SortedDisplayURL should be ported to posix.
+#if defined(OS_WIN)
SortedDisplayURL::SortedDisplayURL(const GURL& url,
const std::wstring& languages) {
AppendFormattedHost(url, languages, &sort_host_, NULL);
@@ -513,5 +512,6 @@ std::wstring SortedDisplayURL::AfterHost() const {
}
return display_url_.substr(slash_index + sort_host_.length());
}
+#endif // defined(OS_WIN)
} // namespace gfx.
diff --git a/chrome/common/gfx/text_elider.h b/chrome/common/gfx/text_elider.h
index 92d7d9e..8bf2b9c 100644
--- a/chrome/common/gfx/text_elider.h
+++ b/chrome/common/gfx/text_elider.h
@@ -13,8 +13,23 @@
class GURL;
+namespace url_parse {
+struct Parsed;
+}
+
namespace gfx {
+// A function to get URL string from a GURL that will be suitable for display
+// to the user. The parsing of the URL may change because various parts of the
+// string will change lengths. The new parsing will be placed in the given out
+// parameter. |prefix_end| is set to the end of the prefix (spec and separator
+// characters before host).
+// |languages|, |new_parsed|, and |prefix_end| may all be empty or NULL.
+std::wstring GetCleanStringFromUrl(const GURL& url,
+ const std::wstring& languages,
+ url_parse::Parsed* new_parsed,
+ size_t* prefix_end);
+
// This function takes a GURL object and elides it. It returns a string
// which composed of parts from subdomain, domain, path, filename and query.
// A "..." is added automatically at the end if the elided string is bigger