| 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 "ash/common/system/tray/tray_details_view.h" | 5 #include "ash/common/system/tray/tray_details_view.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 8 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/system/tray/system_tray_item.h" | 10 #include "ash/common/system/tray/system_tray_item.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 : view_(header), offset_(header->y()), sticky_(true) { | 103 : view_(header), offset_(header->y()), sticky_(true) { |
| 104 DecorateAsSticky(false); | 104 DecorateAsSticky(false); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Sets decorations on a header row to indicate whether it is |sticky|. | 107 // Sets decorations on a header row to indicate whether it is |sticky|. |
| 108 void DecorateAsSticky(bool sticky) { | 108 void DecorateAsSticky(bool sticky) { |
| 109 if (sticky_ == sticky) | 109 if (sticky_ == sticky) |
| 110 return; | 110 return; |
| 111 sticky_ = sticky; | 111 sticky_ = sticky; |
| 112 if (sticky) { | 112 if (sticky) { |
| 113 view_->SetBorder(views::Border::CreateSolidSidedBorder( | 113 view_->SetBorder(views::CreateSolidSidedBorder( |
| 114 0, 0, kHeaderRowSeparatorThickness, 0, kHeaderRowSeparatorColor)); | 114 0, 0, kHeaderRowSeparatorThickness, 0, kHeaderRowSeparatorColor)); |
| 115 } else { | 115 } else { |
| 116 view_->SetBorder(views::Border::CreateSolidSidedBorder( | 116 view_->SetBorder(views::CreateSolidSidedBorder( |
| 117 kHeaderRowSeparatorThickness, 0, 0, 0, kHeaderRowSeparatorColor)); | 117 kHeaderRowSeparatorThickness, 0, 0, 0, kHeaderRowSeparatorColor)); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 const views::View* view() const { return view_; } | 121 const views::View* view() const { return view_; } |
| 122 views::View* view() { return view_; } | 122 views::View* view() { return view_; } |
| 123 int offset() const { return offset_; } | 123 int offset() const { return offset_; } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 // A header View that can be decorated as sticky. | 126 // A header View that can be decorated as sticky. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 HandleButtonPressed(sender, event); | 296 HandleButtonPressed(sender, event); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void TrayDetailsView::CreateTitleRow(int string_id) { | 299 void TrayDetailsView::CreateTitleRow(int string_id) { |
| 300 DCHECK(!title_row_); | 300 DCHECK(!title_row_); |
| 301 title_row_ = new SpecialPopupRow(); | 301 title_row_ = new SpecialPopupRow(); |
| 302 title_row_->SetTextLabel(string_id, this); | 302 title_row_->SetTextLabel(string_id, this); |
| 303 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 303 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
| 304 title_row_->SetBorder(views::Border::CreateEmptyBorder( | 304 title_row_->SetBorder(views::CreateEmptyBorder(kTitleRowPaddingTop, 0, |
| 305 kTitleRowPaddingTop, 0, kTitleRowPaddingBottom, 0)); | 305 kTitleRowPaddingBottom, 0)); |
| 306 AddChildViewAt(title_row_, 0); | 306 AddChildViewAt(title_row_, 0); |
| 307 // In material design, we use a customized bottom border which is nomally a | 307 // In material design, we use a customized bottom border which is nomally a |
| 308 // simple separator (views::Separator) but can be combined with an | 308 // simple separator (views::Separator) but can be combined with an |
| 309 // overlapping progress bar. | 309 // overlapping progress bar. |
| 310 title_row_separator_ = new views::View; | 310 title_row_separator_ = new views::View; |
| 311 title_row_separator_->SetLayoutManager(new TitleRowSeparatorLayout); | 311 title_row_separator_->SetLayoutManager(new TitleRowSeparatorLayout); |
| 312 views::Separator* separator = | 312 views::Separator* separator = |
| 313 new views::Separator(views::Separator::HORIZONTAL); | 313 new views::Separator(views::Separator::HORIZONTAL); |
| 314 separator->SetColor(kTitleRowSeparatorBorderColor); | 314 separator->SetColor(kTitleRowSeparatorBorderColor); |
| 315 separator->SetPreferredSize(kTitleRowSeparatorBorderHeight); | 315 separator->SetPreferredSize(kTitleRowSeparatorBorderHeight); |
| 316 separator->SetBorder(views::Border::CreateEmptyBorder( | 316 separator->SetBorder(views::CreateEmptyBorder( |
| 317 kTitleRowSeparatorHeight - kTitleRowSeparatorBorderHeight, 0, 0, 0)); | 317 kTitleRowSeparatorHeight - kTitleRowSeparatorBorderHeight, 0, 0, 0)); |
| 318 title_row_separator_->AddChildView(separator); | 318 title_row_separator_->AddChildView(separator); |
| 319 AddChildViewAt(title_row_separator_, 1); | 319 AddChildViewAt(title_row_separator_, 1); |
| 320 } else { | 320 } else { |
| 321 AddChildViewAt(title_row_, child_count()); | 321 AddChildViewAt(title_row_, child_count()); |
| 322 } | 322 } |
| 323 | 323 |
| 324 CreateExtraTitleRowButtons(); | 324 CreateExtraTitleRowButtons(); |
| 325 | 325 |
| 326 if (MaterialDesignController::IsSystemTrayMenuMaterial()) | 326 if (MaterialDesignController::IsSystemTrayMenuMaterial()) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 if (index < child_count() - 1 && child_at(index + 1) != title_row_) | 427 if (index < child_count() - 1 && child_at(index + 1) != title_row_) |
| 428 scroll_border_->set_visible(true); | 428 scroll_border_->set_visible(true); |
| 429 else | 429 else |
| 430 scroll_border_->set_visible(false); | 430 scroll_border_->set_visible(false); |
| 431 } | 431 } |
| 432 | 432 |
| 433 views::View::OnPaintBorder(canvas); | 433 views::View::OnPaintBorder(canvas); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace ash | 436 } // namespace ash |
| OLD | NEW |