| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 5 #ifndef CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ |
| 6 #define CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 6 #define CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "chrome/views/checkbox.h" | 11 #include "chrome/views/checkbox.h" |
| 12 #include "chrome/views/image_view.h" | 12 #include "chrome/views/image_view.h" |
| 13 #include "chrome/views/label.h" | 13 #include "chrome/views/label.h" |
| 14 #include "chrome/views/text_field.h" | 14 #include "chrome/views/text_field.h" |
| 15 #include "chrome/views/view.h" | 15 #include "chrome/views/view.h" |
| 16 | 16 |
| 17 // This class displays the contents of a message box. It is intended for use | 17 // This class displays the contents of a message box. It is intended for use |
| 18 // within a constrained window, and has options for a message, prompt, OK | 18 // within a constrained window, and has options for a message, prompt, OK |
| 19 // and Cancel buttons. | 19 // and Cancel buttons. |
| 20 class MessageBoxView : public views::View { | 20 class MessageBoxView : public views::View { |
| 21 public: | 21 public: |
| 22 // flags | 22 // flags |
| 23 static const int kFlagHasOKButton = 0x1; | 23 static const int kFlagHasOKButton = 0x1; |
| 24 static const int kFlagHasCancelButton = 0x2; | 24 static const int kFlagHasCancelButton = 0x2; |
| 25 static const int kFlagHasPromptField = 0x4; | 25 static const int kFlagHasPromptField = 0x4; |
| 26 static const int kFlagHasMessage = 0x8; | 26 static const int kFlagHasMessage = 0x8; |
| 27 | 27 |
| 28 // The following flag is used to indicate whether the message's alignment |
| 29 // should be autodetected or inherited from Chrome UI. Callers should pass |
| 30 // the correct flag based on the origin of the message. If the message is |
| 31 // from a web page (such as the JavaScript alert message), its alignment and |
| 32 // directionality are based on the first character with strong directionality |
| 33 // in the message. Chrome UI strings are localized string and therefore they |
| 34 // should have the same alignment and directionality as those of the Chrome |
| 35 // UI. For example, in RTL locales, even though some strings might begin with |
| 36 // an English character, they should still be right aligned and be displayed |
| 37 // Right-To-Left. |
| 38 // |
| 39 // TODO(xji): If the message is from a web page, then the message |
| 40 // directionality should be determined based on the directionality of the web |
| 41 // page. Please refer to http://crbug.com/7166 for more information. |
| 42 static const int kAutoDetectAlignment = 0x10; |
| 43 |
| 28 static const int kIsConfirmMessageBox = kFlagHasMessage | | 44 static const int kIsConfirmMessageBox = kFlagHasMessage | |
| 29 kFlagHasOKButton | | 45 kFlagHasOKButton | |
| 30 kFlagHasCancelButton; | 46 kFlagHasCancelButton; |
| 31 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; | 47 static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; |
| 32 static const int kIsJavascriptConfirm = kIsJavascriptAlert | | 48 static const int kIsJavascriptConfirm = kIsJavascriptAlert | |
| 33 kFlagHasCancelButton; | 49 kFlagHasCancelButton; |
| 34 static const int kIsJavascriptPrompt = kIsJavascriptConfirm | | 50 static const int kIsJavascriptPrompt = kIsJavascriptConfirm | |
| 35 kFlagHasPromptField; | 51 kFlagHasPromptField; |
| 36 | 52 |
| 37 MessageBoxView(int dialog_flags, | 53 MessageBoxView(int dialog_flags, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Maximum width of the message label. | 111 // Maximum width of the message label. |
| 96 int message_width_; | 112 int message_width_; |
| 97 | 113 |
| 98 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; | 114 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; |
| 99 | 115 |
| 100 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); | 116 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); |
| 101 }; | 117 }; |
| 102 | 118 |
| 103 #endif // CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 119 #endif // CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ |
| 104 | 120 |
| OLD | NEW |