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

Side by Side Diff: chrome/browser/views/confirm_message_box_dialog.h

Issue 270081: Facelifts to sync UI (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ 5 #ifndef CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
6 #define CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ 6 #define CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "app/gfx/native_widget_types.h" 10 #include "app/gfx/native_widget_types.h"
(...skipping 10 matching lines...) Expand all
21 virtual void OnConfirmMessageAccept() = 0; 21 virtual void OnConfirmMessageAccept() = 0;
22 // The user chose not to confirm either by clicking "Cancel" or by closing 22 // The user chose not to confirm either by clicking "Cancel" or by closing
23 // the dialog. 23 // the dialog.
24 virtual void OnConfirmMessageCancel() {} 24 virtual void OnConfirmMessageCancel() {}
25 }; 25 };
26 26
27 class ConfirmMessageBoxDialog : public views::DialogDelegate, 27 class ConfirmMessageBoxDialog : public views::DialogDelegate,
28 public views::View { 28 public views::View {
29 public: 29 public:
30 // The method presents a modal confirmation dialog to the user with the title 30 // The method presents a modal confirmation dialog to the user with the title
31 // |window_title| and message |message_text|. |observer| will be notified 31 // |window_title| and message |message_text|, and 'Yes' 'No' buttons.
32 // when the user makes a decision or closes the dialog. Note that this class 32 // |observer| will be notified when the user makes a decision or closes the
33 // guarantees it will call one of the observer's methods, so it is the 33 // dialog. Note that this class guarantees it will call one of the observer's
34 // caller's responsibility to ensure |observer| lives until one of the 34 // methods, so it is the caller's responsibility to ensure |observer| lives
35 // methods is invoked; it can be deleted thereafter from this class' point 35 // until one of the methods is invoked; it can be deleted thereafter from this
36 // of view. |parent| specifies where to insert the view into the hierarchy 36 // class' point of view. |parent| specifies where to insert the view into the
37 // and effectively assumes ownership of the dialog. 37 // hierarchy and effectively assumes ownership of the dialog.
38 static void Run(gfx::NativeWindow parent, 38 static void Run(gfx::NativeWindow parent,
39 ConfirmMessageBoxObserver* observer, 39 ConfirmMessageBoxObserver* observer,
40 const std::wstring& message_text, 40 const std::wstring& message_text,
41 const std::wstring& window_title); 41 const std::wstring& window_title);
42 42
43 // A variant of the above for when the message text is longer/shorter than
44 // what the default size of this dialog can accommodate.
45 static void RunWithCustomConfiguration(gfx::NativeWindow parent,
46 ConfirmMessageBoxObserver* observer,
47 const std::wstring& message_text,
48 const std::wstring& window_title,
49 const std::wstring& confirm_label,
50 const std::wstring& reject_label,
51 const gfx::Size& preferred_size);
52
43 virtual ~ConfirmMessageBoxDialog() {} 53 virtual ~ConfirmMessageBoxDialog() {}
44 54
45 // views::DialogDelegate implementation. 55 // views::DialogDelegate implementation.
46 virtual int GetDialogButtons() const; 56 virtual int GetDialogButtons() const;
47 virtual std::wstring GetWindowTitle() const; 57 virtual std::wstring GetWindowTitle() const;
48 virtual std::wstring GetDialogButtonLabel( 58 virtual std::wstring GetDialogButtonLabel(
49 MessageBoxFlags::DialogButton button) const; 59 MessageBoxFlags::DialogButton button) const;
60 virtual int GetDefaultDialogButton() const {
61 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
62 }
63
50 virtual bool Accept(); 64 virtual bool Accept();
51 virtual bool Cancel(); 65 virtual bool Cancel();
52 66
53 // views::WindowDelegate implementation. 67 // views::WindowDelegate implementation.
54 virtual bool IsModal() const { return true; } 68 virtual bool IsModal() const { return true; }
55 virtual views::View* GetContentsView() { return this; } 69 virtual views::View* GetContentsView() { return this; }
56 70
57 // views::View implementation. 71 // views::View implementation.
58 virtual void Layout(); 72 virtual void Layout();
59 virtual gfx::Size GetPreferredSize(); 73 virtual gfx::Size GetPreferredSize();
60 74
61 private: 75 private:
62 ConfirmMessageBoxDialog(ConfirmMessageBoxObserver* observer, 76 ConfirmMessageBoxDialog(ConfirmMessageBoxObserver* observer,
63 const std::wstring& message_text, 77 const std::wstring& message_text,
64 const std::wstring& window_title); 78 const std::wstring& window_title);
65 79
66 // The message which will be shown to user. 80 // The message which will be shown to user.
67 views::Label* message_label_; 81 views::Label* message_label_;
68 82
69 // This is the Title bar text. 83 // This is the Title bar text.
70 std::wstring window_title_; 84 std::wstring window_title_;
71 85
86 // The text for the 'OK' and 'CANCEL' buttons.
87 std::wstring confirm_label_;
88 std::wstring reject_label_;
89
90 // The preferred size of the dialog.
91 gfx::Size preferred_size_;
92
72 // The observer to notify of acceptance or cancellation. 93 // The observer to notify of acceptance or cancellation.
73 ConfirmMessageBoxObserver* observer_; 94 ConfirmMessageBoxObserver* observer_;
74 95
75 DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog); 96 DISALLOW_COPY_AND_ASSIGN(ConfirmMessageBoxDialog);
76 }; 97 };
77 98
78 #endif // CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_ 99 #endif // CHROME_BROWSER_VIEWS_CONFIRM_MESSAGE_BOX_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/resources/setup_flow.html ('k') | chrome/browser/views/confirm_message_box_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698