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

Unified Diff: trunk/src/ui/views/widget/widget.cc

Issue 291013003: Revert 271468 "Revert of [Refactor] Consolidate the logic for wh..." (Closed) Base URL: svn://svn.chromium.org/chrome/
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/ui/views/widget/widget.h ('k') | trunk/src/ui/views/widget/widget_hwnd_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/ui/views/widget/widget.cc
===================================================================
--- trunk/src/ui/views/widget/widget.cc (revision 271508)
+++ trunk/src/ui/views/widget/widget.cc (working copy)
@@ -69,11 +69,9 @@
// WidgetDelegate is supplied.
class DefaultWidgetDelegate : public WidgetDelegate {
public:
- DefaultWidgetDelegate(Widget* widget, const Widget::InitParams& params)
+ DefaultWidgetDelegate(Widget* widget, bool can_activate)
: widget_(widget),
- can_activate_(!params.child &&
- params.type != Widget::InitParams::TYPE_POPUP &&
- params.type != Widget::InitParams::TYPE_DRAG) {
+ can_activate_(can_activate) {
}
virtual ~DefaultWidgetDelegate() {}
@@ -113,7 +111,7 @@
child(false),
opacity(INFER_OPACITY),
accept_events(true),
- can_activate(true),
+ activatable(ACTIVATABLE_DEFAULT),
keep_on_top(false),
visible_on_all_workspaces(false),
ownership(NATIVE_WIDGET_OWNS_WIDGET),
@@ -138,8 +136,7 @@
child(type == TYPE_CONTROL),
opacity(INFER_OPACITY),
accept_events(true),
- can_activate(type != TYPE_POPUP && type != TYPE_MENU &&
- type != TYPE_DRAG),
+ activatable(ACTIVATABLE_DEFAULT),
keep_on_top(type == TYPE_MENU || type == TYPE_DRAG),
visible_on_all_workspaces(false),
ownership(NATIVE_WIDGET_OWNS_WIDGET),
@@ -347,6 +344,20 @@
params.type != InitParams::TYPE_TOOLTIP);
params.top_level = is_top_level_;
+ if (params.activatable != InitParams::ACTIVATABLE_DEFAULT) {
+ can_activate_ = (params.activatable == InitParams::ACTIVATABLE_YES);
+ } else if (params.type != InitParams::TYPE_CONTROL &&
+ params.type != InitParams::TYPE_POPUP &&
+ params.type != InitParams::TYPE_MENU &&
+ params.type != InitParams::TYPE_TOOLTIP &&
+ params.type != InitParams::TYPE_DRAG) {
+ can_activate_ = true;
+ params.activatable = InitParams::ACTIVATABLE_YES;
+ } else {
+ can_activate_ = false;
+ params.activatable = InitParams::ACTIVATABLE_NO;
+ }
+
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
params.type != views::Widget::InitParams::TYPE_WINDOW &&
params.type != views::Widget::InitParams::TYPE_PANEL)
@@ -359,7 +370,7 @@
params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
widget_delegate_ = params.delegate ?
- params.delegate : new DefaultWidgetDelegate(this, params);
+ params.delegate : new DefaultWidgetDelegate(this, can_activate_);
ownership_ = params.ownership;
native_widget_ = CreateNativeWidget(params.native_widget, this)->
AsNativeWidgetPrivate();
@@ -1008,7 +1019,7 @@
}
bool Widget::CanActivate() const {
- return widget_delegate_->CanActivate();
+ return can_activate_ && widget_delegate_->CanActivate();
}
bool Widget::IsInactiveRenderingDisabled() const {
« no previous file with comments | « trunk/src/ui/views/widget/widget.h ('k') | trunk/src/ui/views/widget/widget_hwnd_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698