Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: ui/base/message_box_win.cc

Issue 9669028: ui/base: Move message_box_win.{h,cc} to ui/base/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep sorted Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/message_box_win.h ('k') | ui/base/ui_base_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/base/message_box_win.h"
6
7 #include <windows.h>
8
9 #include "base/base_switches.h"
10 #include "base/command_line.h"
11 #include "base/i18n/rtl.h"
12 #include "base/string16.h"
13
14 namespace ui {
15
16 // In addition to passing the RTL flags to ::MessageBox if we are running in an
17 // RTL locale, we need to make sure that LTR strings are rendered correctly by
18 // adding the appropriate Unicode directionality marks.
19 int MessageBox(HWND hwnd,
20 const string16& text,
21 const string16& caption,
22 UINT flags) {
23 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoMessageBox))
24 return IDOK;
25
26 UINT actual_flags = flags;
27 if (base::i18n::IsRTL())
28 actual_flags |= MB_RIGHT | MB_RTLREADING;
29
30 string16 localized_text = text;
31 base::i18n::AdjustStringForLocaleDirection(&localized_text);
32 const wchar_t* text_ptr = localized_text.c_str();
33
34 string16 localized_caption = caption;
35 base::i18n::AdjustStringForLocaleDirection(&localized_caption);
36 const wchar_t* caption_ptr = localized_caption.c_str();
37
38 return ::MessageBox(hwnd, text_ptr, caption_ptr, actual_flags);
39 }
40
41 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/message_box_win.h ('k') | ui/base/ui_base_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698