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

Side by Side Diff: chrome/browser/ui/views/simple_message_box_win.cc

Issue 172633004: Refactor Windows MessageBox fallback code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « chrome/browser/ui/views/simple_message_box_win.h ('k') | chrome/chrome_browser_ui.gypi » ('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) 2012 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 "chrome/browser/ui/simple_message_box.h"
6
7 #include "ui/base/win/message_box_win.h"
8
9 namespace chrome {
10
11 MessageBoxResult NativeShowMessageBox(HWND parent,
12 const base::string16& title,
13 const base::string16& message,
14 MessageBoxType type) {
15 UINT flags = MB_SETFOREGROUND;
16 if (type == MESSAGE_BOX_TYPE_QUESTION) {
17 flags |= MB_YESNO;
18 } else if (type == MESSAGE_BOX_TYPE_OK_CANCEL) {
19 flags |= MB_OKCANCEL;
20 } else {
21 flags |= MB_OK;
22 }
23 flags |= ((type == MESSAGE_BOX_TYPE_INFORMATION) ?
24 MB_ICONINFORMATION : MB_ICONWARNING);
25 int result = ui::MessageBox(parent, message, title, flags);
26 return (result == IDYES || result == IDOK) ?
27 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO;
28 }
29
30 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/simple_message_box_win.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698