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

Side by Side Diff: chrome/browser/ui/views/frame/desktop_browser_frame_auralinux.cc

Issue 796433003: MacViews: Don't draw custom frame on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@keybinding3
Patch Set: Created 5 years, 11 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/frame/desktop_browser_frame_auralinux.h"
6
7 #include "base/command_line.h"
8 #include "chrome/browser/shell_integration_linux.h"
9 #include "chrome/browser/ui/views/frame/browser_frame.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/pref_names.h"
13 #include "ui/views/widget/widget.h"
14
15 DesktopBrowserFrameAuraLinux::DesktopBrowserFrameAuraLinux(
16 BrowserFrame* browser_frame,
17 BrowserView* browser_view)
18 : DesktopBrowserFrameAura(browser_frame, browser_view) {
19 use_custom_frame_pref_.Init(
20 prefs::kUseCustomChromeFrame,
21 browser_view->browser()->profile()->GetPrefs(),
22 base::Bind(&DesktopBrowserFrameAuraLinux::OnUseCustomChromeFrameChanged,
23 base::Unretained(this)));
24 }
25
26 DesktopBrowserFrameAuraLinux::~DesktopBrowserFrameAuraLinux() {
27 }
28
29 views::Widget::InitParams DesktopBrowserFrameAuraLinux::GetWidgetParams() {
30 views::Widget::InitParams params;
31 params.native_widget = this;
32
33 // Set up a custom WM_CLASS for some sorts of window types. This allows
34 // task switchers in X11 environments to distinguish between main browser
35 // windows and e.g app windows.
36 const base::CommandLine& command_line =
37 *base::CommandLine::ForCurrentProcess();
38 const Browser& browser = *browser_view()->browser();
39 params.wm_class_class = shell_integration_linux::GetProgramClassName();
40 params.wm_class_name = params.wm_class_class;
41 if (browser.is_app() && !browser.is_devtools()) {
42 // This window is a hosted app or v1 packaged app.
43 // NOTE: v2 packaged app windows are created by ChromeNativeAppWindowViews.
44 params.wm_class_name = web_app::GetWMClassFromAppName(browser.app_name());
45 } else if (command_line.HasSwitch(switches::kUserDataDir)) {
46 // Set the class name to e.g. "Chrome (/tmp/my-user-data)". The
47 // class name will show up in the alt-tab list in gnome-shell if
48 // you're running a binary that doesn't have a matching .desktop
49 // file.
50 const std::string user_data_dir =
51 command_line.GetSwitchValueNative(switches::kUserDataDir);
52 params.wm_class_name += " (" + user_data_dir + ")";
53 }
54 const char kX11WindowRoleBrowser[] = "browser";
55 const char kX11WindowRolePopup[] = "pop-up";
56 params.wm_role_name = browser_view()->browser()->is_type_tabbed() ?
57 std::string(kX11WindowRoleBrowser) : std::string(kX11WindowRolePopup);
58 params.remove_standard_frame = UseCustomFrame();
59
60 return params;
61 }
62
63 bool DesktopBrowserFrameAuraLinux::UseCustomFrame() const {
64 return use_custom_frame_pref_.GetValue() &&
65 browser_view()->IsBrowserTypeNormal();
66 }
67
68 void DesktopBrowserFrameAuraLinux::OnUseCustomChromeFrameChanged() {
69 // Tell the window manager to add or remove system borders.
70 browser_frame()->set_frame_type(
71 UseCustomFrame() ? views::Widget::FRAME_TYPE_FORCE_CUSTOM
72 : views::Widget::FRAME_TYPE_FORCE_NATIVE);
73 browser_frame()->FrameTypeChanged();
74 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/desktop_browser_frame_auralinux.h ('k') | chrome/browser/ui/views/frame/native_browser_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698