OLD | NEW |
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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | |
11 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
12 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
13 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/profiles/profiles_state.h" | 14 #include "chrome/browser/profiles/profiles_state.h" |
16 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
17 #include "chrome/browser/ui/views/avatar_label.h" | 16 #include "chrome/browser/ui/views/avatar_label.h" |
18 #include "chrome/browser/ui/views/avatar_menu_button.h" | 17 #include "chrome/browser/ui/views/avatar_menu_button.h" |
19 #include "chrome/browser/ui/views/frame/browser_frame.h" | 18 #include "chrome/browser/ui/views/frame/browser_frame.h" |
20 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
21 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" | 20 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" |
22 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci
fic.h" | 21 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_speci
fic.h" |
23 #include "chrome/browser/ui/views/new_avatar_button.h" | 22 #include "chrome/browser/ui/views/new_avatar_button.h" |
24 #include "chrome/browser/ui/views/tab_icon_view.h" | 23 #include "chrome/browser/ui/views/tab_icon_view.h" |
25 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 24 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
26 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 25 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
27 #include "chrome/common/chrome_switches.h" | |
28 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/profile_management_switches.h" | 27 #include "chrome/common/profile_management_switches.h" |
30 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
32 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
33 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
34 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
35 #include "grit/ui_resources.h" | 33 #include "grit/ui_resources.h" |
36 #include "ui/base/accessibility/accessible_view_state.h" | 34 #include "ui/base/accessibility/accessible_view_state.h" |
37 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 return layout_->NonClientBorderThickness(); | 587 return layout_->NonClientBorderThickness(); |
590 } | 588 } |
591 | 589 |
592 gfx::Rect OpaqueBrowserFrameView::IconBounds() const { | 590 gfx::Rect OpaqueBrowserFrameView::IconBounds() const { |
593 return layout_->IconBounds(); | 591 return layout_->IconBounds(); |
594 } | 592 } |
595 | 593 |
596 bool OpaqueBrowserFrameView::ShouldShowWindowTitleBar() const { | 594 bool OpaqueBrowserFrameView::ShouldShowWindowTitleBar() const { |
597 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 595 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
598 // Do not show the custom title bar if the system title bar option is enabled. | 596 // Do not show the custom title bar if the system title bar option is enabled. |
599 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) | 597 if (!frame()->UseCustomFrame()) |
600 return false; | 598 return false; |
601 #endif | 599 #endif |
602 | 600 |
603 // Do not show caption buttons if the window manager is forcefully providing a | 601 // Do not show caption buttons if the window manager is forcefully providing a |
604 // title bar (e.g., in Ubuntu Unity, if the window is maximized). | 602 // title bar (e.g., in Ubuntu Unity, if the window is maximized). |
605 if (!views::ViewsDelegate::views_delegate) | 603 if (!views::ViewsDelegate::views_delegate) |
606 return true; | 604 return true; |
607 return !views::ViewsDelegate::views_delegate->WindowManagerProvidesTitleBar( | 605 return !views::ViewsDelegate::views_delegate->WindowManagerProvidesTitleBar( |
608 IsMaximized()); | 606 IsMaximized()); |
609 } | 607 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 920 |
923 int OpaqueBrowserFrameView::GetTopAreaHeight() const { | 921 int OpaqueBrowserFrameView::GetTopAreaHeight() const { |
924 gfx::ImageSkia* frame_image = GetFrameImage(); | 922 gfx::ImageSkia* frame_image = GetFrameImage(); |
925 int top_area_height = frame_image->height(); | 923 int top_area_height = frame_image->height(); |
926 if (browser_view()->IsTabStripVisible()) { | 924 if (browser_view()->IsTabStripVisible()) { |
927 top_area_height = std::max(top_area_height, | 925 top_area_height = std::max(top_area_height, |
928 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); | 926 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); |
929 } | 927 } |
930 return top_area_height; | 928 return top_area_height; |
931 } | 929 } |
OLD | NEW |