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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/frame/browser_frame.h" 5 #include "chrome/browser/ui/views/frame/browser_frame.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/command_line.h"
8 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
9 #include "chrome/browser/app_mode/app_mode_utils.h" 10 #include "chrome/browser/app_mode/app_mode_utils.h"
10 #include "chrome/browser/themes/theme_service.h" 11 #include "chrome/browser/themes/theme_service.h"
11 #include "chrome/browser/themes/theme_service_factory.h" 12 #include "chrome/browser/themes/theme_service_factory.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/browser_window_state.h" 15 #include "chrome/browser/ui/browser_window_state.h"
15 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 16 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
16 #include "chrome/browser/ui/views/frame/browser_root_view.h" 17 #include "chrome/browser/ui/views/frame/browser_root_view.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
18 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 19 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
19 #include "chrome/browser/ui/views/frame/native_browser_frame.h" 20 #include "chrome/browser/ui/views/frame/native_browser_frame.h"
20 #include "chrome/browser/ui/views/frame/system_menu_model_builder.h" 21 #include "chrome/browser/ui/views/frame/system_menu_model_builder.h"
21 #include "chrome/browser/ui/views/frame/top_container_view.h" 22 #include "chrome/browser/ui/views/frame/top_container_view.h"
23 #include "chrome/browser/web_applications/web_app.h"
22 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
23 #include "ui/aura/root_window.h" 25 #include "ui/aura/root_window.h"
24 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
25 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
26 #include "ui/base/theme_provider.h" 28 #include "ui/base/theme_provider.h"
27 #include "ui/gfx/screen.h" 29 #include "ui/gfx/screen.h"
28 #include "ui/views/controls/menu/menu_runner.h" 30 #include "ui/views/controls/menu/menu_runner.h"
29 #include "ui/views/widget/native_widget.h" 31 #include "ui/views/widget/native_widget.h"
30 32
31 #if defined(OS_WIN) && !defined(USE_AURA) 33 #if defined(OS_WIN) && !defined(USE_AURA)
32 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" 34 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
33 #endif 35 #endif
34 36
37 #if defined(OS_LINUX)
38 #include "chrome/browser/shell_integration_linux.h"
39 #endif
40
35 #if defined(USE_ASH) 41 #if defined(USE_ASH)
36 #include "chrome/browser/ui/ash/ash_init.h" 42 #include "chrome/browser/ui/ash/ash_init.h"
37 #endif 43 #endif
38 44
39 //////////////////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////////////////
40 // BrowserFrame, public: 46 // BrowserFrame, public:
41 47
42 BrowserFrame::BrowserFrame(BrowserView* browser_view) 48 BrowserFrame::BrowserFrame(BrowserView* browser_view)
43 : native_browser_frame_(NULL), 49 : native_browser_frame_(NULL),
44 root_view_(NULL), 50 root_view_(NULL),
(...skipping 22 matching lines...) Expand all
67 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(), 73 chrome::GetSavedWindowBoundsAndShowState(browser_view_->browser(),
68 &params.bounds, 74 &params.bounds,
69 &params.show_state); 75 &params.show_state);
70 } 76 }
71 #if defined(USE_ASH) 77 #if defined(USE_ASH)
72 if (browser_view_->browser()->host_desktop_type() == 78 if (browser_view_->browser()->host_desktop_type() ==
73 chrome::HOST_DESKTOP_TYPE_ASH || chrome::ShouldOpenAshOnStartup()) { 79 chrome::HOST_DESKTOP_TYPE_ASH || chrome::ShouldOpenAshOnStartup()) {
74 params.context = ash::Shell::GetAllRootWindows()[0]; 80 params.context = ash::Shell::GetAllRootWindows()[0];
75 } 81 }
76 #endif 82 #endif
83
84 #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
85 // Set up a custom WM_CLASS for some sorts of window types. This allows
86 // task switchers in X11 environments to distinguish between main browser
87 // windows and e.g app windows.
88 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
89 const Browser& browser = *browser_view_->browser();
90 params.wm_class_class = ShellIntegrationLinux::GetProgramClassName();
91 params.wm_class_name = params.wm_class_class;
92 if (browser.is_app() && !browser.is_devtools()) {
93 // This window is a hosted app or v1 packaged app.
94 // NOTE: v2 packaged app windows are created by NativeAppWindowViews.
95 params.wm_class_name = web_app::GetWMClassFromAppName(browser.app_name());
96 } else if (command_line.HasSwitch(switches::kUserDataDir)) {
97 // Set the class name to e.g. "Chrome (/tmp/my-user-data)". The
98 // class name will show up in the alt-tab list in gnome-shell if
99 // you're running a binary that doesn't have a matching .desktop
100 // file.
101 const std::string user_data_dir =
102 command_line.GetSwitchValueNative(switches::kUserDataDir);
103 params.wm_class_name += " (" + user_data_dir + ")";
104 }
105 #endif // defined(OS_LINUX)
106
77 Init(params); 107 Init(params);
78 108
79 if (!native_browser_frame_->UsesNativeSystemMenu()) { 109 if (!native_browser_frame_->UsesNativeSystemMenu()) {
80 DCHECK(non_client_view()); 110 DCHECK(non_client_view());
81 non_client_view()->set_context_menu_controller(this); 111 non_client_view()->set_context_menu_controller(this);
82 } 112 }
83 } 113 }
84 114
85 void BrowserFrame::SetThemeProvider(scoped_ptr<ui::ThemeProvider> provider) { 115 void BrowserFrame::SetThemeProvider(scoped_ptr<ui::ThemeProvider> provider) {
86 owned_theme_provider_ = provider.Pass(); 116 owned_theme_provider_ = provider.Pass();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 236
207 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() { 237 AvatarMenuButton* BrowserFrame::GetAvatarMenuButton() {
208 return browser_frame_view_->avatar_button(); 238 return browser_frame_view_->avatar_button();
209 } 239 }
210 240
211 #if !defined(OS_WIN) || defined(USE_AURA) 241 #if !defined(OS_WIN) || defined(USE_AURA)
212 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() { 242 bool BrowserFrame::ShouldLeaveOffsetNearTopBorder() {
213 return !IsMaximized(); 243 return !IsMaximized();
214 } 244 }
215 #endif // OS_WIN 245 #endif // OS_WIN
OLDNEW
« 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