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.
5 #include "chrome/browser/ui/simple_message_box.h"
7 #include "ui/base/win/message_box_win.h"
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
) {
18 } else if (type
== MESSAGE_BOX_TYPE_OK_CANCEL
) {
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
;