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