summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 23:50:13 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-24 23:50:13 +0000
commit3cdb6ccdf63f89eab14261534c895c9a25b0e6ea (patch)
tree7433931603aadf6836d291aabf10f6e71983e53b /chrome/common
parent226558c339b10721fd3266048a8f0ecb65c13605 (diff)
downloadchromium_src-3cdb6ccdf63f89eab14261534c895c9a25b0e6ea.zip
chromium_src-3cdb6ccdf63f89eab14261534c895c9a25b0e6ea.tar.gz
chromium_src-3cdb6ccdf63f89eab14261534c895c9a25b0e6ea.tar.bz2
Move windows specific functions from l10n_util.h to l10n_util_win.h.
Review URL: http://codereview.chromium.org/27103 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10307 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/common.vcproj8
-rw-r--r--chrome/common/l10n_util.cc25
-rw-r--r--chrome/common/l10n_util.h22
-rw-r--r--chrome/common/l10n_util_win.cc31
-rw-r--r--chrome/common/l10n_util_win.h28
5 files changed, 67 insertions, 47 deletions
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index 2e91a0d..100f0b7 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -506,6 +506,14 @@
>
</File>
<File
+ RelativePath=".\l10n_util_win.cc"
+ >
+ </File>
+ <File
+ RelativePath=".\l10n_util_win.h"
+ >
+ </File>
+ <File
RelativePath=".\libxml_utils.cc"
>
</File>
diff --git a/chrome/common/l10n_util.cc b/chrome/common/l10n_util.cc
index c576a4b..9fcee980 100644
--- a/chrome/common/l10n_util.cc
+++ b/chrome/common/l10n_util.cc
@@ -614,31 +614,6 @@ int DefaultCanvasTextAlignment() {
}
}
-#if defined(OS_WIN)
-int GetExtendedStyles() {
- return GetTextDirection() == LEFT_TO_RIGHT ? 0 :
- WS_EX_LAYOUTRTL | WS_EX_RTLREADING;
-}
-
-int GetExtendedTooltipStyles() {
- return GetTextDirection() == LEFT_TO_RIGHT ? 0 : WS_EX_LAYOUTRTL;
-}
-
-void HWNDSetRTLLayout(HWND hwnd) {
- DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
-
- // We don't have to do anything if the style is already set for the HWND.
- if (!(ex_style & WS_EX_LAYOUTRTL)) {
- ex_style |= WS_EX_LAYOUTRTL;
- ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
-
- // Right-to-left layout changes are not applied to the window immediately
- // so we should make sure a WM_PAINT is sent to the window by invalidating
- // the entire window rect.
- ::InvalidateRect(hwnd, NULL, true);
- }
-}
-#endif // defined(OS_WIN)
// Compares the character data stored in two different strings by specified
// Collator instance.
diff --git a/chrome/common/l10n_util.h b/chrome/common/l10n_util.h
index 51160cd..480c1bd 100644
--- a/chrome/common/l10n_util.h
+++ b/chrome/common/l10n_util.h
@@ -10,9 +10,6 @@
#include "build/build_config.h"
-#if defined(OS_WIN)
-#include <windows.h>
-#endif
#include <algorithm>
#include <functional>
#include <string>
@@ -172,17 +169,6 @@ void WrapStringWithRTLFormatting(std::wstring* text);
void WrapPathWithLTRFormatting(const FilePath& path,
string16* rtl_safe_path);
-// Returns the locale-dependent extended window styles.
-// This function is used for adding locale-dependent extended window styles
-// (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window.
-// Callers should OR this value into their extended style value when creating
-// a window.
-int GetExtendedStyles();
-
-// TODO(xji):
-// This is a temporary name, it will eventually replace GetExtendedStyles
-int GetExtendedTooltipStyles();
-
// Returns the default text alignment to be used when drawing text on a
// ChromeCanvas based on the directionality of the system locale language. This
// function is used by ChromeCanvas::DrawStringInt when the text alignment is
@@ -192,14 +178,6 @@ int GetExtendedTooltipStyles();
// ChromeCanvas::TEXT_ALIGN_RIGHT.
int DefaultCanvasTextAlignment();
-#if defined(OS_WIN)
-// Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the
-// underlying window. When this style is set, the UI for the window is going to
-// be mirrored. This is generally done for the UI of right-to-left languages
-// such as Hebrew.
-void HWNDSetRTLLayout(HWND hwnd);
-#endif
-
// Compares the two strings using the specified collator.
UCollationResult CompareStringWithCollator(const Collator* collator,
const std::wstring& lhs,
diff --git a/chrome/common/l10n_util_win.cc b/chrome/common/l10n_util_win.cc
new file mode 100644
index 0000000..5d85951
--- /dev/null
+++ b/chrome/common/l10n_util_win.cc
@@ -0,0 +1,31 @@
+#include "chrome/common/l10n_util.h"
+#include "chrome/common/l10n_util_win.h"
+
+namespace l10n_util {
+
+int GetExtendedStyles() {
+ return GetTextDirection() == LEFT_TO_RIGHT ? 0 :
+ WS_EX_LAYOUTRTL | WS_EX_RTLREADING;
+}
+
+int GetExtendedTooltipStyles() {
+ return GetTextDirection() == LEFT_TO_RIGHT ? 0 : WS_EX_LAYOUTRTL;
+}
+
+void HWNDSetRTLLayout(HWND hwnd) {
+ DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
+
+ // We don't have to do anything if the style is already set for the HWND.
+ if (!(ex_style & WS_EX_LAYOUTRTL)) {
+ ex_style |= WS_EX_LAYOUTRTL;
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
+
+ // Right-to-left layout changes are not applied to the window immediately
+ // so we should make sure a WM_PAINT is sent to the window by invalidating
+ // the entire window rect.
+ ::InvalidateRect(hwnd, NULL, true);
+ }
+}
+
+} // namespace l10n_util
+
diff --git a/chrome/common/l10n_util_win.h b/chrome/common/l10n_util_win.h
new file mode 100644
index 0000000..733cc2b
--- /dev/null
+++ b/chrome/common/l10n_util_win.h
@@ -0,0 +1,28 @@
+#ifndef CHROME_COMMON_L10N_UTIL_WIN_H_
+#define CHROME_COMMON_L10N_UTIL_WIN_H_
+
+#include <windows.h>
+
+namespace l10n_util {
+
+// Returns the locale-dependent extended window styles.
+// This function is used for adding locale-dependent extended window styles
+// (e.g. WS_EX_LAYOUTRTL, WS_EX_RTLREADING, etc.) when creating a window.
+// Callers should OR this value into their extended style value when creating
+// a window.
+int GetExtendedStyles();
+
+// TODO(xji):
+// This is a temporary name, it will eventually replace GetExtendedStyles
+int GetExtendedTooltipStyles();
+
+// Give an HWND, this function sets the WS_EX_LAYOUTRTL extended style for the
+// underlying window. When this style is set, the UI for the window is going to
+// be mirrored. This is generally done for the UI of right-to-left languages
+// such as Hebrew.
+void HWNDSetRTLLayout(HWND hwnd);
+
+} // namespace l10n_util
+
+#endif // CHROME_COMMON_L10N_UTIL_WIN_H_
+