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

Side by Side Diff: ui/views/widget/widget.h

Issue 286733002: [Refactor] Consolidate the logic for whether a widget can be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « ui/views/widget/native_widget_aura_unittest.cc ('k') | ui/views/widget/widget.cc » ('j') | 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 #ifndef UI_VIEWS_WIDGET_WIDGET_H_ 5 #ifndef UI_VIEWS_WIDGET_WIDGET_H_
6 #define UI_VIEWS_WIDGET_WIDGET_H_ 6 #define UI_VIEWS_WIDGET_WIDGET_H_
7 7
8 #include <set> 8 #include <set>
9 #include <stack> 9 #include <stack>
10 #include <vector> 10 #include <vector>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // Infer fully opaque or not. For WinAura, top-level windows that are not 155 // Infer fully opaque or not. For WinAura, top-level windows that are not
156 // of TYPE_WINDOW are translucent so that they can be made to fade in. In 156 // of TYPE_WINDOW are translucent so that they can be made to fade in. In
157 // all other cases, windows are fully opaque. 157 // all other cases, windows are fully opaque.
158 INFER_OPACITY, 158 INFER_OPACITY,
159 // Fully opaque. 159 // Fully opaque.
160 OPAQUE_WINDOW, 160 OPAQUE_WINDOW,
161 // Possibly translucent/transparent. 161 // Possibly translucent/transparent.
162 TRANSLUCENT_WINDOW, 162 TRANSLUCENT_WINDOW,
163 }; 163 };
164 164
165 enum Activatable {
166 // Infer whether the window should be activatable from the window type.
167 ACTIVATABLE_DEFAULT,
168
169 ACTIVATABLE_YES,
170 ACTIVATABLE_NO
171 };
172
165 enum Ownership { 173 enum Ownership {
166 // Default. Creator is not responsible for managing the lifetime of the 174 // Default. Creator is not responsible for managing the lifetime of the
167 // Widget, it is destroyed when the corresponding NativeWidget is 175 // Widget, it is destroyed when the corresponding NativeWidget is
168 // destroyed. 176 // destroyed.
169 NATIVE_WIDGET_OWNS_WIDGET, 177 NATIVE_WIDGET_OWNS_WIDGET,
170 // Used when the Widget is owned by someone other than the NativeWidget, 178 // Used when the Widget is owned by someone other than the NativeWidget,
171 // e.g. a scoped_ptr in tests. 179 // e.g. a scoped_ptr in tests.
172 WIDGET_OWNS_NATIVE_WIDGET 180 WIDGET_OWNS_NATIVE_WIDGET
173 }; 181 };
174 182
175 InitParams(); 183 InitParams();
176 explicit InitParams(Type type); 184 explicit InitParams(Type type);
177 ~InitParams(); 185 ~InitParams();
178 186
179 Type type; 187 Type type;
180 // If NULL, a default implementation will be constructed. 188 // If NULL, a default implementation will be constructed.
181 WidgetDelegate* delegate; 189 WidgetDelegate* delegate;
182 bool child; 190 bool child;
183 // If TRANSLUCENT_WINDOW, the widget may be fully or partially transparent. 191 // If TRANSLUCENT_WINDOW, the widget may be fully or partially transparent.
184 // If OPAQUE_WINDOW, we can perform optimizations based on the widget being 192 // If OPAQUE_WINDOW, we can perform optimizations based on the widget being
185 // fully opaque. Defaults to TRANSLUCENT_WINDOW if 193 // fully opaque. Defaults to TRANSLUCENT_WINDOW if
186 // ViewsDelegate::UseTransparentWindows(). Defaults to OPAQUE_WINDOW for 194 // ViewsDelegate::UseTransparentWindows(). Defaults to OPAQUE_WINDOW for
187 // non-window widgets. 195 // non-window widgets.
188 WindowOpacity opacity; 196 WindowOpacity opacity;
189 bool accept_events; 197 bool accept_events;
190 bool can_activate; 198 Activatable activatable;
191 bool keep_on_top; 199 bool keep_on_top;
192 bool visible_on_all_workspaces; 200 bool visible_on_all_workspaces;
193 Ownership ownership; 201 Ownership ownership;
194 bool mirror_origin_in_rtl; 202 bool mirror_origin_in_rtl;
195 bool has_dropshadow; 203 bool has_dropshadow;
196 // Specifies that the system default caption and icon should not be 204 // Specifies that the system default caption and icon should not be
197 // rendered, and that the client area should be equivalent to the window 205 // rendered, and that the client area should be equivalent to the window
198 // area. Only used on some platforms (Windows and Linux). 206 // area. Only used on some platforms (Windows and Linux).
199 bool remove_standard_frame; 207 bool remove_standard_frame;
200 // Only used by ShellWindow on Windows. Specifies that the default icon of 208 // Only used by ShellWindow on Windows. Specifies that the default icon of
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 bool widget_closed_; 875 bool widget_closed_;
868 876
869 // The saved "show" state for this window. See note in SetInitialBounds 877 // The saved "show" state for this window. See note in SetInitialBounds
870 // that explains why we save this. 878 // that explains why we save this.
871 ui::WindowShowState saved_show_state_; 879 ui::WindowShowState saved_show_state_;
872 880
873 // The restored bounds used for the initial show. This is only used if 881 // The restored bounds used for the initial show. This is only used if
874 // |saved_show_state_| is maximized. 882 // |saved_show_state_| is maximized.
875 gfx::Rect initial_restored_bounds_; 883 gfx::Rect initial_restored_bounds_;
876 884
885 // True if the widget can be activated.
886 bool can_activate_;
887
877 // Focus is automatically set to the view provided by the delegate 888 // Focus is automatically set to the view provided by the delegate
878 // when the widget is shown. Set this value to false to override 889 // when the widget is shown. Set this value to false to override
879 // initial focus for the widget. 890 // initial focus for the widget.
880 bool focus_on_creation_; 891 bool focus_on_creation_;
881 892
882 mutable scoped_ptr<InputMethod> input_method_; 893 mutable scoped_ptr<InputMethod> input_method_;
883 894
884 // See |is_top_level()| accessor. 895 // See |is_top_level()| accessor.
885 bool is_top_level_; 896 bool is_top_level_;
886 897
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 bool movement_disabled_; 930 bool movement_disabled_;
920 931
921 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; 932 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_;
922 933
923 DISALLOW_COPY_AND_ASSIGN(Widget); 934 DISALLOW_COPY_AND_ASSIGN(Widget);
924 }; 935 };
925 936
926 } // namespace views 937 } // namespace views
927 938
928 #endif // UI_VIEWS_WIDGET_WIDGET_H_ 939 #endif // UI_VIEWS_WIDGET_WIDGET_H_
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura_unittest.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698