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

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

Issue 2650833002: Set focusibility correctly when initializing a window in mus+ash. (Closed)
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 side-by-side diff with in-line comments
Download patch
« ui/views/mus/mus_client.cc ('K') | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.cc
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index 8b062753e23765729eb07cb7ac267a9ff10fe818..aafe33786510da78fae60c5111f7cbd734e666a5 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -141,6 +141,16 @@ Widget::InitParams::InitParams(const InitParams& other) = default;
Widget::InitParams::~InitParams() {
}
+bool Widget::InitParams::CanActivate() const {
sky 2017/01/23 21:28:29 Are you sure you need to create a function for thi
Hadi 2017/01/24 18:42:33 I logged activatable at MusClient::ConfigureProper
+ if (activatable != InitParams::ACTIVATABLE_DEFAULT) {
+ return activatable == InitParams::ACTIVATABLE_YES;
+ } else {
sky 2017/01/23 21:28:29 no else after a return (see style guide).
Hadi 2017/01/24 18:42:33 Done.
+ return type != InitParams::TYPE_CONTROL && type != InitParams::TYPE_POPUP &&
+ type != InitParams::TYPE_MENU && type != InitParams::TYPE_TOOLTIP &&
+ type != InitParams::TYPE_DRAG;
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Widget, public:
@@ -309,20 +319,9 @@ void Widget::Init(const InitParams& in_params) {
if (params.opacity == views::Widget::InitParams::INFER_OPACITY)
params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
- bool can_activate = false;
- 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;
- }
+ bool can_activate = params.CanActivate();
+ params.activatable =
+ can_activate ? InitParams::ACTIVATABLE_YES : InitParams::ACTIVATABLE_NO;
widget_delegate_ = params.delegate ?
params.delegate : new DefaultWidgetDelegate(this);
« ui/views/mus/mus_client.cc ('K') | « ui/views/widget/widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698