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 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/browser/ui/gtk/status_bubble_gtk.h" | 63 #include "chrome/browser/ui/gtk/status_bubble_gtk.h" |
64 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" | 64 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" |
65 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 65 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
66 #include "chrome/browser/ui/gtk/task_manager_gtk.h" | 66 #include "chrome/browser/ui/gtk/task_manager_gtk.h" |
67 #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h" | 67 #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h" |
68 #include "chrome/browser/ui/gtk/update_recommended_dialog.h" | 68 #include "chrome/browser/ui/gtk/update_recommended_dialog.h" |
69 #include "chrome/browser/ui/omnibox/location_bar.h" | 69 #include "chrome/browser/ui/omnibox/location_bar.h" |
70 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 70 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
71 #include "chrome/browser/ui/webui/bug_report_ui.h" | 71 #include "chrome/browser/ui/webui/bug_report_ui.h" |
72 #include "chrome/browser/ui/window_sizer.h" | 72 #include "chrome/browser/ui/window_sizer.h" |
| 73 #include "chrome/browser/web_applications/web_app.h" |
73 #include "chrome/common/chrome_switches.h" | 74 #include "chrome/common/chrome_switches.h" |
74 #include "chrome/common/pref_names.h" | 75 #include "chrome/common/pref_names.h" |
75 #include "content/browser/renderer_host/render_widget_host_view.h" | 76 #include "content/browser/renderer_host/render_widget_host_view.h" |
76 #include "content/browser/tab_contents/tab_contents.h" | 77 #include "content/browser/tab_contents/tab_contents.h" |
77 #include "content/browser/tab_contents/tab_contents_view.h" | 78 #include "content/browser/tab_contents/tab_contents_view.h" |
78 #include "content/common/native_web_keyboard_event.h" | 79 #include "content/common/native_web_keyboard_event.h" |
79 #include "content/common/notification_service.h" | 80 #include "content/common/notification_service.h" |
80 #include "grit/app_resources.h" | 81 #include "grit/app_resources.h" |
81 #include "grit/chromium_strings.h" | 82 #include "grit/chromium_strings.h" |
82 #include "grit/generated_resources.h" | 83 #include "grit/generated_resources.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 g_object_set_qdata(G_OBJECT(window_), GetBrowserWindowQuarkKey(), this); | 287 g_object_set_qdata(G_OBJECT(window_), GetBrowserWindowQuarkKey(), this); |
287 gtk_widget_add_events(GTK_WIDGET(window_), GDK_BUTTON_PRESS_MASK | | 288 gtk_widget_add_events(GTK_WIDGET(window_), GDK_BUTTON_PRESS_MASK | |
288 GDK_POINTER_MOTION_MASK); | 289 GDK_POINTER_MOTION_MASK); |
289 | 290 |
290 // Add this window to its own unique window group to allow for | 291 // Add this window to its own unique window group to allow for |
291 // window-to-parent modality. | 292 // window-to-parent modality. |
292 gtk_window_group_add_window(gtk_window_group_new(), window_); | 293 gtk_window_group_add_window(gtk_window_group_new(), window_); |
293 g_object_unref(gtk_window_get_group(window_)); | 294 g_object_unref(gtk_window_get_group(window_)); |
294 | 295 |
295 if (browser_->type() & Browser::TYPE_APP) { | 296 if (browser_->type() & Browser::TYPE_APP) { |
296 std::string wmclassname = browser_->app_name(); | 297 std::string app_name = browser_->app_name(); |
297 if (wmclassname != DevToolsWindow::kDevToolsApp) { | 298 if (app_name != DevToolsWindow::kDevToolsApp) { |
298 file_util::ReplaceIllegalCharactersInPath(&wmclassname, '_'); | 299 std::string wmclassname = web_app::GetWMClassFromAppName(app_name); |
299 TrimString(wmclassname, "_", &wmclassname); | 300 gtk_window_set_wmclass(window_, |
300 gtk_window_set_wmclass(window_, wmclassname.c_str(), | 301 wmclassname.c_str(), |
301 wmclassname.c_str()); | 302 gdk_get_program_class()); |
302 } | 303 } |
303 } | 304 } |
304 | 305 |
305 // For popups, we initialize widgets then set the window geometry, because | 306 // For popups, we initialize widgets then set the window geometry, because |
306 // popups need the widgets inited before they can set the window size | 307 // popups need the widgets inited before they can set the window size |
307 // properly. For other windows, we set the geometry first to prevent resize | 308 // properly. For other windows, we set the geometry first to prevent resize |
308 // flicker. | 309 // flicker. |
309 if (browser_->type() & Browser::TYPE_POPUP) { | 310 if (browser_->type() & Browser::TYPE_POPUP) { |
310 InitWidgets(); | 311 InitWidgets(); |
311 SetGeometryHints(); | 312 SetGeometryHints(); |
(...skipping 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 // special-case the ones where the custom frame should be used. These names | 2290 // special-case the ones where the custom frame should be used. These names |
2290 // are taken from the WMs' source code. | 2291 // are taken from the WMs' source code. |
2291 return (wm_name == "Blackbox" || | 2292 return (wm_name == "Blackbox" || |
2292 wm_name == "compiz" || | 2293 wm_name == "compiz" || |
2293 wm_name == "e16" || // Enlightenment DR16 | 2294 wm_name == "e16" || // Enlightenment DR16 |
2294 wm_name == "Metacity" || | 2295 wm_name == "Metacity" || |
2295 wm_name == "Mutter" || | 2296 wm_name == "Mutter" || |
2296 wm_name == "Openbox" || | 2297 wm_name == "Openbox" || |
2297 wm_name == "Xfwm4"); | 2298 wm_name == "Xfwm4"); |
2298 } | 2299 } |
OLD | NEW |