summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/simple_message_box_win.cc
blob: 3df894c37bb701154c8233b4063a784ef472b3aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/simple_message_box.h"

#include "ui/base/win/message_box_win.h"

namespace browser {

void ShowMessageBox(gfx::NativeWindow parent,
                    const string16& title,
                    const string16& message,
                    MessageBoxType type) {
  UINT flags = MB_OK | MB_SETFOREGROUND | MB_TOPMOST;
  if (type == MESSAGE_BOX_TYPE_WARNING)
    flags |= MB_ICONWARNING;
  else
    flags |= MB_ICONINFORMATION;
  ui::MessageBox(parent, message, title, flags);
}

bool ShowQuestionMessageBox(gfx::NativeWindow parent,
                            const string16& title,
                            const string16& message) {
  const UINT flags = MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND;
  return ui::MessageBox(parent, message, title, flags) == IDYES;
}

}  // namespace browser