| 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 "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" | 7 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 8 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" | 8 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
| 9 #include "ui/views/linux_ui/linux_ui.h" | 9 #include "ui/views/linux_ui/linux_ui.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 // OpaqueBrowserFrameViewLinux, | 31 // OpaqueBrowserFrameViewLinux, |
| 32 // OpaqueBrowserFrameViewPlatformSpecific implementation: | 32 // OpaqueBrowserFrameViewPlatformSpecific implementation: |
| 33 | 33 |
| 34 bool OpaqueBrowserFrameViewLinux::ShouldShowCaptionButtons() const { | 34 bool OpaqueBrowserFrameViewLinux::ShouldShowCaptionButtons() const { |
| 35 // On Ubuntu Unity, if the window is maximized, the system will provide | 35 // On Ubuntu Unity, if the window is maximized, the system will provide |
| 36 // caption buttons, so Chrome should not add its own. | 36 // caption buttons, so Chrome should not add its own. |
| 37 views::LinuxUI* ui = views::LinuxUI::instance(); | 37 views::LinuxUI* ui = views::LinuxUI::instance(); |
| 38 return !(view_->IsMaximized() && ui && ui->UnityIsRunning()); | 38 return !(view_->IsMaximized() && ui && ui->UnityIsRunning()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool OpaqueBrowserFrameViewLinux::ShouldShowTitleBar() const { |
| 42 // On Ubuntu Unity, if the window is maximized, the system will provide |
| 43 // a title bar, so Chrome should not add its own. |
| 44 views::LinuxUI* ui = views::LinuxUI::instance(); |
| 45 return !(view_->IsMaximized() && ui && ui->UnityIsRunning()); |
| 46 } |
| 47 |
| 41 /////////////////////////////////////////////////////////////////////////////// | 48 /////////////////////////////////////////////////////////////////////////////// |
| 42 // OpaqueBrowserFrameViewLinux, | 49 // OpaqueBrowserFrameViewLinux, |
| 43 // views::WindowButtonOrderObserver implementation: | 50 // views::WindowButtonOrderObserver implementation: |
| 44 | 51 |
| 45 void OpaqueBrowserFrameViewLinux::OnWindowButtonOrderingChange( | 52 void OpaqueBrowserFrameViewLinux::OnWindowButtonOrderingChange( |
| 46 const std::vector<views::FrameButton>& leading_buttons, | 53 const std::vector<views::FrameButton>& leading_buttons, |
| 47 const std::vector<views::FrameButton>& trailing_buttons) { | 54 const std::vector<views::FrameButton>& trailing_buttons) { |
| 48 layout_->SetButtonOrdering(leading_buttons, trailing_buttons); | 55 layout_->SetButtonOrdering(leading_buttons, trailing_buttons); |
| 49 | 56 |
| 50 // We can receive OnWindowButtonOrderingChange events before we've been added | 57 // We can receive OnWindowButtonOrderingChange events before we've been added |
| 51 // to a Widget. We need a Widget because layout crashes due to dependencies | 58 // to a Widget. We need a Widget because layout crashes due to dependencies |
| 52 // on a ui::ThemeProvider(). | 59 // on a ui::ThemeProvider(). |
| 53 if (view_->GetWidget()) { | 60 if (view_->GetWidget()) { |
| 54 view_->Layout(); | 61 view_->Layout(); |
| 55 view_->SchedulePaint(); | 62 view_->SchedulePaint(); |
| 56 } | 63 } |
| 57 } | 64 } |
| 58 | 65 |
| 59 /////////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////////// |
| 60 // OpaqueBrowserFrameViewObserver: | 67 // OpaqueBrowserFrameViewObserver: |
| 61 | 68 |
| 62 // static | 69 // static |
| 63 OpaqueBrowserFrameViewPlatformSpecific* | 70 OpaqueBrowserFrameViewPlatformSpecific* |
| 64 OpaqueBrowserFrameViewPlatformSpecific::Create( | 71 OpaqueBrowserFrameViewPlatformSpecific::Create( |
| 65 OpaqueBrowserFrameView* view, | 72 OpaqueBrowserFrameView* view, |
| 66 OpaqueBrowserFrameViewLayout* layout) { | 73 OpaqueBrowserFrameViewLayout* layout) { |
| 67 return new OpaqueBrowserFrameViewLinux(view, layout); | 74 return new OpaqueBrowserFrameViewLinux(view, layout); |
| 68 } | 75 } |
| OLD | NEW |