| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_size_button.h" | 5 #include "ash/frame/caption_buttons/frame_size_button.h" |
| 6 | 6 |
| 7 #include "ash/ash_layout_constants.h" |
| 7 #include "ash/frame/caption_buttons/frame_caption_button.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button.h" |
| 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 11 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
| 12 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 13 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/events/gesture_detection/gesture_configuration.h" | 17 #include "ui/events/gesture_detection/gesture_configuration.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 caption_button_container_->SetBounds(width() - preferred_size.width(), 0, | 51 caption_button_container_->SetBounds(width() - preferred_size.width(), 0, |
| 51 preferred_size.width(), preferred_size.height()); | 52 preferred_size.width(), preferred_size.height()); |
| 52 } | 53 } |
| 53 | 54 |
| 54 void ViewHierarchyChanged( | 55 void ViewHierarchyChanged( |
| 55 const ViewHierarchyChangedDetails& details) override { | 56 const ViewHierarchyChangedDetails& details) override { |
| 56 if (details.is_add && details.child == this) { | 57 if (details.is_add && details.child == this) { |
| 57 caption_button_container_ = | 58 caption_button_container_ = |
| 58 new FrameCaptionButtonContainerView(GetWidget()); | 59 new FrameCaptionButtonContainerView(GetWidget()); |
| 59 | 60 |
| 60 // Set arbitrary images for the container's buttons so that the buttons | 61 // Set arbitrary images for the button icons and assign the default |
| 61 // have non-empty sizes. | 62 // header button size. |
| 63 caption_button_container_->SetButtonSize( |
| 64 GetAshLayoutSize(DEFAULT_HEADER_BUTTON)); |
| 62 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { | 65 for (int icon = 0; icon < CAPTION_BUTTON_ICON_COUNT; ++icon) { |
| 63 caption_button_container_->SetButtonImages( | 66 caption_button_container_->SetButtonImage( |
| 64 static_cast<CaptionButtonIcon>(icon), | 67 static_cast<CaptionButtonIcon>(icon), |
| 65 IDR_AURA_WINDOW_CONTROL_ICON_CLOSE, | 68 IDR_AURA_WINDOW_CONTROL_ICON_CLOSE); |
| 66 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, | |
| 67 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); | |
| 68 } | 69 } |
| 69 | 70 |
| 70 AddChildView(caption_button_container_); | 71 AddChildView(caption_button_container_); |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 | 74 |
| 74 // Not owned. | 75 // Not owned. |
| 75 ash::FrameCaptionButtonContainerView* caption_button_container_; | 76 ash::FrameCaptionButtonContainerView* caption_button_container_; |
| 76 | 77 |
| 77 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 459 |
| 459 // None of the buttons should stay pressed and the buttons should have their | 460 // None of the buttons should stay pressed and the buttons should have their |
| 460 // regular icons. | 461 // regular icons. |
| 461 EXPECT_TRUE(AllButtonsInNormalState()); | 462 EXPECT_TRUE(AllButtonsInNormalState()); |
| 462 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); | 463 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); |
| 463 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); | 464 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace test | 467 } // namespace test |
| 467 } // namespace ash | 468 } // namespace ash |
| OLD | NEW |