| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 gfx::Size constrained_size = constraints.ClampSize(bounds.size()); | 653 gfx::Size constrained_size = constraints.ClampSize(bounds.size()); |
| 654 if (bounds.size() != constrained_size) { | 654 if (bounds.size() != constrained_size) { |
| 655 bounds.set_size(constrained_size); | 655 bounds.set_size(constrained_size); |
| 656 bounds.Inset(-native_app_window_->GetFrameInsets()); | 656 bounds.Inset(-native_app_window_->GetFrameInsets()); |
| 657 native_app_window_->SetBounds(bounds); | 657 native_app_window_->SetBounds(bounds); |
| 658 } | 658 } |
| 659 OnNativeWindowChanged(); | 659 OnNativeWindowChanged(); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void AppWindow::Show(ShowType show_type) { | 662 void AppWindow::Show(ShowType show_type) { |
| 663 app_delegate_->OnShow(); |
| 663 bool was_hidden = is_hidden_ || !has_been_shown_; | 664 bool was_hidden = is_hidden_ || !has_been_shown_; |
| 664 is_hidden_ = false; | 665 is_hidden_ = false; |
| 665 | 666 |
| 666 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 667 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 667 switches::kEnableAppsShowOnFirstPaint)) { | 668 switches::kEnableAppsShowOnFirstPaint)) { |
| 668 show_on_first_paint_ = true; | 669 show_on_first_paint_ = true; |
| 669 | 670 |
| 670 if (!first_paint_complete_) { | 671 if (!first_paint_complete_) { |
| 671 delayed_show_type_ = show_type; | 672 delayed_show_type_ = show_type; |
| 672 return; | 673 return; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 689 | 690 |
| 690 void AppWindow::Hide() { | 691 void AppWindow::Hide() { |
| 691 // This is there to prevent race conditions with Hide() being called before | 692 // This is there to prevent race conditions with Hide() being called before |
| 692 // there was a non-empty paint. It should have no effect in a non-racy | 693 // there was a non-empty paint. It should have no effect in a non-racy |
| 693 // scenario where the application is hiding then showing a window: the second | 694 // scenario where the application is hiding then showing a window: the second |
| 694 // show will not be delayed. | 695 // show will not be delayed. |
| 695 is_hidden_ = true; | 696 is_hidden_ = true; |
| 696 show_on_first_paint_ = false; | 697 show_on_first_paint_ = false; |
| 697 GetBaseWindow()->Hide(); | 698 GetBaseWindow()->Hide(); |
| 698 AppWindowRegistry::Get(browser_context_)->AppWindowHidden(this); | 699 AppWindowRegistry::Get(browser_context_)->AppWindowHidden(this); |
| 700 app_delegate_->OnHide(); |
| 699 } | 701 } |
| 700 | 702 |
| 701 void AppWindow::SetAlwaysOnTop(bool always_on_top) { | 703 void AppWindow::SetAlwaysOnTop(bool always_on_top) { |
| 702 if (cached_always_on_top_ == always_on_top) | 704 if (cached_always_on_top_ == always_on_top) |
| 703 return; | 705 return; |
| 704 | 706 |
| 705 cached_always_on_top_ = always_on_top; | 707 cached_always_on_top_ = always_on_top; |
| 706 | 708 |
| 707 // As a security measure, do not allow fullscreen windows or windows that | 709 // As a security measure, do not allow fullscreen windows or windows that |
| 708 // overlap the taskbar to be on top. The property will be applied when the | 710 // overlap the taskbar to be on top. The property will be applied when the |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 region.bounds.x(), | 1111 region.bounds.x(), |
| 1110 region.bounds.y(), | 1112 region.bounds.y(), |
| 1111 region.bounds.right(), | 1113 region.bounds.right(), |
| 1112 region.bounds.bottom(), | 1114 region.bounds.bottom(), |
| 1113 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1115 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1114 } | 1116 } |
| 1115 return sk_region; | 1117 return sk_region; |
| 1116 } | 1118 } |
| 1117 | 1119 |
| 1118 } // namespace extensions | 1120 } // namespace extensions |
| OLD | NEW |