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

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

Issue 10383234: views: Do not set capture on a widget if it cannot be activated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self-nit Created 8 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 | « ash/system/tray/system_tray_widget_delegate.cc ('k') | ui/views/widget/widget_unittest.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 #include "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 native_widget_->ShowWithWindowState(saved_show_state_); 511 native_widget_->ShowWithWindowState(saved_show_state_);
512 } 512 }
513 // |saved_show_state_| only applies the first time the window is shown. 513 // |saved_show_state_| only applies the first time the window is shown.
514 // If we don't reset the value the window may be shown maximized every time 514 // If we don't reset the value the window may be shown maximized every time
515 // it is subsequently shown after being hidden. 515 // it is subsequently shown after being hidden.
516 saved_show_state_ = ui::SHOW_STATE_NORMAL; 516 saved_show_state_ = ui::SHOW_STATE_NORMAL;
517 } else { 517 } else {
518 native_widget_->Show(); 518 native_widget_->Show();
519 } 519 }
520 520
521 if (close_on_deactivate_) { 521 if (CanActivate() && close_on_deactivate_) {
522 // Set mouse capture on timeout in case this is called from a 522 // Set mouse capture on timeout in case this is called from a
523 // mouse pressed handler. 523 // mouse pressed handler.
524 MessageLoopForUI::current()->PostTask(FROM_HERE, base::Bind( 524 MessageLoopForUI::current()->PostTask(FROM_HERE, base::Bind(
525 &Widget::SetMouseCapture, set_capture_factory_.GetWeakPtr(), 525 &Widget::SetMouseCapture, set_capture_factory_.GetWeakPtr(),
526 static_cast<View*>(NULL))); 526 static_cast<View*>(NULL)));
527 } 527 }
528 } 528 }
529 529
530 void Widget::Hide() { 530 void Widget::Hide() {
531 native_widget_->Hide(); 531 native_widget_->Hide();
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 1282
1283 //////////////////////////////////////////////////////////////////////////////// 1283 ////////////////////////////////////////////////////////////////////////////////
1284 // internal::NativeWidgetPrivate, NativeWidget implementation: 1284 // internal::NativeWidgetPrivate, NativeWidget implementation:
1285 1285
1286 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1286 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1287 return this; 1287 return this;
1288 } 1288 }
1289 1289
1290 } // namespace internal 1290 } // namespace internal
1291 } // namespace views 1291 } // namespace views
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_widget_delegate.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698