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) |
113 : frame_(frame), | 114 : frame_(frame), |
114 minimize_button_(NULL), | 115 minimize_button_(NULL), |
115 size_button_(NULL), | 116 size_button_(NULL), |
116 close_button_(NULL) { | 117 close_button_(NULL) { |
117 bool size_button_visibility = ShouldSizeButtonBeVisible(); | 118 bool size_button_visibility = ShouldSizeButtonBeVisible(); |
118 maximize_mode_animation_.reset(new gfx::SlideAnimation(this)); | 119 maximize_mode_animation_.reset(new gfx::SlideAnimation(this)); |
119 maximize_mode_animation_->SetTweenType(gfx::Tween::LINEAR); | 120 maximize_mode_animation_->SetTweenType(gfx::Tween::LINEAR); |
120 | 121 |
121 // Ensure animation tracks visibility of size button. | 122 // Ensure animation tracks visibility of size button. |
122 if (size_button_visibility) | 123 if (size_button_visibility) |
123 maximize_mode_animation_->Reset(1.0f); | 124 maximize_mode_animation_->Reset(1.0f); |
124 | 125 |
125 // Insert the buttons left to right. | 126 // Insert the buttons left to right. |
126 minimize_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_MINIMIZE); | 127 minimize_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_MINIMIZE); |
127 minimize_button_->SetAccessibleName( | 128 minimize_button_->SetAccessibleName( |
128 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); | 129 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); |
129 minimize_button_->SetVisible(frame_->widget_delegate()->CanMinimize()); | 130 minimize_button_->SetVisible(minimize_allowed == MINIMIZE_ALLOWED); |
130 AddChildView(minimize_button_); | 131 AddChildView(minimize_button_); |
131 | 132 |
132 size_button_ = new FrameSizeButton(this, frame, this); | 133 size_button_ = new FrameSizeButton(this, frame, this); |
133 size_button_->SetAccessibleName( | 134 size_button_->SetAccessibleName( |
134 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE)); | 135 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE)); |
135 size_button_->SetVisible(size_button_visibility); | 136 size_button_->SetVisible(size_button_visibility); |
136 AddChildView(size_button_); | 137 AddChildView(size_button_); |
137 | 138 |
138 close_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_CLOSE); | 139 close_button_ = new FrameCaptionButton(this, CAPTION_BUTTON_ICON_CLOSE); |
139 close_button_->SetAccessibleName( | 140 close_button_->SetAccessibleName( |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 : icon_image_id(icon_id), | 432 : icon_image_id(icon_id), |
432 inactive_icon_image_id(inactive_icon_id), | 433 inactive_icon_image_id(inactive_icon_id), |
433 hovered_background_image_id(hovered_background_id), | 434 hovered_background_image_id(hovered_background_id), |
434 pressed_background_image_id(pressed_background_id) { | 435 pressed_background_image_id(pressed_background_id) { |
435 } | 436 } |
436 | 437 |
437 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { | 438 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { |
438 } | 439 } |
439 | 440 |
440 } // namespace ash | 441 } // namespace ash |
OLD | NEW |