Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1151)

Unified Diff: chrome/browser/ui/views/frame/browser_frame.cc

Issue 23093020: Set the WM_CLASS property of X11 windows in Linux Aura build. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Respond to reviews. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_views.cc ('k') | chrome/browser/web_applications/web_app.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/frame/browser_frame.cc
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 23b200538718ae638674ca2d4b494ac2b52873aa..4c7eebcd6295005d09318a9fae38e19c0f341cd0 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "ash/shell.h"
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/themes/theme_service.h"
@@ -19,6 +20,7 @@
#include "chrome/browser/ui/views/frame/native_browser_frame.h"
#include "chrome/browser/ui/views/frame/system_menu_model_builder.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
+#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -32,6 +34,10 @@
#include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
#endif
+#if defined(OS_LINUX)
+#include "chrome/browser/shell_integration_linux.h"
+#endif
+
#if defined(USE_ASH)
#include "chrome/browser/ui/ash/ash_init.h"
#endif
@@ -74,6 +80,30 @@ void BrowserFrame::InitBrowserFrame() {
params.context = ash::Shell::GetAllRootWindows()[0];
}
#endif
+
+#if defined(OS_LINUX)
sky 2013/08/29 15:33:47 Can this be moved to BrowserDesktopRootWindowHostX
Matt Giuca 2013/08/30 02:47:33 Good point. I've tried this and it worked OK for b
+ // Set up a custom WM_CLASS for some sorts of window types. This allows
+ // task switchers in X11 environments to distinguish between main browser
+ // windows and e.g app windows.
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ const Browser& browser = *browser_view_->browser();
+ params.wm_class_class = ShellIntegrationLinux::GetProgramClassName();
+ params.wm_class_name = params.wm_class_class;
+ if (browser.is_app() && !browser.is_devtools()) {
+ // This window is a hosted app or v1 packaged app.
+ // NOTE: v2 packaged app windows are created by NativeAppWindowViews.
+ params.wm_class_name = web_app::GetWMClassFromAppName(browser.app_name());
+ } else if (command_line.HasSwitch(switches::kUserDataDir)) {
+ // Set the class name to e.g. "Chrome (/tmp/my-user-data)". The
+ // class name will show up in the alt-tab list in gnome-shell if
+ // you're running a binary that doesn't have a matching .desktop
+ // file.
+ const std::string user_data_dir =
+ command_line.GetSwitchValueNative(switches::kUserDataDir);
+ params.wm_class_name += " (" + user_data_dir + ")";
+ }
+#endif // defined(OS_LINUX)
+
Init(params);
if (!native_browser_frame_->UsesNativeSystemMenu()) {
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_views.cc ('k') | chrome/browser/web_applications/web_app.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698