]> git.sesse.net Git - casparcg/blobdiff - dependencies64/cef/linux/include/internal/cef_string_wrappers.h
Upgrade CEF to 3.3029.1611.g44e39a8 / Chromium 58.0.3029.81.
[casparcg] / dependencies64 / cef / linux / include / internal / cef_string_wrappers.h
similarity index 97%
rename from dependencies64/cef/include/internal/cef_string_wrappers.h
rename to dependencies64/cef/linux/include/internal/cef_string_wrappers.h
index 875bcc5598d76759bc5a0be84e061fa5a8763a59..f5d6ab9ec6060f7fd452cb6a7d24c7f03ccdffd0 100644 (file)
 
 #include <memory.h>
 #include <string>
+
+#include "include/base/cef_string16.h"
 #include "include/internal/cef_string_types.h"
 
-#ifdef BUILDING_CEF_SHARED
-#include "base/strings/string16.h"
+#if defined(USING_CHROMIUM_INCLUDES)
+#include "base/files/file_path.h"
 #endif
 
-
 ///
 // Traits implementation for wide character strings.
 ///
@@ -87,7 +88,6 @@ struct CefStringTraitsWide {
     return cef_string_wide_set(str.c_str(), str.length(), s, true) ?
         true : false;
   }
-#if defined(BUILDING_CEF_SHARED)
 #if defined(WCHAR_T_IS_UTF32)
   static inline base::string16 to_string16(const struct_type *s) {
     cef_string_utf16_t cstr;
@@ -113,7 +113,6 @@ struct CefStringTraitsWide {
         true : false;
   }
 #endif  // WCHAR_T_IS_UTF32
-#endif  // BUILDING_CEF_SHARED
 };
 
 ///
@@ -162,7 +161,6 @@ struct CefStringTraitsUTF8 {
   static inline bool from_wstring(const std::wstring& str, struct_type* s) {
     return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
   }
-#if defined(BUILDING_CEF_SHARED)
   static inline base::string16 to_string16(const struct_type* s) {
     cef_string_utf16_t cstr;
     memset(&cstr, 0, sizeof(cstr));
@@ -177,7 +175,6 @@ struct CefStringTraitsUTF8 {
     return cef_string_utf16_to_utf8(str.c_str(), str.length(), s) ?
         true : false;
   }
-#endif  // BUILDING_CEF_SHARED
 };
 
 ///
@@ -245,7 +242,6 @@ struct CefStringTraitsUTF16 {
         true : false;
   }
 #endif  // WCHAR_T_IS_UTF32
-#if defined(BUILDING_CEF_SHARED)
   static inline base::string16 to_string16(const struct_type* s) {
     return base::string16(s->str, s->length);
   }
@@ -253,7 +249,6 @@ struct CefStringTraitsUTF16 {
     return cef_string_utf16_set(str.c_str(), str.length(), s, true) ?
         true : false;
   }
-#endif  // BUILDING_CEF_SHARED
 };
 
 ///
@@ -334,7 +329,7 @@ class CefStringBase {
       FromWString(std::wstring(src));
   }
 
-#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
+#if defined(WCHAR_T_IS_UTF32)
   ///
   // Create a new string from an existing string16. Data will be always
   // copied. Translation will occur if necessary based on the underlying string
@@ -349,7 +344,7 @@ class CefStringBase {
     if (src)
       FromString16(base::string16(src));
   }
-#endif  // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
+#endif  // WCHAR_T_IS_UTF32
 
   ///
   // Create a new string from an existing character array. If |copy| is true
@@ -612,7 +607,7 @@ class CefStringBase {
     AllocIfNeeded();
     return traits::from_wstring(str, string_);
   }
-#if defined(BUILDING_CEF_SHARED)
+
   ///
   // Return this string's data as a string16. Translation will occur if
   // necessary based on the underlying string type.
@@ -636,7 +631,6 @@ class CefStringBase {
     AllocIfNeeded();
     return traits::from_string16(str, string_);
   }
-#endif  // BUILDING_CEF_SHARED
 
   ///
   // Comparison operator overloads.
@@ -689,7 +683,7 @@ class CefStringBase {
     FromWString(std::wstring(str));
     return *this;
   }
-#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
+#if defined(WCHAR_T_IS_UTF32)
   operator base::string16() const {
     return ToString16();
   }
@@ -701,7 +695,18 @@ class CefStringBase {
     FromString16(base::string16(str));
     return *this;
   }
-#endif  // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
+#endif  // WCHAR_T_IS_UTF32
+#if defined(USING_CHROMIUM_INCLUDES)
+  // The base::FilePath constructor is marked as explicit so provide the
+  // conversion here for convenience.
+  operator base::FilePath() const {
+#if defined(OS_WIN)
+    return base::FilePath(ToWString());
+#else
+    return base::FilePath(ToString());
+#endif
+  }
+#endif  // USING_CHROMIUM_INCLUDES
 
  private:
   // Allocate the string structure if it doesn't already exist.