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

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

Issue 2604793002: Allow Widget to pass accelerator handling to its parent.
Patch Set: Created 3 years, 11 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
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 <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class Window; 59 class Window;
60 } // namespace ui 60 } // namespace ui
61 61
62 namespace views { 62 namespace views {
63 63
64 class DesktopWindowTreeHost; 64 class DesktopWindowTreeHost;
65 class NativeWidget; 65 class NativeWidget;
66 class NonClientFrameView; 66 class NonClientFrameView;
67 class TooltipManager; 67 class TooltipManager;
68 class View; 68 class View;
69 class WidgetAcceleratorHandlingDelegate;
69 class WidgetDelegate; 70 class WidgetDelegate;
70 class WidgetObserver; 71 class WidgetObserver;
71 class WidgetRemovalsObserver; 72 class WidgetRemovalsObserver;
72 73
73 namespace internal { 74 namespace internal {
74 class NativeWidgetPrivate; 75 class NativeWidgetPrivate;
75 class RootView; 76 class RootView;
76 } 77 }
77 78
78 //////////////////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////////////////
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 std::string wm_class_class; 283 std::string wm_class_class;
283 284
284 // If true then the widget uses software compositing. Defaults to false. 285 // If true then the widget uses software compositing. Defaults to false.
285 // Only used on Windows. 286 // Only used on Windows.
286 bool force_software_compositing; 287 bool force_software_compositing;
287 288
288 // Used if widget is not activatable to do determine if mouse events should 289 // Used if widget is not activatable to do determine if mouse events should
289 // be sent to the widget. 290 // be sent to the widget.
290 bool wants_mouse_events_when_inactive = false; 291 bool wants_mouse_events_when_inactive = false;
291 292
293 bool pass_accelerator_to_parent = false;
294
292 // A map of properties applied to windows when running in mus. 295 // A map of properties applied to windows when running in mus.
293 std::map<std::string, std::vector<uint8_t>> mus_properties; 296 std::map<std::string, std::vector<uint8_t>> mus_properties;
294 }; 297 };
295 298
296 Widget(); 299 Widget();
297 ~Widget() override; 300 ~Widget() override;
298 301
299 // Creates a decorated window Widget with the specified properties. The 302 // Creates a decorated window Widget with the specified properties. The
300 // returned Widget is owned by its NativeWidget; see Widget class comment for 303 // returned Widget is owned by its NativeWidget; see Widget class comment for
301 // details. 304 // details.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 387
385 // Add/remove removals observer. 388 // Add/remove removals observer.
386 void AddRemovalsObserver(WidgetRemovalsObserver* observer); 389 void AddRemovalsObserver(WidgetRemovalsObserver* observer);
387 void RemoveRemovalsObserver(WidgetRemovalsObserver* observer); 390 void RemoveRemovalsObserver(WidgetRemovalsObserver* observer);
388 bool HasRemovalsObserver(const WidgetRemovalsObserver* observer) const; 391 bool HasRemovalsObserver(const WidgetRemovalsObserver* observer) const;
389 392
390 // Returns the accelerator given a command id. Returns false if there is 393 // Returns the accelerator given a command id. Returns false if there is
391 // no accelerator associated with a given id, which is a common condition. 394 // no accelerator associated with a given id, which is a common condition.
392 virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const; 395 virtual bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const;
393 396
397 bool CanHandleAccelerators() const;
398 void AddHandleAcceleratorsOverride();
399 void RemoveHandleAcceleratorsOverride();
400
394 // Forwarded from the RootView so that the widget can do any cleanup. 401 // Forwarded from the RootView so that the widget can do any cleanup.
395 void ViewHierarchyChanged(const View::ViewHierarchyChangedDetails& details); 402 void ViewHierarchyChanged(const View::ViewHierarchyChangedDetails& details);
396 403
397 // Called right before changing the widget's parent NativeView to do any 404 // Called right before changing the widget's parent NativeView to do any
398 // cleanup. 405 // cleanup.
399 void NotifyNativeViewHierarchyWillChange(); 406 void NotifyNativeViewHierarchyWillChange();
400 407
401 // Called after changing the widget's parent NativeView. Notifies the RootView 408 // Called after changing the widget's parent NativeView. Notifies the RootView
402 // about the change. 409 // about the change.
403 void NotifyNativeViewHierarchyChanged(); 410 void NotifyNativeViewHierarchyChanged();
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 // See description in GetRootLayers(). 969 // See description in GetRootLayers().
963 std::vector<ui::Layer*> root_layers_; 970 std::vector<ui::Layer*> root_layers_;
964 971
965 // Is |root_layers_| out of date? 972 // Is |root_layers_| out of date?
966 bool root_layers_dirty_; 973 bool root_layers_dirty_;
967 974
968 // True when window movement via mouse interaction with the frame should be 975 // True when window movement via mouse interaction with the frame should be
969 // disabled. 976 // disabled.
970 bool movement_disabled_; 977 bool movement_disabled_;
971 978
979 std::unique_ptr<WidgetAcceleratorHandlingDelegate>
980 accelerator_handling_delegate_;
981 int handle_accelerators_override_count_ = 0;
982
972 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_; 983 ScopedObserver<ui::NativeTheme, ui::NativeThemeObserver> observer_manager_;
973 984
974 DISALLOW_COPY_AND_ASSIGN(Widget); 985 DISALLOW_COPY_AND_ASSIGN(Widget);
975 }; 986 };
976 987
977 } // namespace views 988 } // namespace views
978 989
979 #endif // UI_VIEWS_WIDGET_WIDGET_H_ 990 #endif // UI_VIEWS_WIDGET_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698