| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 | 7 |
| 8 #include "webkit/glue/glue_util.h" | 8 #include "webkit/glue/glue_util.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 MSVC_PUSH_WARNING_LEVEL(0); | 12 MSVC_PUSH_WARNING_LEVEL(0); |
| 13 #include "CString.h" | 13 #include "CString.h" |
| 14 #include "IntRect.h" | 14 #include "IntRect.h" |
| 15 #include "PlatformString.h" | 15 #include "PlatformString.h" |
| 16 #include "KURL.h" | 16 #include "KURL.h" |
| 17 MSVC_POP_WARNING(); | 17 MSVC_POP_WARNING(); |
| 18 | 18 |
| 19 #include "WebString.h" |
| 20 |
| 19 #undef LOG | 21 #undef LOG |
| 20 | |
| 21 #include "base/compiler_specific.h" | 22 #include "base/compiler_specific.h" |
| 22 #include "base/gfx/rect.h" | 23 #include "base/gfx/rect.h" |
| 23 #include "base/string_piece.h" | 24 #include "base/string_piece.h" |
| 24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 25 #include "base/sys_string_conversions.h" | 26 #include "base/sys_string_conversions.h" |
| 26 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 27 | 28 |
| 28 | 29 |
| 29 namespace webkit_glue { | 30 namespace webkit_glue { |
| 30 | 31 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 92 } |
| 92 | 93 |
| 93 WebCore::String FilePathStringToString(const FilePath::StringType& str) { | 94 WebCore::String FilePathStringToString(const FilePath::StringType& str) { |
| 94 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 95 return StdWStringToString(str); | 96 return StdWStringToString(str); |
| 96 #elif defined(OS_POSIX) | 97 #elif defined(OS_POSIX) |
| 97 return StdWStringToString(base::SysNativeMBToWide(str)); | 98 return StdWStringToString(base::SysNativeMBToWide(str)); |
| 98 #endif | 99 #endif |
| 99 } | 100 } |
| 100 | 101 |
| 102 FilePath::StringType WebStringToFilePathString(const WebKit::WebString& str) { |
| 103 #if defined(OS_POSIX) |
| 104 return base::SysWideToNativeMB(UTF16ToWide(str)); |
| 105 #elif defined(OS_WIN) |
| 106 return UTF16ToWide(str); |
| 107 #endif |
| 108 } |
| 109 |
| 110 WebKit::WebString FilePathStringToWebString(const FilePath::StringType& str) { |
| 111 #if defined(OS_POSIX) |
| 112 return WideToUTF16(base::SysNativeMBToWide(str)); |
| 113 #elif defined(OS_WIN) |
| 114 return WideToUTF16(str); |
| 115 #endif |
| 116 } |
| 117 |
| 101 // URL conversions ------------------------------------------------------------- | 118 // URL conversions ------------------------------------------------------------- |
| 102 | 119 |
| 103 GURL KURLToGURL(const WebCore::KURL& url) { | 120 GURL KURLToGURL(const WebCore::KURL& url) { |
| 104 #if USE(GOOGLEURL) | 121 #if USE(GOOGLEURL) |
| 105 const WebCore::CString& spec = url.utf8String(); | 122 const WebCore::CString& spec = url.utf8String(); |
| 106 if (spec.isNull() || 0 == spec.length()) | 123 if (spec.isNull() || 0 == spec.length()) |
| 107 return GURL(); | 124 return GURL(); |
| 108 return GURL(spec.data(), spec.length(), url.parsed(), url.isValid()); | 125 return GURL(spec.data(), spec.length(), url.parsed(), url.isValid()); |
| 109 #else | 126 #else |
| 110 return StringToGURL(url.string()); | 127 return StringToGURL(url.string()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 133 return gfx::Rect(r.x(), r.y(), r.width() < 0 ? 0 : r.width(), | 150 return gfx::Rect(r.x(), r.y(), r.width() < 0 ? 0 : r.width(), |
| 134 r.height() < 0 ? 0 : r.height()); | 151 r.height() < 0 ? 0 : r.height()); |
| 135 } | 152 } |
| 136 | 153 |
| 137 WebCore::IntRect ToIntRect(const gfx::Rect& r) { | 154 WebCore::IntRect ToIntRect(const gfx::Rect& r) { |
| 138 return WebCore::IntRect(r.x(), r.y(), r.width(), r.height()); | 155 return WebCore::IntRect(r.x(), r.y(), r.width(), r.height()); |
| 139 } | 156 } |
| 140 | 157 |
| 141 } // namespace webkit_glue | 158 } // namespace webkit_glue |
| 142 | 159 |
| OLD | NEW |