#include "ash/wm/caption_buttons/frame_caption_button_container_view.h"
#include "ash/wm/frame_border_hit_test_controller.h"
#include "ash/wm/header_painter.h"
+#include "base/command_line.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/avatar_label.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
+#include "chrome/common/chrome_switches.h"
#include "content/public/browser/web_contents.h"
#include "grit/ash_resources.h"
#include "grit/theme_resources.h"
// Create incognito icon if necessary.
UpdateAvatarInfo();
- // Frame painter handles layout.
+ // HeaderPainter handles layout.
header_painter_->Init(frame(), this, window_icon_, caption_button_container_);
}
return 0;
if (browser_view()->IsTabStripVisible()) {
- if (UseShortHeader())
+ if (frame()->IsMaximized() || frame()->IsFullscreen())
return kTabstripTopSpacingShort;
else
return kTabstripTopSpacingTall;
if (browser_view()->IsToolbarVisible())
return caption_buttons_bottom - kContentShadowHeight;
- return caption_buttons_bottom + kClientEdgeThickness;
+ int separator_thickness = UsePackagedAppHeaderStyle() ?
+ header_painter_->HeaderContentSeparatorSize() : kClientEdgeThickness;
+ return caption_buttons_bottom + separator_thickness;
}
int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const {
}
void BrowserNonClientFrameViewAsh::GetWindowMask(const gfx::Size& size,
- gfx::Path* window_mask) {
+ gfx::Path* window_mask) {
// Aura does not use window masks.
}
}
void BrowserNonClientFrameViewAsh::Layout() {
+ // The header must be laid out before computing |header_height| because the
+ // computation of |header_height| for app and popup windows depends on the
+ // position of the window controls.
+ header_painter_->LayoutHeader(UsePackagedAppHeaderStyle() ||
+ frame()->IsMaximized() ||
+ frame()->IsFullscreen());
+
int header_height = 0;
if (browser_view()->IsTabStripVisible()) {
header_height = GetTopInset() +
header_height = GetTopInset();
}
header_painter_->set_header_height(header_height);
- header_painter_->LayoutHeader(UseShortHeader());
if (avatar_button())
LayoutAvatar();
BrowserNonClientFrameView::Layout();
return header_painter_->GetRightInset() + kTabstripRightSpacing;
}
-bool BrowserNonClientFrameViewAsh::UseShortHeader() const {
- // Restored browser windows use the tall header. All other windows use the
- // short header.
- return frame()->IsMaximized() ||
- frame()->IsFullscreen() ||
- browser_view()->browser()->is_app();
-}
-
bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const {
ImmersiveModeController* immersive_controller =
browser_view()->immersive_mode_controller();
browser_view()->IsTabStripVisible();
}
+bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const {
+ // Non streamlined hosted apps do not have a toolbar or tabstrip. Their header
+ // should look the same as the header for packaged apps. Streamlined hosted
+ // apps have a toolbar so should use the browser header style.
+ return browser_view()->browser()->is_app() &&
+ !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableStreamlinedHostedApps);
+}
+
void BrowserNonClientFrameViewAsh::LayoutAvatar() {
DCHECK(avatar_button());
DCHECK(browser_view()->IsTabStripVisible());
}
void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) {
- canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(),
- width(), kClientEdgeThickness),
- ThemeProperties::GetDefaultColor(
- ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
+ if (UsePackagedAppHeaderStyle()) {
+ header_painter_->PaintHeaderContentSeparator(canvas);
+ } else {
+ canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(),
+ width(), kClientEdgeThickness),
+ ThemeProperties::GetDefaultColor(
+ ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
+ }
}
int BrowserNonClientFrameViewAsh::GetThemeFrameImageId() const {