blob: 6792601d0be9520218286f33b7a966c6cd3d187e (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright (c) 2009 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.
#ifndef CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
#define CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
#include <string>
#include "base/basictypes.h"
#include "base/gfx/native_widget_types.h"
#include "base/message_loop.h"
#include "views/window/dialog_delegate.h"
class MessageBoxView;
class ConfirmMessageBoxDialog : public views::DialogDelegate,
public MessageLoopForUI::Dispatcher {
public:
// The method blocks while the dialog is showing, and returns the the value
// of the user choice, if the user click in Yes button it returns true,
// otherwise false
static bool Run(gfx::NativeWindow parent,
const std::wstring& message_text,
const std::wstring& window_title);
virtual ~ConfirmMessageBoxDialog();
bool accepted() const { return accepted_; }
// views::DialogDelegate implementation.
virtual int GetDialogButtons() const;
virtual std::wstring GetWindowTitle() const;
virtual std::wstring GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const;
virtual bool Accept();
virtual bool Cancel();
// views::WindowDelegate implementation.
virtual bool IsModal() const { return true; }
virtual views::View* GetContentsView();
virtual void DeleteDelegate();
// MessageLoop::Dispatcher implementation.
virtual bool Dispatch(const MSG& msg);
private:
ConfirmMessageBoxDialog(gfx::NativeWindow parent,
const std::wstring& message_text,
const std::wstring& window_title);
// The message which will be shown to user.
std::wstring message_text_;
// This is the Title bar text.
std::wstring window_title_;
MessageBoxView* message_box_view_;
// Returns true if the user clicks in Yes button, otherwise false
bool accepted_;
// Used to keep track of whether or not to block the message loop (still
// waiting for the user to dismiss the dialog).
bool is_blocking_;
DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog);
};
#endif // CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
|