Chromium Code Reviews| 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/browser_non_client_frame_view_aura.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h" |
| 6 | 6 |
| 7 #include "ash/wm/frame_painter.h" | 7 #include "ash/wm/frame_painter.h" |
| 8 #include "ash/wm/workspace/frame_maximize_button.h" | 8 #include "ash/wm/workspace/frame_maximize_button.h" |
| 9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
| 10 #include "chrome/browser/ui/views/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 // Caption buttons. | 72 // Caption buttons. |
| 73 maximize_button_ = new ash::FrameMaximizeButton(this, this); | 73 maximize_button_ = new ash::FrameMaximizeButton(this, this); |
| 74 maximize_button_->SetAccessibleName( | 74 maximize_button_->SetAccessibleName( |
| 75 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); | 75 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); |
| 76 AddChildView(maximize_button_); | 76 AddChildView(maximize_button_); |
| 77 close_button_ = new views::ImageButton(this); | 77 close_button_ = new views::ImageButton(this); |
| 78 close_button_->SetAccessibleName( | 78 close_button_->SetAccessibleName( |
| 79 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 79 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 80 AddChildView(close_button_); | 80 AddChildView(close_button_); |
| 81 | 81 |
| 82 // For Ash only, app windows do not show an icon. crbug.com/119411 | |
| 83 bool show_icon = !browser_view()->browser()->is_app() && | |
| 84 browser_view()->ShouldShowWindowIcon(); | |
| 85 | |
| 82 // Initializing the TabIconView is expensive, so only do it if we need to. | 86 // Initializing the TabIconView is expensive, so only do it if we need to. |
| 83 if (browser_view()->ShouldShowWindowIcon()) { | 87 if (show_icon) { |
|
sky
2012/03/22 16:58:12
Wouldn't it be better to put this in ShouldShowWin
| |
| 84 window_icon_ = new TabIconView(this); | 88 window_icon_ = new TabIconView(this); |
| 85 window_icon_->set_is_light(true); | 89 window_icon_->set_is_light(true); |
| 86 AddChildView(window_icon_); | 90 AddChildView(window_icon_); |
| 87 window_icon_->Update(); | 91 window_icon_->Update(); |
| 88 } | 92 } |
| 89 | 93 |
| 90 // Create incognito icon if necessary. | 94 // Create incognito icon if necessary. |
| 91 UpdateAvatarInfo(); | 95 UpdateAvatarInfo(); |
| 92 | 96 |
| 93 // Frame painter handles layout of these buttons. | 97 // Frame painter handles layout of these buttons. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 | 178 |
| 175 void BrowserNonClientFrameViewAura::OnPaint(gfx::Canvas* canvas) { | 179 void BrowserNonClientFrameViewAura::OnPaint(gfx::Canvas* canvas) { |
| 176 if (frame()->IsFullscreen()) | 180 if (frame()->IsFullscreen()) |
| 177 return; // Nothing visible, don't paint. | 181 return; // Nothing visible, don't paint. |
| 178 // The primary header image changes based on window activation state and | 182 // The primary header image changes based on window activation state and |
| 179 // theme, so we look it up for each paint. | 183 // theme, so we look it up for each paint. |
| 180 frame_painter_->PaintHeader(this, | 184 frame_painter_->PaintHeader(this, |
| 181 canvas, | 185 canvas, |
| 182 GetThemeFrameBitmap(), | 186 GetThemeFrameBitmap(), |
| 183 GetThemeFrameOverlayBitmap()); | 187 GetThemeFrameOverlayBitmap()); |
| 184 frame_painter_->PaintTitleBar(this, canvas, BrowserFrame::GetTitleFont()); | 188 // For Ash only, app windows do not show title text. crbug.com/119411 |
| 189 if (!browser_view()->browser()->is_app() && | |
| 190 browser_view()->ShouldShowWindowTitle()) | |
| 191 frame_painter_->PaintTitleBar(this, canvas, BrowserFrame::GetTitleFont()); | |
| 185 if (browser_view()->IsToolbarVisible()) | 192 if (browser_view()->IsToolbarVisible()) |
| 186 PaintToolbarBackground(canvas); | 193 PaintToolbarBackground(canvas); |
| 187 } | 194 } |
| 188 | 195 |
| 189 void BrowserNonClientFrameViewAura::Layout() { | 196 void BrowserNonClientFrameViewAura::Layout() { |
| 190 // Maximized windows and app/popup windows use shorter buttons. | 197 // Maximized windows and app/popup windows use shorter buttons. |
| 191 bool maximized_layout = | 198 bool maximized_layout = |
| 192 frame()->IsMaximized() || !browser_view()->IsBrowserTypeNormal(); | 199 frame()->IsMaximized() || !browser_view()->IsBrowserTypeNormal(); |
| 193 frame_painter_->LayoutHeader(this, maximized_layout); | 200 frame_painter_->LayoutHeader(this, maximized_layout); |
| 194 if (avatar_button()) | 201 if (avatar_button()) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 } | 414 } |
| 408 | 415 |
| 409 SkBitmap* BrowserNonClientFrameViewAura::GetCustomBitmap( | 416 SkBitmap* BrowserNonClientFrameViewAura::GetCustomBitmap( |
| 410 int bitmap_id, | 417 int bitmap_id, |
| 411 int fallback_bitmap_id) const { | 418 int fallback_bitmap_id) const { |
| 412 ui::ThemeProvider* tp = GetThemeProvider(); | 419 ui::ThemeProvider* tp = GetThemeProvider(); |
| 413 if (tp->HasCustomImage(bitmap_id)) | 420 if (tp->HasCustomImage(bitmap_id)) |
| 414 return tp->GetBitmapNamed(bitmap_id); | 421 return tp->GetBitmapNamed(bitmap_id); |
| 415 return tp->GetBitmapNamed(fallback_bitmap_id); | 422 return tp->GetBitmapNamed(fallback_bitmap_id); |
| 416 } | 423 } |
| OLD | NEW |