OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/file_util_icu.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
17 #include "base/singleton.h" | 18 #include "base/singleton.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/time.h" | 20 #include "base/time.h" |
20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
21 #include "chrome/app/chrome_command_ids.h" | 22 #include "chrome/app/chrome_command_ids.h" |
22 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 23 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); | 279 window_ = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); |
279 g_object_set_qdata(G_OBJECT(window_), GetBrowserWindowQuarkKey(), this); | 280 g_object_set_qdata(G_OBJECT(window_), GetBrowserWindowQuarkKey(), this); |
280 gtk_widget_add_events(GTK_WIDGET(window_), GDK_BUTTON_PRESS_MASK | | 281 gtk_widget_add_events(GTK_WIDGET(window_), GDK_BUTTON_PRESS_MASK | |
281 GDK_POINTER_MOTION_MASK); | 282 GDK_POINTER_MOTION_MASK); |
282 | 283 |
283 // Add this window to its own unique window group to allow for | 284 // Add this window to its own unique window group to allow for |
284 // window-to-parent modality. | 285 // window-to-parent modality. |
285 gtk_window_group_add_window(gtk_window_group_new(), window_); | 286 gtk_window_group_add_window(gtk_window_group_new(), window_); |
286 g_object_unref(gtk_window_get_group(window_)); | 287 g_object_unref(gtk_window_get_group(window_)); |
287 | 288 |
| 289 if (browser_->type() & Browser::TYPE_APP) { |
| 290 std::string wmclassname = browser_->app_name(); |
| 291 if (wmclassname != DevToolsWindow::kDevToolsApp) { |
| 292 file_util::ReplaceIllegalCharactersInPath(&wmclassname, '_'); |
| 293 TrimString(wmclassname, "_", &wmclassname); |
| 294 gtk_window_set_wmclass(window_, wmclassname.c_str(), |
| 295 wmclassname.c_str()); |
| 296 } |
| 297 } |
| 298 |
288 // For popups, we initialize widgets then set the window geometry, because | 299 // For popups, we initialize widgets then set the window geometry, because |
289 // popups need the widgets inited before they can set the window size | 300 // popups need the widgets inited before they can set the window size |
290 // properly. For other windows, we set the geometry first to prevent resize | 301 // properly. For other windows, we set the geometry first to prevent resize |
291 // flicker. | 302 // flicker. |
292 if (browser_->type() & Browser::TYPE_POPUP) { | 303 if (browser_->type() & Browser::TYPE_POPUP) { |
293 InitWidgets(); | 304 InitWidgets(); |
294 SetGeometryHints(); | 305 SetGeometryHints(); |
295 } else { | 306 } else { |
296 SetGeometryHints(); | 307 SetGeometryHints(); |
297 InitWidgets(); | 308 InitWidgets(); |
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 // special-case the ones where the custom frame should be used. These names | 2266 // special-case the ones where the custom frame should be used. These names |
2256 // are taken from the WMs' source code. | 2267 // are taken from the WMs' source code. |
2257 return (wm_name == "Blackbox" || | 2268 return (wm_name == "Blackbox" || |
2258 wm_name == "compiz" || | 2269 wm_name == "compiz" || |
2259 wm_name == "e16" || // Enlightenment DR16 | 2270 wm_name == "e16" || // Enlightenment DR16 |
2260 wm_name == "Metacity" || | 2271 wm_name == "Metacity" || |
2261 wm_name == "Mutter" || | 2272 wm_name == "Mutter" || |
2262 wm_name == "Openbox" || | 2273 wm_name == "Openbox" || |
2263 wm_name == "Xfwm4"); | 2274 wm_name == "Xfwm4"); |
2264 } | 2275 } |
OLD | NEW |