Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/activation_client.h" | 10 #include "ui/aura/client/activation_client.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 return window_->GetScreenBounds(); | 402 return window_->GetScreenBounds(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { | 405 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { |
| 406 // View-to-screen coordinate system transformations depend on this returning | 406 // View-to-screen coordinate system transformations depend on this returning |
| 407 // the full window bounds, for example View::ConvertPointToScreen(). | 407 // the full window bounds, for example View::ConvertPointToScreen(). |
| 408 return window_->GetScreenBounds(); | 408 return window_->GetScreenBounds(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { | 411 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { |
| 412 // Restored bounds should only be relevant if the window is minimized or | |
| 413 // maximized. However, in some places the code expectes GetRestoredBounds() | |
| 414 // to return the current window bounds if the window is not in either state. | |
| 415 if (!IsMinimized() && !IsMaximized()) | |
|
oshima
2012/02/24 21:24:59
I believe you need to check IsFullScreen() as well
stevenjb
2012/02/24 21:50:45
Ugh, you're right, didn't realize that was a widge
| |
| 416 return window_->bounds(); | |
| 412 gfx::Rect* restore_bounds = | 417 gfx::Rect* restore_bounds = |
| 413 window_->GetProperty(aura::client::kRestoreBoundsKey); | 418 window_->GetProperty(aura::client::kRestoreBoundsKey); |
| 414 return restore_bounds ? *restore_bounds : window_->bounds(); | 419 return restore_bounds ? *restore_bounds : window_->bounds(); |
| 415 } | 420 } |
| 416 | 421 |
| 417 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { | 422 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
| 418 window_->SetBounds(bounds); | 423 window_->SetBounds(bounds); |
| 419 } | 424 } |
| 420 | 425 |
| 421 void NativeWidgetAura::SetSize(const gfx::Size& size) { | 426 void NativeWidgetAura::SetSize(const gfx::Size& size) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 | 515 |
| 511 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 516 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
| 512 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); | 517 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); |
| 513 } | 518 } |
| 514 | 519 |
| 515 void NativeWidgetAura::Maximize() { | 520 void NativeWidgetAura::Maximize() { |
| 516 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 521 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 517 } | 522 } |
| 518 | 523 |
| 519 void NativeWidgetAura::Minimize() { | 524 void NativeWidgetAura::Minimize() { |
| 520 // No minimized window for aura. crbug.com/104571. | 525 // Note: This currently does not do anything except set the property, |
| 521 NOTREACHED(); | 526 // see crbug.com/104571. |
| 527 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | |
| 522 } | 528 } |
| 523 | 529 |
| 524 bool NativeWidgetAura::IsMaximized() const { | 530 bool NativeWidgetAura::IsMaximized() const { |
| 525 return window_->GetProperty(aura::client::kShowStateKey) == | 531 return window_->GetProperty(aura::client::kShowStateKey) == |
| 526 ui::SHOW_STATE_MAXIMIZED; | 532 ui::SHOW_STATE_MAXIMIZED; |
| 527 } | 533 } |
| 528 | 534 |
| 529 bool NativeWidgetAura::IsMinimized() const { | 535 bool NativeWidgetAura::IsMinimized() const { |
| 530 return window_->GetProperty(aura::client::kShowStateKey) == | 536 return window_->GetProperty(aura::client::kShowStateKey) == |
| 531 ui::SHOW_STATE_MINIMIZED; | 537 ui::SHOW_STATE_MINIMIZED; |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 } | 926 } |
| 921 } | 927 } |
| 922 | 928 |
| 923 // static | 929 // static |
| 924 bool NativeWidgetPrivate::IsMouseButtonDown() { | 930 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 925 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); | 931 return aura::RootWindow::GetInstance()->IsMouseButtonDown(); |
| 926 } | 932 } |
| 927 | 933 |
| 928 } // namespace internal | 934 } // namespace internal |
| 929 } // namespace views | 935 } // namespace views |
| OLD | NEW |