Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: ash/frame/caption_buttons/frame_caption_button_container_view.cc

Issue 934503002: Ash frames: dark frames now use white caption buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 FrameCaptionButtonContainerView::~FrameCaptionButtonContainerView() { 144 FrameCaptionButtonContainerView::~FrameCaptionButtonContainerView() {
145 } 145 }
146 146
147 void FrameCaptionButtonContainerView::TestApi::EndAnimations() { 147 void FrameCaptionButtonContainerView::TestApi::EndAnimations() {
148 container_view_->maximize_mode_animation_->End(); 148 container_view_->maximize_mode_animation_->End();
149 } 149 }
150 150
151 void FrameCaptionButtonContainerView::SetButtonImages( 151 void FrameCaptionButtonContainerView::SetButtonImages(
152 CaptionButtonIcon icon, 152 CaptionButtonIcon icon,
153 int icon_image_id, 153 int icon_image_id,
154 int inactive_icon_image_id,
155 int hovered_background_image_id, 154 int hovered_background_image_id,
156 int pressed_background_image_id) { 155 int pressed_background_image_id) {
157 button_icon_id_map_[icon] = ButtonIconIds(icon_image_id, 156 button_icon_id_map_[icon] = ButtonIconIds(icon_image_id,
158 inactive_icon_image_id,
159 hovered_background_image_id, 157 hovered_background_image_id,
160 pressed_background_image_id); 158 pressed_background_image_id);
161 FrameCaptionButton* buttons[] = { 159 FrameCaptionButton* buttons[] = {
162 minimize_button_, size_button_, close_button_ 160 minimize_button_, size_button_, close_button_
163 }; 161 };
164 for (size_t i = 0; i < arraysize(buttons); ++i) { 162 for (size_t i = 0; i < arraysize(buttons); ++i) {
165 if (buttons[i]->icon() == icon) { 163 if (buttons[i]->icon() == icon) {
166 buttons[i]->SetImages(icon, 164 buttons[i]->SetImages(icon,
167 FrameCaptionButton::ANIMATE_NO, 165 FrameCaptionButton::ANIMATE_NO,
168 icon_image_id, 166 icon_image_id,
169 inactive_icon_image_id,
170 hovered_background_image_id, 167 hovered_background_image_id,
171 pressed_background_image_id); 168 pressed_background_image_id);
172 } 169 }
173 } 170 }
174 } 171 }
175 172
176 void FrameCaptionButtonContainerView::SetPaintAsActive(bool paint_as_active) { 173 void FrameCaptionButtonContainerView::SetPaintAsActive(bool paint_as_active) {
177 minimize_button_->set_paint_as_active(paint_as_active); 174 minimize_button_->set_paint_as_active(paint_as_active);
178 size_button_->set_paint_as_active(paint_as_active); 175 size_button_->set_paint_as_active(paint_as_active);
179 close_button_->set_paint_as_active(paint_as_active); 176 close_button_->set_paint_as_active(paint_as_active);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 297 }
301 298
302 FrameCaptionButton::Animate fcb_animate = (animate == ANIMATE_YES) ? 299 FrameCaptionButton::Animate fcb_animate = (animate == ANIMATE_YES) ?
303 FrameCaptionButton::ANIMATE_YES : FrameCaptionButton::ANIMATE_NO; 300 FrameCaptionButton::ANIMATE_YES : FrameCaptionButton::ANIMATE_NO;
304 std::map<CaptionButtonIcon, ButtonIconIds>::const_iterator it = 301 std::map<CaptionButtonIcon, ButtonIconIds>::const_iterator it =
305 button_icon_id_map_.find(icon); 302 button_icon_id_map_.find(icon);
306 if (it != button_icon_id_map_.end()) { 303 if (it != button_icon_id_map_.end()) {
307 button->SetImages(icon, 304 button->SetImages(icon,
308 fcb_animate, 305 fcb_animate,
309 it->second.icon_image_id, 306 it->second.icon_image_id,
310 it->second.inactive_icon_image_id,
311 it->second.hovered_background_image_id, 307 it->second.hovered_background_image_id,
312 it->second.pressed_background_image_id); 308 it->second.pressed_background_image_id);
313 } 309 }
314 } 310 }
315 311
316 bool FrameCaptionButtonContainerView::ShouldSizeButtonBeVisible() const { 312 bool FrameCaptionButtonContainerView::ShouldSizeButtonBeVisible() const {
317 return !Shell::GetInstance()->maximize_mode_controller()-> 313 return !Shell::GetInstance()->maximize_mode_controller()->
318 IsMaximizeModeWindowManagerEnabled() && 314 IsMaximizeModeWindowManagerEnabled() &&
319 frame_->widget_delegate()->CanMaximize(); 315 frame_->widget_delegate()->CanMaximize();
320 } 316 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (button == to_hover) 407 if (button == to_hover)
412 new_state = views::Button::STATE_HOVERED; 408 new_state = views::Button::STATE_HOVERED;
413 else if (button == to_press) 409 else if (button == to_press)
414 new_state = views::Button::STATE_PRESSED; 410 new_state = views::Button::STATE_PRESSED;
415 button->SetState(new_state); 411 button->SetState(new_state);
416 } 412 }
417 } 413 }
418 414
419 FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds() 415 FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds()
420 : icon_image_id(-1), 416 : icon_image_id(-1),
421 inactive_icon_image_id(-1),
422 hovered_background_image_id(-1), 417 hovered_background_image_id(-1),
423 pressed_background_image_id(-1) { 418 pressed_background_image_id(-1) {
424 } 419 }
425 420
426 FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds( 421 FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds(
427 int icon_id, 422 int icon_id,
428 int inactive_icon_id,
429 int hovered_background_id, 423 int hovered_background_id,
430 int pressed_background_id) 424 int pressed_background_id)
431 : icon_image_id(icon_id), 425 : icon_image_id(icon_id),
432 inactive_icon_image_id(inactive_icon_id),
433 hovered_background_image_id(hovered_background_id), 426 hovered_background_image_id(hovered_background_id),
434 pressed_background_image_id(pressed_background_id) { 427 pressed_background_image_id(pressed_background_id) {
435 } 428 }
436 429
437 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { 430 FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() {
438 } 431 }
439 432
440 } // namespace ash 433 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698