OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #include "ui/base/gtk/gtk_hig_constants.h" | 97 #include "ui/base/gtk/gtk_hig_constants.h" |
98 #include "ui/base/gtk/gtk_screen_util.h" | 98 #include "ui/base/gtk/gtk_screen_util.h" |
99 #include "ui/base/keycodes/keyboard_codes.h" | 99 #include "ui/base/keycodes/keyboard_codes.h" |
100 #include "ui/base/l10n/l10n_util.h" | 100 #include "ui/base/l10n/l10n_util.h" |
101 #include "ui/base/resource/resource_bundle.h" | 101 #include "ui/base/resource/resource_bundle.h" |
102 #include "ui/base/x/active_window_watcher_x.h" | 102 #include "ui/base/x/active_window_watcher_x.h" |
103 #include "ui/gfx/gtk_util.h" | 103 #include "ui/gfx/gtk_util.h" |
104 #include "ui/gfx/image/cairo_cached_surface.h" | 104 #include "ui/gfx/image/cairo_cached_surface.h" |
105 #include "ui/gfx/image/image.h" | 105 #include "ui/gfx/image/image.h" |
106 #include "ui/gfx/rect.h" | 106 #include "ui/gfx/rect.h" |
| 107 #include "ui/gfx/monitor.h" |
107 #include "ui/gfx/screen.h" | 108 #include "ui/gfx/screen.h" |
108 #include "ui/gfx/skia_utils_gtk.h" | 109 #include "ui/gfx/skia_utils_gtk.h" |
109 | 110 |
110 using content::SSLStatus; | 111 using content::SSLStatus; |
111 using content::WebContents; | 112 using content::WebContents; |
112 | 113 |
113 namespace { | 114 namespace { |
114 | 115 |
115 // The number of milliseconds between loading animation frames. | 116 // The number of milliseconds between loading animation frames. |
116 const int kLoadingAnimationFrameTimeMs = 30; | 117 const int kLoadingAnimationFrameTimeMs = 30; |
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 // Note that we store left/top for consistency with Windows, but that we | 2097 // Note that we store left/top for consistency with Windows, but that we |
2097 // *don't* obey them; we only use them for computing width/height. See | 2098 // *don't* obey them; we only use them for computing width/height. See |
2098 // comments in SetGeometryHints(). | 2099 // comments in SetGeometryHints(). |
2099 window_preferences->SetInteger("left", restored_bounds_.x()); | 2100 window_preferences->SetInteger("left", restored_bounds_.x()); |
2100 window_preferences->SetInteger("top", restored_bounds_.y()); | 2101 window_preferences->SetInteger("top", restored_bounds_.y()); |
2101 window_preferences->SetInteger("right", restored_bounds_.right()); | 2102 window_preferences->SetInteger("right", restored_bounds_.right()); |
2102 window_preferences->SetInteger("bottom", restored_bounds_.bottom()); | 2103 window_preferences->SetInteger("bottom", restored_bounds_.bottom()); |
2103 window_preferences->SetBoolean("maximized", IsMaximized()); | 2104 window_preferences->SetBoolean("maximized", IsMaximized()); |
2104 | 2105 |
2105 gfx::Rect work_area( | 2106 gfx::Rect work_area( |
2106 gfx::Screen::GetMonitorWorkAreaMatching(restored_bounds_)); | 2107 gfx::Screen::GetMonitorMatching(restored_bounds_)->GetWorkArea()); |
2107 window_preferences->SetInteger("work_area_left", work_area.x()); | 2108 window_preferences->SetInteger("work_area_left", work_area.x()); |
2108 window_preferences->SetInteger("work_area_top", work_area.y()); | 2109 window_preferences->SetInteger("work_area_top", work_area.y()); |
2109 window_preferences->SetInteger("work_area_right", work_area.right()); | 2110 window_preferences->SetInteger("work_area_right", work_area.right()); |
2110 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); | 2111 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); |
2111 } | 2112 } |
2112 | 2113 |
2113 void BrowserWindowGtk::InvalidateInfoBarBits() { | 2114 void BrowserWindowGtk::InvalidateInfoBarBits() { |
2114 gtk_widget_queue_draw(toolbar_border_); | 2115 gtk_widget_queue_draw(toolbar_border_); |
2115 gtk_widget_queue_draw(toolbar_->widget()); | 2116 gtk_widget_queue_draw(toolbar_->widget()); |
2116 if (bookmark_bar_.get() && | 2117 if (bookmark_bar_.get() && |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 wm_type == ui::WM_OPENBOX || | 2597 wm_type == ui::WM_OPENBOX || |
2597 wm_type == ui::WM_XFWM4); | 2598 wm_type == ui::WM_XFWM4); |
2598 } | 2599 } |
2599 | 2600 |
2600 // static | 2601 // static |
2601 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2602 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2602 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2603 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2603 browser_window_gtk->Init(); | 2604 browser_window_gtk->Init(); |
2604 return browser_window_gtk; | 2605 return browser_window_gtk; |
2605 } | 2606 } |
OLD | NEW |