| 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 /////////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////////// |
| 42 // OpaqueBrowserFrameViewLinux, | 48 // OpaqueBrowserFrameViewLinux, |
| 43 // views::WindowButtonOrderObserver implementation: | 49 // views::WindowButtonOrderObserver implementation: |
| 44 | 50 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 /////////////////////////////////////////////////////////////////////////////// | 65 /////////////////////////////////////////////////////////////////////////////// |
| 60 // OpaqueBrowserFrameViewObserver: | 66 // OpaqueBrowserFrameViewObserver: |
| 61 | 67 |
| 62 // static | 68 // static |
| 63 OpaqueBrowserFrameViewPlatformSpecific* | 69 OpaqueBrowserFrameViewPlatformSpecific* |
| 64 OpaqueBrowserFrameViewPlatformSpecific::Create( | 70 OpaqueBrowserFrameViewPlatformSpecific::Create( |
| 65 OpaqueBrowserFrameView* view, | 71 OpaqueBrowserFrameView* view, |
| 66 OpaqueBrowserFrameViewLayout* layout) { | 72 OpaqueBrowserFrameViewLayout* layout) { |
| 67 return new OpaqueBrowserFrameViewLinux(view, layout); | 73 return new OpaqueBrowserFrameViewLinux(view, layout); |
| 68 } | 74 } |
| OLD | NEW |