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

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

Issue 26427002: Add always-on-top property to app windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed potentially flaky test Created 7 years, 2 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 #include "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 saved_show_state_(ui::SHOW_STATE_DEFAULT), 174 saved_show_state_(ui::SHOW_STATE_DEFAULT),
175 focus_on_creation_(true), 175 focus_on_creation_(true),
176 is_top_level_(false), 176 is_top_level_(false),
177 native_widget_initialized_(false), 177 native_widget_initialized_(false),
178 native_widget_destroyed_(false), 178 native_widget_destroyed_(false),
179 is_mouse_button_pressed_(false), 179 is_mouse_button_pressed_(false),
180 is_touch_down_(false), 180 is_touch_down_(false),
181 last_mouse_event_was_move_(false), 181 last_mouse_event_was_move_(false),
182 auto_release_capture_(true), 182 auto_release_capture_(true),
183 root_layers_dirty_(false), 183 root_layers_dirty_(false),
184 movement_disabled_(false) { 184 movement_disabled_(false),
185 is_always_on_top_(false) {
185 } 186 }
186 187
187 Widget::~Widget() { 188 Widget::~Widget() {
188 DestroyRootView(); 189 DestroyRootView();
189 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) { 190 if (ownership_ == InitParams::WIDGET_OWNS_NATIVE_WIDGET) {
190 delete native_widget_; 191 delete native_widget_;
191 } else { 192 } else {
192 DCHECK(native_widget_destroyed_) 193 DCHECK(native_widget_destroyed_)
193 << "Destroying a widget with a live native widget. " 194 << "Destroying a widget with a live native widget. "
194 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership."; 195 << "Widget probably should use WIDGET_OWNS_NATIVE_WIDGET ownership.";
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 UpdateWindowTitle(); 392 UpdateWindowTitle();
392 SetInitialBounds(params.bounds); 393 SetInitialBounds(params.bounds);
393 if (params.show_state == ui::SHOW_STATE_MAXIMIZED) 394 if (params.show_state == ui::SHOW_STATE_MAXIMIZED)
394 Maximize(); 395 Maximize();
395 else if (params.show_state == ui::SHOW_STATE_MINIMIZED) 396 else if (params.show_state == ui::SHOW_STATE_MINIMIZED)
396 Minimize(); 397 Minimize();
397 } else if (params.delegate) { 398 } else if (params.delegate) {
398 SetContentsView(params.delegate->GetContentsView()); 399 SetContentsView(params.delegate->GetContentsView());
399 SetInitialBoundsForFramelessWindow(params.bounds); 400 SetInitialBoundsForFramelessWindow(params.bounds);
400 } 401 }
402 is_always_on_top_ = native_widget_->IsAlwaysOnTop();
401 native_widget_initialized_ = true; 403 native_widget_initialized_ = true;
402 } 404 }
403 405
404 // Unconverted methods (see header) -------------------------------------------- 406 // Unconverted methods (see header) --------------------------------------------
405 407
406 gfx::NativeView Widget::GetNativeView() const { 408 gfx::NativeView Widget::GetNativeView() const {
407 return native_widget_->GetNativeView(); 409 return native_widget_->GetNativeView();
408 } 410 }
409 411
410 gfx::NativeWindow Widget::GetNativeWindow() const { 412 gfx::NativeWindow Widget::GetNativeWindow() const {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 bool Widget::IsActive() const { 651 bool Widget::IsActive() const {
650 return native_widget_->IsActive(); 652 return native_widget_->IsActive();
651 } 653 }
652 654
653 void Widget::DisableInactiveRendering() { 655 void Widget::DisableInactiveRendering() {
654 SetInactiveRenderingDisabled(true); 656 SetInactiveRenderingDisabled(true);
655 } 657 }
656 658
657 void Widget::SetAlwaysOnTop(bool on_top) { 659 void Widget::SetAlwaysOnTop(bool on_top) {
658 native_widget_->SetAlwaysOnTop(on_top); 660 native_widget_->SetAlwaysOnTop(on_top);
661 is_always_on_top_ = native_widget_->IsAlwaysOnTop();
662 }
663
664 bool Widget::IsAlwaysOnTop() const {
665 return is_always_on_top_;
659 } 666 }
660 667
661 void Widget::Maximize() { 668 void Widget::Maximize() {
662 native_widget_->Maximize(); 669 native_widget_->Maximize();
663 } 670 }
664 671
665 void Widget::Minimize() { 672 void Widget::Minimize() {
666 native_widget_->Minimize(); 673 native_widget_->Minimize();
667 } 674 }
668 675
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 1434
1428 //////////////////////////////////////////////////////////////////////////////// 1435 ////////////////////////////////////////////////////////////////////////////////
1429 // internal::NativeWidgetPrivate, NativeWidget implementation: 1436 // internal::NativeWidgetPrivate, NativeWidget implementation:
1430 1437
1431 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1438 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1432 return this; 1439 return this;
1433 } 1440 }
1434 1441
1435 } // namespace internal 1442 } // namespace internal
1436 } // namespace views 1443 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698