| 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_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.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_properties.h" | 9 #include "chrome/browser/themes/theme_properties.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 frame_painter_(new ash::FramePainter), | 78 frame_painter_(new ash::FramePainter), |
| 79 size_button_minimizes_(false) { | 79 size_button_minimizes_(false) { |
| 80 } | 80 } |
| 81 | 81 |
| 82 BrowserNonClientFrameViewAsh::~BrowserNonClientFrameViewAsh() { | 82 BrowserNonClientFrameViewAsh::~BrowserNonClientFrameViewAsh() { |
| 83 } | 83 } |
| 84 | 84 |
| 85 void BrowserNonClientFrameViewAsh::Init() { | 85 void BrowserNonClientFrameViewAsh::Init() { |
| 86 // Panels only minimize. | 86 // Panels only minimize. |
| 87 ash::FramePainter::SizeButtonBehavior size_button_behavior; | 87 ash::FramePainter::SizeButtonBehavior size_button_behavior; |
| 88 if (browser_view()->browser()->is_type_panel() && | 88 size_button_ = new ash::FrameMaximizeButton(this, this); |
| 89 browser_view()->browser()->app_type() == Browser::APP_TYPE_CHILD) { | 89 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MAXIMIZES; |
| 90 size_button_minimizes_ = true; | |
| 91 size_button_ = new views::ImageButton(this); | |
| 92 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MINIMIZES; | |
| 93 } else { | |
| 94 size_button_ = new ash::FrameMaximizeButton(this, this); | |
| 95 size_button_behavior = ash::FramePainter::SIZE_BUTTON_MAXIMIZES; | |
| 96 } | |
| 97 size_button_->SetAccessibleName( | 90 size_button_->SetAccessibleName( |
| 98 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); | 91 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); |
| 99 AddChildView(size_button_); | 92 AddChildView(size_button_); |
| 100 close_button_ = new views::ImageButton(this); | 93 close_button_ = new views::ImageButton(this); |
| 101 close_button_->SetAccessibleName( | 94 close_button_->SetAccessibleName( |
| 102 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 95 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 103 AddChildView(close_button_); | 96 AddChildView(close_button_); |
| 104 | 97 |
| 105 // Initializing the TabIconView is expensive, so only do it if we need to. | 98 // Initializing the TabIconView is expensive, so only do it if we need to. |
| 106 if (browser_view()->ShouldShowWindowIcon()) { | 99 if (browser_view()->ShouldShowWindowIcon()) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // Fullscreen browser (header shows with immersive reveal) -> short header | 354 // Fullscreen browser (header shows with immersive reveal) -> short header |
| 362 // Popup&App window -> tall header | 355 // Popup&App window -> tall header |
| 363 // Panel -> short header | 356 // Panel -> short header |
| 364 // Dialogs use short header and are handled via CustomFrameViewAsh. | 357 // Dialogs use short header and are handled via CustomFrameViewAsh. |
| 365 Browser* browser = browser_view()->browser(); | 358 Browser* browser = browser_view()->browser(); |
| 366 switch (browser->type()) { | 359 switch (browser->type()) { |
| 367 case Browser::TYPE_TABBED: | 360 case Browser::TYPE_TABBED: |
| 368 return frame()->IsMaximized() || frame()->IsFullscreen(); | 361 return frame()->IsMaximized() || frame()->IsFullscreen(); |
| 369 case Browser::TYPE_POPUP: | 362 case Browser::TYPE_POPUP: |
| 370 return false; | 363 return false; |
| 371 case Browser::TYPE_PANEL: | |
| 372 return true; | |
| 373 default: | 364 default: |
| 374 NOTREACHED(); | 365 NOTREACHED(); |
| 375 return false; | 366 return false; |
| 376 } | 367 } |
| 377 } | 368 } |
| 378 | 369 |
| 379 void BrowserNonClientFrameViewAsh::LayoutAvatar() { | 370 void BrowserNonClientFrameViewAsh::LayoutAvatar() { |
| 380 DCHECK(avatar_button()); | 371 DCHECK(avatar_button()); |
| 381 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); | 372 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); |
| 382 | 373 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { | 509 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { |
| 519 ui::ThemeProvider* tp = GetThemeProvider(); | 510 ui::ThemeProvider* tp = GetThemeProvider(); |
| 520 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 511 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 521 browser_view()->IsBrowserTypeNormal() && | 512 browser_view()->IsBrowserTypeNormal() && |
| 522 !browser_view()->IsOffTheRecord()) { | 513 !browser_view()->IsOffTheRecord()) { |
| 523 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? | 514 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? |
| 524 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); | 515 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); |
| 525 } | 516 } |
| 526 return NULL; | 517 return NULL; |
| 527 } | 518 } |
| OLD | NEW |