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

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

Issue 2108793002: mash: Convert system tray logout button to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more review comments, fix mash_unittests Created 4 years, 5 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
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/window/dialog_delegate.h" 5 #include "ui/views/window/dialog_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 19 matching lines...) Expand all
30 // DialogDelegate: 30 // DialogDelegate:
31 31
32 DialogDelegate::DialogDelegate() : supports_custom_frame_(true) {} 32 DialogDelegate::DialogDelegate() : supports_custom_frame_(true) {}
33 33
34 DialogDelegate::~DialogDelegate() {} 34 DialogDelegate::~DialogDelegate() {}
35 35
36 // static 36 // static
37 Widget* DialogDelegate::CreateDialogWidget(WidgetDelegate* delegate, 37 Widget* DialogDelegate::CreateDialogWidget(WidgetDelegate* delegate,
38 gfx::NativeWindow context, 38 gfx::NativeWindow context,
39 gfx::NativeView parent) { 39 gfx::NativeView parent) {
40 return CreateDialogWidgetWithBounds(delegate, context, parent, gfx::Rect()); 40 views::Widget* widget = new views::Widget;
41 views::Widget::InitParams params =
42 GetDialogWidgetInitParams(delegate, context, parent, gfx::Rect());
43 widget->Init(params);
44 return widget;
41 } 45 }
42 46
43 // static 47 // static
44 Widget* DialogDelegate::CreateDialogWidgetWithBounds(WidgetDelegate* delegate, 48 Widget::InitParams DialogDelegate::GetDialogWidgetInitParams(
45 gfx::NativeWindow context, 49 WidgetDelegate* delegate,
46 gfx::NativeView parent, 50 gfx::NativeWindow context,
47 const gfx::Rect& bounds) { 51 gfx::NativeView parent,
48 views::Widget* widget = new views::Widget; 52 const gfx::Rect& bounds) {
49 views::Widget::InitParams params; 53 views::Widget::InitParams params;
50 params.delegate = delegate; 54 params.delegate = delegate;
51 params.bounds = bounds; 55 params.bounds = bounds;
52 DialogDelegate* dialog = delegate->AsDialogDelegate(); 56 DialogDelegate* dialog = delegate->AsDialogDelegate();
53 57
54 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 58 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
55 // The new style doesn't support unparented dialogs on Linux desktop. 59 // The new style doesn't support unparented dialogs on Linux desktop.
56 if (dialog) 60 if (dialog)
57 dialog->supports_custom_frame_ &= parent != NULL; 61 dialog->supports_custom_frame_ &= parent != NULL;
58 #elif defined(OS_WIN) 62 #elif defined(OS_WIN)
(...skipping 14 matching lines...) Expand all
73 params.context = context; 77 params.context = context;
74 params.parent = parent; 78 params.parent = parent;
75 #if !defined(OS_MACOSX) 79 #if !defined(OS_MACOSX)
76 // Web-modal (ui::MODAL_TYPE_CHILD) dialogs with parents are marked as child 80 // Web-modal (ui::MODAL_TYPE_CHILD) dialogs with parents are marked as child
77 // widgets to prevent top-level window behavior (independent movement, etc). 81 // widgets to prevent top-level window behavior (independent movement, etc).
78 // On Mac, however, the parent may be a native window (not a views::Widget), 82 // On Mac, however, the parent may be a native window (not a views::Widget),
79 // and so the dialog must be considered top-level to gain focus and input 83 // and so the dialog must be considered top-level to gain focus and input
80 // method behaviors. 84 // method behaviors.
81 params.child = parent && (delegate->GetModalType() == ui::MODAL_TYPE_CHILD); 85 params.child = parent && (delegate->GetModalType() == ui::MODAL_TYPE_CHILD);
82 #endif 86 #endif
83 widget->Init(params); 87 return params;
84 return widget;
85 } 88 }
86 89
87 View* DialogDelegate::CreateExtraView() { 90 View* DialogDelegate::CreateExtraView() {
88 return NULL; 91 return NULL;
89 } 92 }
90 93
91 bool DialogDelegate::GetExtraViewPadding(int* padding) { 94 bool DialogDelegate::GetExtraViewPadding(int* padding) {
92 return false; 95 return false;
93 } 96 }
94 97
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 state->role = ui::AX_ROLE_DIALOG; 253 state->role = ui::AX_ROLE_DIALOG;
251 } 254 }
252 255
253 void DialogDelegateView::ViewHierarchyChanged( 256 void DialogDelegateView::ViewHierarchyChanged(
254 const ViewHierarchyChangedDetails& details) { 257 const ViewHierarchyChangedDetails& details) {
255 if (details.is_add && details.child == this && GetWidget()) 258 if (details.is_add && details.child == this && GetWidget())
256 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 259 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
257 } 260 }
258 261
259 } // namespace views 262 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698