summaryrefslogtreecommitdiffstats
path: root/apps/shell_window_geometry_cache.h
diff options
context:
space:
mode:
authorscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-23 14:20:58 +0000
committerscheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-23 14:20:58 +0000
commit36e44c63bd11253166893d4367f677ecbb984000 (patch)
treea0c5a9b1b28ddd88580a5f3342867c6b6ec1cc2b /apps/shell_window_geometry_cache.h
parent0358c4835c1ba2500416fd53f6730c1a2d70307b (diff)
downloadchromium_src-36e44c63bd11253166893d4367f677ecbb984000.zip
chromium_src-36e44c63bd11253166893d4367f677ecbb984000.tar.gz
chromium_src-36e44c63bd11253166893d4367f677ecbb984000.tar.bz2
Place newly created app windows on screen.
Application windows with IDs are restored to their previous location, however if the screen bounds have changed they previously might be created offscreen. This change saves the previous screen bounds, and if the current screen is not contained that that area, it moves the window, resizing if needed, to fit in the new screen. This patch was developed by Chaobin Zhang <zhchbin@gmail.com> and review started on https://codereview.chromium.org/17378003/ but has been tested and edited by scheib@chromium.org to remove the "if defined(OS_WIN)". BUG=145752, 225734 TEST=Run https://github.com/GoogleChrome/chrome-app-samples/tree/master/window-state sample, launch windows with ID, move to a second monitor or far right bottom, close window, resize or disconnect other monitor, relaunch that window with ID: verify newly created window is visible. Review URL: https://chromiumcodereview.appspot.com/17564005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/shell_window_geometry_cache.h')
-rw-r--r--apps/shell_window_geometry_cache.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/shell_window_geometry_cache.h b/apps/shell_window_geometry_cache.h
index 334b9fb..c51bb5a 100644
--- a/apps/shell_window_geometry_cache.h
+++ b/apps/shell_window_geometry_cache.h
@@ -69,6 +69,7 @@ class ShellWindowGeometryCache
void SaveGeometry(const std::string& extension_id,
const std::string& window_id,
const gfx::Rect& bounds,
+ const gfx::Rect& screen_bounds,
ui::WindowShowState state);
// Get any saved geometry and state associated with |extension_id| and
@@ -77,6 +78,7 @@ class ShellWindowGeometryCache
bool GetGeometry(const std::string& extension_id,
const std::string& window_id,
gfx::Rect* bounds,
+ gfx::Rect* screen_bounds,
ui::WindowShowState* state);
// BrowserContextKeyedService
@@ -96,8 +98,10 @@ class ShellWindowGeometryCache
private:
// Data stored for each window.
struct WindowData {
- WindowData() : window_state(ui::SHOW_STATE_DEFAULT) {}
+ WindowData();
+ ~WindowData();
gfx::Rect bounds;
+ gfx::Rect screen_bounds;
ui::WindowShowState window_state;
base::Time last_change;
};