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

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

Issue 161803002: Remove Non-Aura Win ShowMessageBox. (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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/simple_message_box.h" 5 #include "chrome/browser/ui/simple_message_box.h"
6 6
7 #include "components/startup_metric_utils/startup_metric_utils.h"
8 #include "ui/base/win/message_box_win.h" 7 #include "ui/base/win/message_box_win.h"
9 #include "ui/gfx/win/hwnd_util.h"
10 8
11 namespace chrome { 9 namespace chrome {
12 10
13 MessageBoxResult NativeShowMessageBox(HWND parent, 11 MessageBoxResult NativeShowMessageBox(HWND parent,
14 const base::string16& title, 12 const base::string16& title,
15 const base::string16& message, 13 const base::string16& message,
16 MessageBoxType type) { 14 MessageBoxType type) {
17 UINT flags = MB_SETFOREGROUND; 15 UINT flags = MB_SETFOREGROUND;
18 if (type == MESSAGE_BOX_TYPE_QUESTION) { 16 if (type == MESSAGE_BOX_TYPE_QUESTION) {
19 flags |= MB_YESNO; 17 flags |= MB_YESNO;
20 } else if (type == MESSAGE_BOX_TYPE_OK_CANCEL) { 18 } else if (type == MESSAGE_BOX_TYPE_OK_CANCEL) {
21 flags |= MB_OKCANCEL; 19 flags |= MB_OKCANCEL;
22 } else { 20 } else {
23 flags |= MB_OK; 21 flags |= MB_OK;
24 } 22 }
25 flags |= ((type == MESSAGE_BOX_TYPE_INFORMATION) ? 23 flags |= ((type == MESSAGE_BOX_TYPE_INFORMATION) ?
26 MB_ICONINFORMATION : MB_ICONWARNING); 24 MB_ICONINFORMATION : MB_ICONWARNING);
27 int result = ui::MessageBox(parent, message, title, flags); 25 int result = ui::MessageBox(parent, message, title, flags);
28 return (result == IDYES || result == IDOK) ? 26 return (result == IDYES || result == IDOK) ?
29 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; 27 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO;
30 } 28 }
31 29
32 #if !defined(USE_AURA)
33 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent,
34 const base::string16& title,
35 const base::string16& message,
36 MessageBoxType type) {
37 startup_metric_utils::SetNonBrowserUIDisplayed();
38
39 if (!parent)
40 parent = gfx::GetWindowToParentTo(true);
41
42 return NativeShowMessageBox(parent, title, message, type);
43 }
44 #endif
45
46 } // namespace chrome 30 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698