| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 5 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return std::min(1.0, std::max(0.0, value)); | 102 return std::min(1.0, std::max(0.0, value)); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 // static | 107 // static |
| 108 const char FrameCaptionButtonContainerView::kViewClassName[] = | 108 const char FrameCaptionButtonContainerView::kViewClassName[] = |
| 109 "FrameCaptionButtonContainerView"; | 109 "FrameCaptionButtonContainerView"; |
| 110 | 110 |
| 111 FrameCaptionButtonContainerView::FrameCaptionButtonContainerView( | 111 FrameCaptionButtonContainerView::FrameCaptionButtonContainerView( |
| 112 views::Widget* frame, | 112 views::Widget* frame) |
| 113 MinimizeAllowed minimize_allowed) | |
| 114 : frame_(frame), | 113 : frame_(frame), |
| 115 minimize_button_(NULL), | 114 minimize_button_(NULL), |
| 116 size_button_(NULL), | 115 size_button_(NULL), |
| 117 close_button_(NULL) { | 116 close_button_(NULL) { |
| 118 bool size_button_visibility = ShouldSizeButtonBeVisible(); | 117 bool size_button_visibility = ShouldSizeButtonBeVisible(); |
| 119 maximize_mode_animation_.reset(new gfx::SlideAnimation(this)); | 118 maximize_mode_animation_.reset(new gfx::SlideAnimation(this)); |
| 120 maximize_mode_animation_->SetTweenType(gfx::Tween::LINEAR); | 119 maximize_mode_animation_->SetTweenType(gfx::Tween::LINEAR); |
| 121 | 120 |
| 122 // Ensure animation tracks visibility of size button. | 121 // Ensure animation tracks visibility of size button. |
| 123 if (size_button_visibility) | 122 if (size_button_visibility) |
| 124 maximize_mode_animation_->Reset(1.0f); | 123 maximize_mode_animation_->Reset(1.0f); |
| 125 | 124 |
| 126 // Insert the buttons left to right. | 125 // Insert the buttons left to right. |
| 127 minimize_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_MINIMIZE); | 126 minimize_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_MINIMIZE); |
| 128 minimize_button_->SetAccessibleName( | 127 minimize_button_->SetAccessibleName( |
| 129 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); | 128 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); |
| 130 minimize_button_->SetVisible(minimize_allowed == MINIMIZE_ALLOWED); | 129 minimize_button_->SetVisible(frame_->widget_delegate()->CanMinimize()); |
| 131 AddChildView(minimize_button_); | 130 AddChildView(minimize_button_); |
| 132 | 131 |
| 133 size_button_ = new FrameSizeButton(this, frame, this); | 132 size_button_ = new FrameSizeButton(this, frame, this); |
| 134 size_button_->SetAccessibleName( | 133 size_button_->SetAccessibleName( |
| 135 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE)); | 134 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE)); |
| 136 size_button_->SetVisible(size_button_visibility); | 135 size_button_->SetVisible(size_button_visibility); |
| 137 AddChildView(size_button_); | 136 AddChildView(size_button_); |
| 138 | 137 |
| 139 close_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_CLOSE); | 138 close_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_CLOSE); |
| 140 close_button_->SetAccessibleName( | 139 close_button_->SetAccessibleName( |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 : icon_image_id(icon_id), | 431 : icon_image_id(icon_id), |
| 433 inactive_icon_image_id(inactive_icon_id), | 432 inactive_icon_image_id(inactive_icon_id), |
| 434 hovered_background_image_id(hovered_background_id), | 433 hovered_background_image_id(hovered_background_id), |
| 435 pressed_background_image_id(pressed_background_id) { | 434 pressed_background_image_id(pressed_background_id) { |
| 436 } | 435 } |
| 437 | 436 |
| 438 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { | 437 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { |
| 439 } | 438 } |
| 440 | 439 |
| 441 } // namespace ash | 440 } // namespace ash |
| OLD | NEW |