| 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/ash_view_ids.h" | 7 #include "ash/common/ash_view_ids.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/system/tray/system_menu_button.h" | 9 #include "ash/common/system/tray/system_menu_button.h" |
| 10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 DCHECK_EQ(box_layout_, GetLayoutManager()); | 125 DCHECK_EQ(box_layout_, GetLayoutManager()); |
| 126 box_layout_->set_inside_border_insets( | 126 box_layout_->set_inside_border_insets( |
| 127 gfx::Insets(details.child->id() == VIEW_ID_STICKY_HEADER | 127 gfx::Insets(details.child->id() == VIEW_ID_STICKY_HEADER |
| 128 ? 0 | 128 ? 0 |
| 129 : kMenuSeparatorVerticalPadding, | 129 : kMenuSeparatorVerticalPadding, |
| 130 0, kMenuSeparatorVerticalPadding, 0)); | 130 0, kMenuSeparatorVerticalPadding, 0)); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 const SkColor kSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F); | |
| 136 const int kShadowOffsetY = 2; | 135 const int kShadowOffsetY = 2; |
| 137 const int kShadowBlur = 2; | 136 const int kShadowBlur = 2; |
| 138 // TODO(fukino): Remove this constant once we stop maintaining pre-MD design. | 137 // TODO(fukino): Remove this constant once we stop maintaining pre-MD design. |
| 139 // crbug.com/614453. | 138 // crbug.com/614453. |
| 140 const int kContentsBetweenChildSpacingNonMd = 1; | 139 const int kContentsBetweenChildSpacingNonMd = 1; |
| 141 | 140 |
| 142 // A structure that keeps the original offset of each header between the | 141 // A structure that keeps the original offset of each header between the |
| 143 // calls to Layout() to allow keeping track of which view should be sticky. | 142 // calls to Layout() to allow keeping track of which view should be sticky. |
| 144 struct Header { | 143 struct Header { |
| 145 explicit Header(views::View* view) | 144 explicit Header(views::View* view) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 } | 210 } |
| 212 | 211 |
| 213 // Draws a drop shadow below |shadowed_area|. | 212 // Draws a drop shadow below |shadowed_area|. |
| 214 void DrawShadow(const ui::PaintContext& context, | 213 void DrawShadow(const ui::PaintContext& context, |
| 215 const gfx::Rect& shadowed_area) { | 214 const gfx::Rect& shadowed_area) { |
| 216 ui::PaintRecorder recorder(context, size()); | 215 ui::PaintRecorder recorder(context, size()); |
| 217 gfx::Canvas* canvas = recorder.canvas(); | 216 gfx::Canvas* canvas = recorder.canvas(); |
| 218 cc::PaintFlags flags; | 217 cc::PaintFlags flags; |
| 219 gfx::ShadowValues shadow; | 218 gfx::ShadowValues shadow; |
| 220 shadow.emplace_back(gfx::Vector2d(0, kShadowOffsetY), kShadowBlur, | 219 shadow.emplace_back(gfx::Vector2d(0, kShadowOffsetY), kShadowBlur, |
| 221 kSeparatorColor); | 220 kMenuSeparatorColor); |
| 222 flags.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow)); | 221 flags.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow)); |
| 223 flags.setAntiAlias(true); | 222 flags.setAntiAlias(true); |
| 224 canvas->ClipRect(shadowed_area, SkClipOp::kDifference); | 223 canvas->ClipRect(shadowed_area, SkClipOp::kDifference); |
| 225 canvas->DrawRect(shadowed_area, flags); | 224 canvas->DrawRect(shadowed_area, flags); |
| 226 } | 225 } |
| 227 | 226 |
| 228 views::BoxLayout* box_layout_; | 227 views::BoxLayout* box_layout_; |
| 229 | 228 |
| 230 // Header child views that stick to the top of visible viewport when scrolled. | 229 // Header child views that stick to the top of visible viewport when scrolled. |
| 231 std::vector<Header> headers_; | 230 std::vector<Header> headers_; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 label->SetText(rb.GetLocalizedString(string_id)); | 334 label->SetText(rb.GetLocalizedString(string_id)); |
| 336 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE); | 335 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE); |
| 337 style.SetupLabel(label); | 336 style.SetupLabel(label); |
| 338 tri_view_->AddView(TriView::Container::CENTER, label); | 337 tri_view_->AddView(TriView::Container::CENTER, label); |
| 339 | 338 |
| 340 tri_view_->SetContainerVisible(TriView::Container::END, false); | 339 tri_view_->SetContainerVisible(TriView::Container::END, false); |
| 341 | 340 |
| 342 tri_view_->SetBorder(views::CreateEmptyBorder(kTitleRowPaddingTop, 0, | 341 tri_view_->SetBorder(views::CreateEmptyBorder(kTitleRowPaddingTop, 0, |
| 343 kTitleRowPaddingBottom, 0)); | 342 kTitleRowPaddingBottom, 0)); |
| 344 AddChildViewAt(tri_view_, 0); | 343 AddChildViewAt(tri_view_, 0); |
| 345 views::Separator* separator = | 344 views::Separator* separator = new views::Separator(); |
| 346 new views::Separator(views::Separator::HORIZONTAL); | 345 separator->SetColor(kMenuSeparatorColor); |
| 347 separator->SetColor(kHorizontalSeparatorColor); | |
| 348 separator->SetPreferredSize(kSeparatorWidth); | |
| 349 separator->SetBorder(views::CreateEmptyBorder( | 346 separator->SetBorder(views::CreateEmptyBorder( |
| 350 kTitleRowProgressBarHeight - kSeparatorWidth, 0, 0, 0)); | 347 kTitleRowProgressBarHeight - views::Separator::kThickness, 0, 0, 0)); |
| 351 AddChildViewAt(separator, kTitleRowSeparatorIndex); | 348 AddChildViewAt(separator, kTitleRowSeparatorIndex); |
| 352 } else { | 349 } else { |
| 353 title_row_ = new SpecialPopupRow(); | 350 title_row_ = new SpecialPopupRow(); |
| 354 title_row_->SetTextLabel(string_id, this); | 351 title_row_->SetTextLabel(string_id, this); |
| 355 AddChildViewAt(title_row_, child_count()); | 352 AddChildViewAt(title_row_, child_count()); |
| 356 } | 353 } |
| 357 | 354 |
| 358 CreateExtraTitleRowButtons(); | 355 CreateExtraTitleRowButtons(); |
| 359 Layout(); | 356 Layout(); |
| 360 } | 357 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 if (index < child_count() - 1 && child_at(index + 1) != title_row_) | 509 if (index < child_count() - 1 && child_at(index + 1) != title_row_) |
| 513 scroll_border_->set_visible(true); | 510 scroll_border_->set_visible(true); |
| 514 else | 511 else |
| 515 scroll_border_->set_visible(false); | 512 scroll_border_->set_visible(false); |
| 516 } | 513 } |
| 517 | 514 |
| 518 views::View::OnPaintBorder(canvas); | 515 views::View::OnPaintBorder(canvas); |
| 519 } | 516 } |
| 520 | 517 |
| 521 } // namespace ash | 518 } // namespace ash |
| OLD | NEW |