OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "app/gfx/color_utils.h" | 11 #include "app/gfx/color_utils.h" |
12 #include "app/gfx/gtk_util.h" | 12 #include "app/gfx/gtk_util.h" |
| 13 #include "app/gfx/skia_utils_gtk.h" |
13 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
14 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
15 #include "app/theme_provider.h" | 16 #include "app/theme_provider.h" |
16 #include "base/base_paths.h" | 17 #include "base/base_paths.h" |
17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
18 #include "base/gfx/rect.h" | 19 #include "base/gfx/rect.h" |
19 #include "base/keyboard_codes.h" | 20 #include "base/keyboard_codes.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/message_loop.h" | 22 #include "base/message_loop.h" |
22 #include "base/path_service.h" | 23 #include "base/path_service.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "chrome/browser/tab_contents/tab_contents_view.h" | 78 #include "chrome/browser/tab_contents/tab_contents_view.h" |
78 #include "chrome/browser/window_sizer.h" | 79 #include "chrome/browser/window_sizer.h" |
79 #include "chrome/common/chrome_switches.h" | 80 #include "chrome/common/chrome_switches.h" |
80 #include "chrome/common/gtk_util.h" | 81 #include "chrome/common/gtk_util.h" |
81 #include "chrome/common/notification_service.h" | 82 #include "chrome/common/notification_service.h" |
82 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
83 #include "grit/app_resources.h" | 84 #include "grit/app_resources.h" |
84 #include "grit/chromium_strings.h" | 85 #include "grit/chromium_strings.h" |
85 #include "grit/generated_resources.h" | 86 #include "grit/generated_resources.h" |
86 #include "grit/theme_resources.h" | 87 #include "grit/theme_resources.h" |
87 #include "skia/ext/skia_utils_gtk.h" | |
88 | 88 |
89 namespace { | 89 namespace { |
90 | 90 |
91 // The number of milliseconds between loading animation frames. | 91 // The number of milliseconds between loading animation frames. |
92 const int kLoadingAnimationFrameTimeMs = 30; | 92 const int kLoadingAnimationFrameTimeMs = 30; |
93 | 93 |
94 // Default height of dev tools pane when docked to the browser window. This | 94 // Default height of dev tools pane when docked to the browser window. This |
95 // matches the value in Views. | 95 // matches the value in Views. |
96 const int kDefaultDevToolsHeight = 200; | 96 const int kDefaultDevToolsHeight = 200; |
97 | 97 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return GDK_BOTTOM_SIDE; | 249 return GDK_BOTTOM_SIDE; |
250 case GDK_WINDOW_EDGE_SOUTH_EAST: | 250 case GDK_WINDOW_EDGE_SOUTH_EAST: |
251 return GDK_BOTTOM_RIGHT_CORNER; | 251 return GDK_BOTTOM_RIGHT_CORNER; |
252 default: | 252 default: |
253 NOTREACHED(); | 253 NOTREACHED(); |
254 } | 254 } |
255 return GDK_LAST_CURSOR; | 255 return GDK_LAST_CURSOR; |
256 } | 256 } |
257 | 257 |
258 GdkColor SkColorToGdkColor(const SkColor& color) { | 258 GdkColor SkColorToGdkColor(const SkColor& color) { |
259 return skia::SkColorToGdkColor(color); | 259 return gfx::SkColorToGdkColor(color); |
260 } | 260 } |
261 | 261 |
262 // A helper method for setting the GtkWindow size that should be used in place | 262 // A helper method for setting the GtkWindow size that should be used in place |
263 // of calling gtk_window_resize directly. This is done to avoid a WM "feature" | 263 // of calling gtk_window_resize directly. This is done to avoid a WM "feature" |
264 // where setting the window size to the screen size causes the WM to set the | 264 // where setting the window size to the screen size causes the WM to set the |
265 // EWMH for full screen mode. | 265 // EWMH for full screen mode. |
266 void SetWindowSize(GtkWindow* window, int width, int height) { | 266 void SetWindowSize(GtkWindow* window, int width, int height) { |
267 GdkScreen* screen = gtk_window_get_screen(window); | 267 GdkScreen* screen = gtk_window_get_screen(window); |
268 if (width >= gdk_screen_get_width(screen) && | 268 if (width >= gdk_screen_get_width(screen) && |
269 height >= gdk_screen_get_height(screen)) { | 269 height >= gdk_screen_get_height(screen)) { |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 // are taken from the WMs' source code. | 2050 // are taken from the WMs' source code. |
2051 return (wm_name == "Blackbox" || | 2051 return (wm_name == "Blackbox" || |
2052 wm_name == "compiz" || | 2052 wm_name == "compiz" || |
2053 wm_name == "e16" || // Enlightenment DR16 | 2053 wm_name == "e16" || // Enlightenment DR16 |
2054 wm_name == "KWin" || | 2054 wm_name == "KWin" || |
2055 wm_name == "Metacity" || | 2055 wm_name == "Metacity" || |
2056 wm_name == "Mutter" || | 2056 wm_name == "Mutter" || |
2057 wm_name == "Openbox" || | 2057 wm_name == "Openbox" || |
2058 wm_name == "Xfwm4"); | 2058 wm_name == "Xfwm4"); |
2059 } | 2059 } |
OLD | NEW |