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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 } | 844 } |
845 | 845 |
846 void AppWindow::SetNativeWindowFullscreen() { | 846 void AppWindow::SetNativeWindowFullscreen() { |
847 native_app_window_->SetFullscreen(fullscreen_types_); | 847 native_app_window_->SetFullscreen(fullscreen_types_); |
848 | 848 |
849 RestoreAlwaysOnTop(); | 849 RestoreAlwaysOnTop(); |
850 } | 850 } |
851 | 851 |
852 bool AppWindow::IntersectsWithTaskbar() const { | 852 bool AppWindow::IntersectsWithTaskbar() const { |
853 #if defined(OS_WIN) | 853 #if defined(OS_WIN) |
854 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); | 854 gfx::Screen* screen = gfx::Screen::GetScreen(); |
855 gfx::Rect window_bounds = native_app_window_->GetRestoredBounds(); | 855 gfx::Rect window_bounds = native_app_window_->GetRestoredBounds(); |
856 std::vector<gfx::Display> displays = screen->GetAllDisplays(); | 856 std::vector<gfx::Display> displays = screen->GetAllDisplays(); |
857 | 857 |
858 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); | 858 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); |
859 it != displays.end(); | 859 it != displays.end(); |
860 ++it) { | 860 ++it) { |
861 gfx::Rect taskbar_bounds = it->bounds(); | 861 gfx::Rect taskbar_bounds = it->bounds(); |
862 taskbar_bounds.Subtract(it->work_area()); | 862 taskbar_bounds.Subtract(it->work_area()); |
863 if (taskbar_bounds.IsEmpty()) | 863 if (taskbar_bounds.IsEmpty()) |
864 continue; | 864 continue; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 void AppWindow::SaveWindowPosition() { | 1005 void AppWindow::SaveWindowPosition() { |
1006 DCHECK(native_app_window_); | 1006 DCHECK(native_app_window_); |
1007 if (window_key_.empty()) | 1007 if (window_key_.empty()) |
1008 return; | 1008 return; |
1009 | 1009 |
1010 AppWindowGeometryCache* cache = | 1010 AppWindowGeometryCache* cache = |
1011 AppWindowGeometryCache::Get(browser_context()); | 1011 AppWindowGeometryCache::Get(browser_context()); |
1012 | 1012 |
1013 gfx::Rect bounds = native_app_window_->GetRestoredBounds(); | 1013 gfx::Rect bounds = native_app_window_->GetRestoredBounds(); |
1014 gfx::Rect screen_bounds = | 1014 gfx::Rect screen_bounds = |
1015 gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds).work_area(); | 1015 gfx::Screen::GetScreen()->GetDisplayMatching(bounds).work_area(); |
1016 ui::WindowShowState window_state = native_app_window_->GetRestoredState(); | 1016 ui::WindowShowState window_state = native_app_window_->GetRestoredState(); |
1017 cache->SaveGeometry( | 1017 cache->SaveGeometry( |
1018 extension_id(), window_key_, bounds, screen_bounds, window_state); | 1018 extension_id(), window_key_, bounds, screen_bounds, window_state); |
1019 } | 1019 } |
1020 | 1020 |
1021 void AppWindow::AdjustBoundsToBeVisibleOnScreen( | 1021 void AppWindow::AdjustBoundsToBeVisibleOnScreen( |
1022 const gfx::Rect& cached_bounds, | 1022 const gfx::Rect& cached_bounds, |
1023 const gfx::Rect& cached_screen_bounds, | 1023 const gfx::Rect& cached_screen_bounds, |
1024 const gfx::Rect& current_screen_bounds, | 1024 const gfx::Rect& current_screen_bounds, |
1025 const gfx::Size& minimum_size, | 1025 const gfx::Size& minimum_size, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 gfx::Rect cached_bounds; | 1071 gfx::Rect cached_bounds; |
1072 gfx::Rect cached_screen_bounds; | 1072 gfx::Rect cached_screen_bounds; |
1073 ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT; | 1073 ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT; |
1074 if (cache->GetGeometry(extension_id(), | 1074 if (cache->GetGeometry(extension_id(), |
1075 params.window_key, | 1075 params.window_key, |
1076 &cached_bounds, | 1076 &cached_bounds, |
1077 &cached_screen_bounds, | 1077 &cached_screen_bounds, |
1078 &cached_state)) { | 1078 &cached_state)) { |
1079 // App window has cached screen bounds, make sure it fits on screen in | 1079 // App window has cached screen bounds, make sure it fits on screen in |
1080 // case the screen resolution changed. | 1080 // case the screen resolution changed. |
1081 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); | 1081 gfx::Screen* screen = gfx::Screen::GetScreen(); |
1082 gfx::Display display = screen->GetDisplayMatching(cached_bounds); | 1082 gfx::Display display = screen->GetDisplayMatching(cached_bounds); |
1083 gfx::Rect current_screen_bounds = display.work_area(); | 1083 gfx::Rect current_screen_bounds = display.work_area(); |
1084 SizeConstraints constraints(params.GetWindowMinimumSize(gfx::Insets()), | 1084 SizeConstraints constraints(params.GetWindowMinimumSize(gfx::Insets()), |
1085 params.GetWindowMaximumSize(gfx::Insets())); | 1085 params.GetWindowMaximumSize(gfx::Insets())); |
1086 AdjustBoundsToBeVisibleOnScreen(cached_bounds, | 1086 AdjustBoundsToBeVisibleOnScreen(cached_bounds, |
1087 cached_screen_bounds, | 1087 cached_screen_bounds, |
1088 current_screen_bounds, | 1088 current_screen_bounds, |
1089 constraints.GetMinimumSize(), | 1089 constraints.GetMinimumSize(), |
1090 ¶ms.window_spec.bounds); | 1090 ¶ms.window_spec.bounds); |
1091 params.state = cached_state; | 1091 params.state = cached_state; |
(...skipping 19 matching lines...) Expand all Loading... |
1111 region.bounds.x(), | 1111 region.bounds.x(), |
1112 region.bounds.y(), | 1112 region.bounds.y(), |
1113 region.bounds.right(), | 1113 region.bounds.right(), |
1114 region.bounds.bottom(), | 1114 region.bounds.bottom(), |
1115 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1115 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1116 } | 1116 } |
1117 return sk_region; | 1117 return sk_region; |
1118 } | 1118 } |
1119 | 1119 |
1120 } // namespace extensions | 1120 } // namespace extensions |
OLD | NEW |