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

Side by Side Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 160246: Reposition and/or resize window if it becomes off-screen.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/views/chrome_views_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/gtk/browser_window_gtk.h" 5 #include "chrome/browser/gtk/browser_window_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <X11/XF86keysym.h> 8 #include <X11/XF86keysym.h>
9 9
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "app/theme_provider.h" 11 #include "app/theme_provider.h"
12 #include "base/base_paths_linux.h" 12 #include "base/base_paths_linux.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/gfx/gtk_util.h" 14 #include "base/gfx/gtk_util.h"
15 #include "base/gfx/rect.h"
15 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/message_loop.h" 18 #include "base/message_loop.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/scoped_ptr.h"
19 #include "base/string_util.h" 21 #include "base/string_util.h"
20 #include "base/time.h" 22 #include "base/time.h"
21 #include "chrome/app/chrome_dll_resource.h" 23 #include "chrome/app/chrome_dll_resource.h"
22 #include "chrome/browser/bookmarks/bookmark_utils.h" 24 #include "chrome/browser/bookmarks/bookmark_utils.h"
23 #include "chrome/browser/browser.h" 25 #include "chrome/browser/browser.h"
24 #include "chrome/browser/browser_list.h" 26 #include "chrome/browser/browser_list.h"
25 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/browser_theme_provider.h" 28 #include "chrome/browser/browser_theme_provider.h"
27 #include "chrome/browser/debugger/devtools_window.h" 29 #include "chrome/browser/debugger/devtools_window.h"
28 #include "chrome/browser/download/download_item_model.h" 30 #include "chrome/browser/download/download_item_model.h"
(...skipping 18 matching lines...) Expand all
47 #include "chrome/browser/gtk/nine_box.h" 49 #include "chrome/browser/gtk/nine_box.h"
48 #include "chrome/browser/gtk/status_bubble_gtk.h" 50 #include "chrome/browser/gtk/status_bubble_gtk.h"
49 #include "chrome/browser/gtk/tab_contents_container_gtk.h" 51 #include "chrome/browser/gtk/tab_contents_container_gtk.h"
50 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" 52 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h"
51 #include "chrome/browser/gtk/task_manager_gtk.h" 53 #include "chrome/browser/gtk/task_manager_gtk.h"
52 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" 54 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h"
53 #include "chrome/browser/location_bar.h" 55 #include "chrome/browser/location_bar.h"
54 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 56 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
55 #include "chrome/browser/tab_contents/tab_contents.h" 57 #include "chrome/browser/tab_contents/tab_contents.h"
56 #include "chrome/browser/tab_contents/tab_contents_view.h" 58 #include "chrome/browser/tab_contents/tab_contents_view.h"
59 #include "chrome/browser/window_sizer.h"
57 #include "chrome/common/gtk_util.h" 60 #include "chrome/common/gtk_util.h"
58 #include "chrome/common/notification_service.h" 61 #include "chrome/common/notification_service.h"
59 #include "chrome/common/pref_names.h" 62 #include "chrome/common/pref_names.h"
60 #include "chrome/common/pref_service.h" 63 #include "chrome/common/pref_service.h"
61 #include "grit/app_resources.h" 64 #include "grit/app_resources.h"
62 #include "grit/theme_resources.h" 65 #include "grit/theme_resources.h"
63 66
64 #if defined(OS_CHROMEOS) 67 #if defined(OS_CHROMEOS)
65 #include "chrome/browser/views/panel_controller.h" 68 #include "chrome/browser/views/panel_controller.h"
66 #include "chrome/browser/views/tabs/tab_overview_types.h" 69 #include "chrome/browser/views/tabs/tab_overview_types.h"
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 g_browser_process->local_state()->GetMutableDictionary( 1306 g_browser_process->local_state()->GetMutableDictionary(
1304 window_name.c_str()); 1307 window_name.c_str());
1305 // Note that we store left/top for consistency with Windows, but that we 1308 // Note that we store left/top for consistency with Windows, but that we
1306 // *don't* obey them; we only use them for computing width/height. See 1309 // *don't* obey them; we only use them for computing width/height. See
1307 // comments in SetGeometryHints(). 1310 // comments in SetGeometryHints().
1308 window_preferences->SetInteger(L"left", restored_bounds_.x()); 1311 window_preferences->SetInteger(L"left", restored_bounds_.x());
1309 window_preferences->SetInteger(L"top", restored_bounds_.y()); 1312 window_preferences->SetInteger(L"top", restored_bounds_.y());
1310 window_preferences->SetInteger(L"right", restored_bounds_.right()); 1313 window_preferences->SetInteger(L"right", restored_bounds_.right());
1311 window_preferences->SetInteger(L"bottom", restored_bounds_.bottom()); 1314 window_preferences->SetInteger(L"bottom", restored_bounds_.bottom());
1312 window_preferences->SetBoolean(L"maximized", IsMaximized()); 1315 window_preferences->SetBoolean(L"maximized", IsMaximized());
1316
1317 scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider(
1318 WindowSizer::CreateDefaultMonitorInfoProvider());
1319 gfx::Rect work_area(
1320 monitor_info_provider->GetMonitorWorkAreaMatching(restored_bounds_));
1321 window_preferences->SetInteger(L"work_area_left", work_area.x());
1322 window_preferences->SetInteger(L"work_area_top", work_area.y());
1323 window_preferences->SetInteger(L"work_area_right", work_area.right());
1324 window_preferences->SetInteger(L"work_area_bottom", work_area.bottom());
1313 } 1325 }
1314 1326
1315 // static 1327 // static
1316 gboolean BrowserWindowGtk::OnGtkAccelerator(GtkAccelGroup* accel_group, 1328 gboolean BrowserWindowGtk::OnGtkAccelerator(GtkAccelGroup* accel_group,
1317 GObject* acceleratable, 1329 GObject* acceleratable,
1318 guint keyval, 1330 guint keyval,
1319 GdkModifierType modifier, 1331 GdkModifierType modifier,
1320 BrowserWindowGtk* browser_window) { 1332 BrowserWindowGtk* browser_window) {
1321 int command_id = GetCommandId(keyval, modifier); 1333 int command_id = GetCommandId(keyval, modifier);
1322 browser_window->ExecuteBrowserCommand(command_id); 1334 browser_window->ExecuteBrowserCommand(command_id);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 *edge = GDK_WINDOW_EDGE_NORTH_EAST; 1549 *edge = GDK_WINDOW_EDGE_NORTH_EAST;
1538 } else if (y < bounds_.height() - kResizeAreaCornerSize) { 1550 } else if (y < bounds_.height() - kResizeAreaCornerSize) {
1539 *edge = GDK_WINDOW_EDGE_EAST; 1551 *edge = GDK_WINDOW_EDGE_EAST;
1540 } else { 1552 } else {
1541 *edge = GDK_WINDOW_EDGE_SOUTH_EAST; 1553 *edge = GDK_WINDOW_EDGE_SOUTH_EAST;
1542 } 1554 }
1543 return true; 1555 return true;
1544 } 1556 }
1545 NOTREACHED(); 1557 NOTREACHED();
1546 } 1558 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/chrome_views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698