OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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 #ifndef CHROME_COMMON_MESSAGE_BOX_FLAGS_H_ | |
6 #define CHROME_COMMON_MESSAGE_BOX_FLAGS_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 | |
10 // This class contains flags used to communicate the type of message box | |
11 // to show. E.g., the renderer can request the browser to show a | |
12 // javascript alert or a javascript confirm message. | |
13 class MessageBoxFlags { | |
14 public: | |
15 static const int kFlagHasOKButton = 0x1; | |
16 static const int kFlagHasCancelButton = 0x2; | |
17 static const int kFlagHasPromptField = 0x4; | |
18 static const int kFlagHasMessage = 0x8; | |
19 | |
20 // The following flag is used to indicate whether the message's alignment | |
21 // should be autodetected or inherited from Chrome UI. Callers should pass | |
22 // the correct flag based on the origin of the message. If the message is | |
23 // from a web page (such as the JavaScript alert message), its alignment and | |
24 // directionality are based on the first character with strong directionality | |
25 // in the message. Chrome UI strings are localized string and therefore they | |
26 // should have the same alignment and directionality as those of the Chrome | |
27 // UI. For example, in RTL locales, even though some strings might begin with | |
28 // an English character, they should still be right aligned and be displayed | |
29 // Right-To-Left. | |
30 // | |
31 // TODO(xji): If the message is from a web page, then the message | |
32 // directionality should be determined based on the directionality of the web | |
33 // page. Please refer to http://crbug.com/7166 for more information. | |
34 static const int kAutoDetectAlignment = 0x10; | |
35 | |
36 static const int kIsConfirmMessageBox = kFlagHasMessage | | |
37 kFlagHasOKButton | | |
38 kFlagHasCancelButton; | |
39 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; | |
40 static const int kIsJavascriptConfirm = kIsJavascriptAlert | | |
41 kFlagHasCancelButton; | |
42 static const int kIsJavascriptPrompt = kIsJavascriptConfirm | | |
43 kFlagHasPromptField; | |
44 | |
45 // Dialog button identifiers used to specify which buttons to show the user. | |
46 enum DialogButton { | |
47 DIALOGBUTTON_NONE = 0, // No dialog buttons, for WindowType == WINDOW. | |
48 DIALOGBUTTON_OK = 1, // Has an OK button. | |
49 DIALOGBUTTON_CANCEL = 2, // Has a Cancel button (becomes a Close button if | |
50 }; // no OK button). | |
51 | |
52 private: | |
53 MessageBoxFlags() {} | |
54 DISALLOW_COPY_AND_ASSIGN(MessageBoxFlags); | |
55 }; | |
56 | |
57 #endif // CHROME_COMMON_MESSAGE_BOX_FLAGS_H_ | |
OLD | NEW |