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

Side by Side Diff: extensions/browser/app_window/app_window.cc

Issue 1924133002: Rename gfx::Display/Screen to display::Display/Screen in extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "extensions/browser/suggest_permission_util.h" 46 #include "extensions/browser/suggest_permission_util.h"
47 #include "extensions/browser/view_type_utils.h" 47 #include "extensions/browser/view_type_utils.h"
48 #include "extensions/common/draggable_region.h" 48 #include "extensions/common/draggable_region.h"
49 #include "extensions/common/extension.h" 49 #include "extensions/common/extension.h"
50 #include "extensions/common/manifest_handlers/icons_handler.h" 50 #include "extensions/common/manifest_handlers/icons_handler.h"
51 #include "extensions/common/permissions/permissions_data.h" 51 #include "extensions/common/permissions/permissions_data.h"
52 #include "extensions/common/switches.h" 52 #include "extensions/common/switches.h"
53 #include "extensions/grit/extensions_browser_resources.h" 53 #include "extensions/grit/extensions_browser_resources.h"
54 #include "third_party/skia/include/core/SkRegion.h" 54 #include "third_party/skia/include/core/SkRegion.h"
55 #include "ui/base/resource/resource_bundle.h" 55 #include "ui/base/resource/resource_bundle.h"
56 #include "ui/display/screen.h"
56 #include "ui/events/keycodes/keyboard_codes.h" 57 #include "ui/events/keycodes/keyboard_codes.h"
57 #include "ui/gfx/screen.h"
58 58
59 #if !defined(OS_MACOSX) 59 #if !defined(OS_MACOSX)
60 #include "components/prefs/pref_service.h" 60 #include "components/prefs/pref_service.h"
61 #include "extensions/browser/pref_names.h" 61 #include "extensions/browser/pref_names.h"
62 #endif 62 #endif
63 63
64 using content::BrowserContext; 64 using content::BrowserContext;
65 using content::ConsoleMessageLevel; 65 using content::ConsoleMessageLevel;
66 using content::WebContents; 66 using content::WebContents;
67 using web_modal::WebContentsModalDialogHost; 67 using web_modal::WebContentsModalDialogHost;
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 850 }
851 851
852 void AppWindow::SetNativeWindowFullscreen() { 852 void AppWindow::SetNativeWindowFullscreen() {
853 native_app_window_->SetFullscreen(fullscreen_types_); 853 native_app_window_->SetFullscreen(fullscreen_types_);
854 854
855 RestoreAlwaysOnTop(); 855 RestoreAlwaysOnTop();
856 } 856 }
857 857
858 bool AppWindow::IntersectsWithTaskbar() const { 858 bool AppWindow::IntersectsWithTaskbar() const {
859 #if defined(OS_WIN) 859 #if defined(OS_WIN)
860 gfx::Screen* screen = gfx::Screen::GetScreen(); 860 display::Screen* screen = display::Screen::GetScreen();
861 gfx::Rect window_bounds = native_app_window_->GetRestoredBounds(); 861 gfx::Rect window_bounds = native_app_window_->GetRestoredBounds();
862 std::vector<gfx::Display> displays = screen->GetAllDisplays(); 862 std::vector<display::Display> displays = screen->GetAllDisplays();
863 863
864 for (std::vector<gfx::Display>::const_iterator it = displays.begin(); 864 for (std::vector<display::Display>::const_iterator it = displays.begin();
865 it != displays.end(); 865 it != displays.end(); ++it) {
866 ++it) {
867 gfx::Rect taskbar_bounds = it->bounds(); 866 gfx::Rect taskbar_bounds = it->bounds();
868 taskbar_bounds.Subtract(it->work_area()); 867 taskbar_bounds.Subtract(it->work_area());
869 if (taskbar_bounds.IsEmpty()) 868 if (taskbar_bounds.IsEmpty())
870 continue; 869 continue;
871 870
872 if (window_bounds.Intersects(taskbar_bounds)) 871 if (window_bounds.Intersects(taskbar_bounds))
873 return true; 872 return true;
874 } 873 }
875 #endif 874 #endif
876 875
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 void AppWindow::SaveWindowPosition() { 1010 void AppWindow::SaveWindowPosition() {
1012 DCHECK(native_app_window_); 1011 DCHECK(native_app_window_);
1013 if (window_key_.empty()) 1012 if (window_key_.empty())
1014 return; 1013 return;
1015 1014
1016 AppWindowGeometryCache* cache = 1015 AppWindowGeometryCache* cache =
1017 AppWindowGeometryCache::Get(browser_context()); 1016 AppWindowGeometryCache::Get(browser_context());
1018 1017
1019 gfx::Rect bounds = native_app_window_->GetRestoredBounds(); 1018 gfx::Rect bounds = native_app_window_->GetRestoredBounds();
1020 gfx::Rect screen_bounds = 1019 gfx::Rect screen_bounds =
1021 gfx::Screen::GetScreen()->GetDisplayMatching(bounds).work_area(); 1020 display::Screen::GetScreen()->GetDisplayMatching(bounds).work_area();
1022 ui::WindowShowState window_state = native_app_window_->GetRestoredState(); 1021 ui::WindowShowState window_state = native_app_window_->GetRestoredState();
1023 cache->SaveGeometry( 1022 cache->SaveGeometry(
1024 extension_id(), window_key_, bounds, screen_bounds, window_state); 1023 extension_id(), window_key_, bounds, screen_bounds, window_state);
1025 } 1024 }
1026 1025
1027 void AppWindow::AdjustBoundsToBeVisibleOnScreen( 1026 void AppWindow::AdjustBoundsToBeVisibleOnScreen(
1028 const gfx::Rect& cached_bounds, 1027 const gfx::Rect& cached_bounds,
1029 const gfx::Rect& cached_screen_bounds, 1028 const gfx::Rect& cached_screen_bounds,
1030 const gfx::Rect& current_screen_bounds, 1029 const gfx::Rect& current_screen_bounds,
1031 const gfx::Size& minimum_size, 1030 const gfx::Size& minimum_size,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 gfx::Rect cached_bounds; 1076 gfx::Rect cached_bounds;
1078 gfx::Rect cached_screen_bounds; 1077 gfx::Rect cached_screen_bounds;
1079 ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT; 1078 ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT;
1080 if (cache->GetGeometry(extension_id(), 1079 if (cache->GetGeometry(extension_id(),
1081 params.window_key, 1080 params.window_key,
1082 &cached_bounds, 1081 &cached_bounds,
1083 &cached_screen_bounds, 1082 &cached_screen_bounds,
1084 &cached_state)) { 1083 &cached_state)) {
1085 // App window has cached screen bounds, make sure it fits on screen in 1084 // App window has cached screen bounds, make sure it fits on screen in
1086 // case the screen resolution changed. 1085 // case the screen resolution changed.
1087 gfx::Screen* screen = gfx::Screen::GetScreen(); 1086 display::Screen* screen = display::Screen::GetScreen();
1088 gfx::Display display = screen->GetDisplayMatching(cached_bounds); 1087 display::Display display = screen->GetDisplayMatching(cached_bounds);
1089 gfx::Rect current_screen_bounds = display.work_area(); 1088 gfx::Rect current_screen_bounds = display.work_area();
1090 SizeConstraints constraints(params.GetWindowMinimumSize(gfx::Insets()), 1089 SizeConstraints constraints(params.GetWindowMinimumSize(gfx::Insets()),
1091 params.GetWindowMaximumSize(gfx::Insets())); 1090 params.GetWindowMaximumSize(gfx::Insets()));
1092 AdjustBoundsToBeVisibleOnScreen(cached_bounds, 1091 AdjustBoundsToBeVisibleOnScreen(cached_bounds,
1093 cached_screen_bounds, 1092 cached_screen_bounds,
1094 current_screen_bounds, 1093 current_screen_bounds,
1095 constraints.GetMinimumSize(), 1094 constraints.GetMinimumSize(),
1096 &params.window_spec.bounds); 1095 &params.window_spec.bounds);
1097 params.state = cached_state; 1096 params.state = cached_state;
1098 1097
(...skipping 18 matching lines...) Expand all
1117 region.bounds.x(), 1116 region.bounds.x(),
1118 region.bounds.y(), 1117 region.bounds.y(),
1119 region.bounds.right(), 1118 region.bounds.right(),
1120 region.bounds.bottom(), 1119 region.bounds.bottom(),
1121 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); 1120 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
1122 } 1121 }
1123 return sk_region; 1122 return sk_region;
1124 } 1123 }
1125 1124
1126 } // namespace extensions 1125 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/web_contents_capture_client.cc ('k') | extensions/shell/browser/shell_desktop_controller_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698