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

Unified Diff: chrome/browser/ui/views/apps/native_app_window_views.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
Index: chrome/browser/ui/views/apps/native_app_window_views.cc
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index b278b0d2e816c59b94482a2ee8492f173f92fa36..4af1e80a27281ad7c735f2ae10c57bf0c962fa6b 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
#include "chrome/browser/ui/views/extensions/shell_window_frame_view.h"
+#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/browser_thread.h"
@@ -29,12 +30,15 @@
#if defined(OS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
-#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_win.h"
#include "ui/base/win/shell.h"
#include "ui/views/win/hwnd_util.h"
#endif
+#if defined(OS_LINUX)
+#include "chrome/browser/shell_integration_linux.h"
+#endif
+
#if defined(USE_ASH)
#include "ash/screen_ash.h"
#include "ash/shell.h"
@@ -156,6 +160,9 @@ NativeAppWindowViews::~NativeAppWindowViews() {
void NativeAppWindowViews::InitializeDefaultWindow(
const ShellWindow::CreateParams& create_params) {
+ std::string app_name =
+ web_app::GenerateApplicationNameFromExtensionId(extension()->id());
+
views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW);
init_params.delegate = this;
init_params.remove_standard_frame = ShouldUseChromeStyleFrame();
@@ -168,6 +175,14 @@ void NativeAppWindowViews::InitializeDefaultWindow(
window_bounds.x() != INT_MIN && window_bounds.y() != INT_MIN;
if (position_specified && !window_bounds.IsEmpty())
init_params.bounds = window_bounds;
+
+#if defined(OS_LINUX)
+ // Set up a custom WM_CLASS for app windows. This allows task switchers in
+ // X11 environments to distinguish them from main browser windows.
+ init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name);
+ init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName();
+#endif
+
window_->Init(init_params);
gfx::Rect adjusted_bounds = window_bounds;
@@ -191,11 +206,10 @@ void NativeAppWindowViews::InitializeDefaultWindow(
}
#if defined(OS_WIN)
- string16 app_name = UTF8ToWide(
- web_app::GenerateApplicationNameFromExtensionId(extension()->id()));
+ string16 app_name_wide = UTF8ToWide(app_name);
HWND hwnd = GetNativeAppWindowHWND();
ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile(
- app_name, profile()->GetPath()), hwnd);
+ app_name_wide, profile()->GetPath()), hwnd);
web_app::UpdateShortcutInfoAndIconForApp(
*extension(), profile(),

Powered by Google App Engine
This is Rietveld 408576698