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

Side by Side Diff: views/window/dialog_delegate.cc

Issue 6622002: Do all OOLing in the views code. linux_views now builds clean with the clang plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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) 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 #include "views/window/dialog_delegate.h" 5 #include "views/window/dialog_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "views/controls/button/native_button.h" 8 #include "views/controls/button/native_button.h"
9 #include "views/window/window.h" 9 #include "views/window/window.h"
10 10
11 namespace views { 11 namespace views {
12 12
13 // Overridden from WindowDelegate: 13 // Overridden from WindowDelegate:
14 14
15 DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; }
16
17 int DialogDelegate::GetDialogButtons() const {
18 return ui::MessageBoxFlags::DIALOGBUTTON_OK |
19 ui::MessageBoxFlags::DIALOGBUTTON_CANCEL;
20 }
21
22 bool DialogDelegate::AreAcceleratorsEnabled(
23 ui::MessageBoxFlags::DialogButton button) {
24 return true;
25 }
26
27 std::wstring DialogDelegate::GetDialogButtonLabel(
28 ui::MessageBoxFlags::DialogButton button) const {
29 // empty string results in defaults for
30 // ui::MessageBoxFlags::DIALOGBUTTON_OK,
31 // ui::MessageBoxFlags::DIALOGBUTTON_CANCEL.
32 return L"";
33 }
34
35 View* DialogDelegate::GetExtraView() {
36 return NULL;
37 }
38
39 bool DialogDelegate::GetSizeExtraViewHeightToButtons() {
40 return false;
41 }
42
15 int DialogDelegate::GetDefaultDialogButton() const { 43 int DialogDelegate::GetDefaultDialogButton() const {
16 if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_OK) 44 if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_OK)
17 return MessageBoxFlags::DIALOGBUTTON_OK; 45 return MessageBoxFlags::DIALOGBUTTON_OK;
18 if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_CANCEL) 46 if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_CANCEL)
19 return MessageBoxFlags::DIALOGBUTTON_CANCEL; 47 return MessageBoxFlags::DIALOGBUTTON_CANCEL;
20 return MessageBoxFlags::DIALOGBUTTON_NONE; 48 return MessageBoxFlags::DIALOGBUTTON_NONE;
21 } 49 }
22 50
51 bool DialogDelegate::IsDialogButtonEnabled(
52 ui::MessageBoxFlags::DialogButton button) const {
53 return true;
54 }
55
56 bool DialogDelegate::IsDialogButtonVisible(
57 ui::MessageBoxFlags::DialogButton button) const {
58 return true;
59 }
60
61 bool DialogDelegate::Cancel() {
62 return true;
63 }
64
65 bool DialogDelegate::Accept(bool window_closiang) {
66 return Accept();
67 }
68
69 bool DialogDelegate::Accept() {
70 return true;
71 }
72
23 View* DialogDelegate::GetInitiallyFocusedView() { 73 View* DialogDelegate::GetInitiallyFocusedView() {
24 // Focus the default button if any. 74 // Focus the default button if any.
25 DialogClientView* dcv = GetDialogClientView(); 75 DialogClientView* dcv = GetDialogClientView();
26 int default_button = GetDefaultDialogButton(); 76 int default_button = GetDefaultDialogButton();
27 if (default_button == MessageBoxFlags::DIALOGBUTTON_NONE) 77 if (default_button == MessageBoxFlags::DIALOGBUTTON_NONE)
28 return NULL; 78 return NULL;
29 79
30 if ((default_button & GetDialogButtons()) == 0) { 80 if ((default_button & GetDialogButtons()) == 0) {
31 // The default button is a button we don't have. 81 // The default button is a button we don't have.
32 NOTREACHED(); 82 NOTREACHED();
(...skipping 11 matching lines...) Expand all
44 return new DialogClientView(window, GetContentsView()); 94 return new DialogClientView(window, GetContentsView());
45 } 95 }
46 96
47 DialogClientView* DialogDelegate::GetDialogClientView() const { 97 DialogClientView* DialogDelegate::GetDialogClientView() const {
48 ClientView* client_view = window()->GetClientView(); 98 ClientView* client_view = window()->GetClientView();
49 DialogClientView* dialog_client_view = client_view->AsDialogClientView(); 99 DialogClientView* dialog_client_view = client_view->AsDialogClientView();
50 DCHECK(dialog_client_view); 100 DCHECK(dialog_client_view);
51 return dialog_client_view; 101 return dialog_client_view;
52 } 102 }
53 103
104 AccessibilityTypes::Role DialogDelegate::accessible_role() const {
105 return AccessibilityTypes::ROLE_DIALOG;
106 }
107
54 } // namespace views 108 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698