OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/opaque_browser_frame_view_linux.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_linux.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" | 8 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
8 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" | 9 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 10 #include "chrome/common/chrome_switches.h" |
9 #include "ui/views/linux_ui/linux_ui.h" | 11 #include "ui/views/linux_ui/linux_ui.h" |
10 | 12 |
11 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
12 // OpaqueBrowserFrameViewLinux, public: | 14 // OpaqueBrowserFrameViewLinux, public: |
13 | 15 |
14 OpaqueBrowserFrameViewLinux::OpaqueBrowserFrameViewLinux( | 16 OpaqueBrowserFrameViewLinux::OpaqueBrowserFrameViewLinux( |
15 OpaqueBrowserFrameView* view, | 17 OpaqueBrowserFrameView* view, |
16 OpaqueBrowserFrameViewLayout* layout) | 18 OpaqueBrowserFrameViewLayout* layout) |
17 : view_(view), | 19 : view_(view), |
18 layout_(layout) { | 20 layout_(layout) { |
19 views::LinuxUI* ui = views::LinuxUI::instance(); | 21 views::LinuxUI* ui = views::LinuxUI::instance(); |
20 if (ui) | 22 if (ui) |
21 ui->AddWindowButtonOrderObserver(this); | 23 ui->AddWindowButtonOrderObserver(this); |
22 } | 24 } |
23 | 25 |
24 OpaqueBrowserFrameViewLinux::~OpaqueBrowserFrameViewLinux() { | 26 OpaqueBrowserFrameViewLinux::~OpaqueBrowserFrameViewLinux() { |
25 views::LinuxUI* ui = views::LinuxUI::instance(); | 27 views::LinuxUI* ui = views::LinuxUI::instance(); |
26 if (ui) | 28 if (ui) |
27 ui->RemoveWindowButtonOrderObserver(this); | 29 ui->RemoveWindowButtonOrderObserver(this); |
28 } | 30 } |
29 | 31 |
30 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
31 // OpaqueBrowserFrameViewLinux, | 33 // OpaqueBrowserFrameViewLinux, |
32 // OpaqueBrowserFrameViewPlatformSpecific implementation: | 34 // OpaqueBrowserFrameViewPlatformSpecific implementation: |
33 | 35 |
34 bool OpaqueBrowserFrameViewLinux::ShouldShowCaptionButtons() const { | 36 bool OpaqueBrowserFrameViewLinux::ShouldShowCaptionButtons() const { |
| 37 // Do not show caption buttons if the system title bar is being used. |
| 38 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) |
| 39 return false; |
| 40 |
35 // On Ubuntu Unity, if the window is maximized, the system will provide | 41 // On Ubuntu Unity, if the window is maximized, the system will provide |
36 // caption buttons, so Chrome should not add its own. | 42 // caption buttons, so Chrome should not add its own. |
37 views::LinuxUI* ui = views::LinuxUI::instance(); | 43 views::LinuxUI* ui = views::LinuxUI::instance(); |
38 return !(view_->IsMaximized() && ui && ui->UnityIsRunning()); | 44 return !(view_->IsMaximized() && ui && ui->UnityIsRunning()); |
39 } | 45 } |
40 | 46 |
41 bool OpaqueBrowserFrameViewLinux::ShouldShowTitleBar() const { | 47 bool OpaqueBrowserFrameViewLinux::ShouldShowTitleBar() const { |
42 // On Ubuntu Unity, if the window is maximized, the system will provide | 48 // On Ubuntu Unity, if the window is maximized, the system will provide |
43 // a title bar, so Chrome should not add its own. | 49 // a title bar, so Chrome should not add its own. |
44 views::LinuxUI* ui = views::LinuxUI::instance(); | 50 views::LinuxUI* ui = views::LinuxUI::instance(); |
(...skipping 21 matching lines...) Expand all Loading... |
66 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
67 // OpaqueBrowserFrameViewObserver: | 73 // OpaqueBrowserFrameViewObserver: |
68 | 74 |
69 // static | 75 // static |
70 OpaqueBrowserFrameViewPlatformSpecific* | 76 OpaqueBrowserFrameViewPlatformSpecific* |
71 OpaqueBrowserFrameViewPlatformSpecific::Create( | 77 OpaqueBrowserFrameViewPlatformSpecific::Create( |
72 OpaqueBrowserFrameView* view, | 78 OpaqueBrowserFrameView* view, |
73 OpaqueBrowserFrameViewLayout* layout) { | 79 OpaqueBrowserFrameViewLayout* layout) { |
74 return new OpaqueBrowserFrameViewLinux(view, layout); | 80 return new OpaqueBrowserFrameViewLinux(view, layout); |
75 } | 81 } |
OLD | NEW |