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/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
10 #include "ash/common/system/tray/system_menu_button.h" | 10 #include "ash/common/system/tray/system_menu_button.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 DCHECK_EQ(box_layout_, GetLayoutManager()); | 126 DCHECK_EQ(box_layout_, GetLayoutManager()); |
127 box_layout_->set_inside_border_insets( | 127 box_layout_->set_inside_border_insets( |
128 gfx::Insets(details.child->id() == VIEW_ID_STICKY_HEADER | 128 gfx::Insets(details.child->id() == VIEW_ID_STICKY_HEADER |
129 ? 0 | 129 ? 0 |
130 : kMenuSeparatorVerticalPadding, | 130 : kMenuSeparatorVerticalPadding, |
131 0, kMenuSeparatorVerticalPadding, 0)); | 131 0, kMenuSeparatorVerticalPadding, 0)); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 private: | 135 private: |
136 const SkColor kSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F); | |
137 const int kShadowOffsetY = 2; | 136 const int kShadowOffsetY = 2; |
138 const int kShadowBlur = 2; | 137 const int kShadowBlur = 2; |
139 // TODO(fukino): Remove this constant once we stop maintaining pre-MD design. | 138 // TODO(fukino): Remove this constant once we stop maintaining pre-MD design. |
140 // crbug.com/614453. | 139 // crbug.com/614453. |
141 const int kContentsBetweenChildSpacingNonMd = 1; | 140 const int kContentsBetweenChildSpacingNonMd = 1; |
142 | 141 |
143 // A structure that keeps the original offset of each header between the | 142 // A structure that keeps the original offset of each header between the |
144 // calls to Layout() to allow keeping track of which view should be sticky. | 143 // calls to Layout() to allow keeping track of which view should be sticky. |
145 struct Header { | 144 struct Header { |
146 explicit Header(views::View* view) | 145 explicit Header(views::View* view) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 } | 211 } |
213 | 212 |
214 // Draws a drop shadow below |shadowed_area|. | 213 // Draws a drop shadow below |shadowed_area|. |
215 void DrawShadow(const ui::PaintContext& context, | 214 void DrawShadow(const ui::PaintContext& context, |
216 const gfx::Rect& shadowed_area) { | 215 const gfx::Rect& shadowed_area) { |
217 ui::PaintRecorder recorder(context, size()); | 216 ui::PaintRecorder recorder(context, size()); |
218 gfx::Canvas* canvas = recorder.canvas(); | 217 gfx::Canvas* canvas = recorder.canvas(); |
219 cc::PaintFlags paint; | 218 cc::PaintFlags paint; |
220 gfx::ShadowValues shadow; | 219 gfx::ShadowValues shadow; |
221 shadow.emplace_back(gfx::Vector2d(0, kShadowOffsetY), kShadowBlur, | 220 shadow.emplace_back(gfx::Vector2d(0, kShadowOffsetY), kShadowBlur, |
222 kSeparatorColor); | 221 kMenuSeparatorColor); |
223 paint.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow)); | 222 paint.setLooper(gfx::CreateShadowDrawLooperCorrectBlur(shadow)); |
224 paint.setAntiAlias(true); | 223 paint.setAntiAlias(true); |
225 canvas->ClipRect(shadowed_area, SkClipOp::kDifference); | 224 canvas->ClipRect(shadowed_area, SkClipOp::kDifference); |
226 canvas->DrawRect(shadowed_area, paint); | 225 canvas->DrawRect(shadowed_area, paint); |
227 } | 226 } |
228 | 227 |
229 views::BoxLayout* box_layout_; | 228 views::BoxLayout* box_layout_; |
230 | 229 |
231 // Header child views that stick to the top of visible viewport when scrolled. | 230 // Header child views that stick to the top of visible viewport when scrolled. |
232 std::vector<Header> headers_; | 231 std::vector<Header> headers_; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 UpdateStyle(); | 337 UpdateStyle(); |
339 tri_view_->AddView(TriView::Container::CENTER, label_); | 338 tri_view_->AddView(TriView::Container::CENTER, label_); |
340 | 339 |
341 tri_view_->SetContainerVisible(TriView::Container::END, false); | 340 tri_view_->SetContainerVisible(TriView::Container::END, false); |
342 | 341 |
343 tri_view_->SetBorder(views::CreateEmptyBorder(kTitleRowPaddingTop, 0, | 342 tri_view_->SetBorder(views::CreateEmptyBorder(kTitleRowPaddingTop, 0, |
344 kTitleRowPaddingBottom, 0)); | 343 kTitleRowPaddingBottom, 0)); |
345 AddChildViewAt(tri_view_, 0); | 344 AddChildViewAt(tri_view_, 0); |
346 views::Separator* separator = | 345 views::Separator* separator = |
347 new views::Separator(views::Separator::HORIZONTAL); | 346 new views::Separator(views::Separator::HORIZONTAL); |
348 separator->SetColor(kHorizontalSeparatorColor); | 347 separator->SetColor(kMenuSeparatorColor); |
349 separator->SetPreferredSize(kSeparatorWidth); | |
350 separator->SetBorder(views::CreateEmptyBorder( | 348 separator->SetBorder(views::CreateEmptyBorder( |
351 kTitleRowProgressBarHeight - kSeparatorWidth, 0, 0, 0)); | 349 kTitleRowProgressBarHeight - views::Separator::kThickness, 0, 0, 0)); |
tdanderson
2017/02/06 21:19:06
There are two other instances of |kSeparatorWidth|
Evan Stade
2017/02/06 21:39:17
I intentionally did not update the uses that are n
| |
352 AddChildViewAt(separator, kTitleRowSeparatorIndex); | 350 AddChildViewAt(separator, kTitleRowSeparatorIndex); |
353 } else { | 351 } else { |
354 title_row_ = new SpecialPopupRow(); | 352 title_row_ = new SpecialPopupRow(); |
355 title_row_->SetTextLabel(string_id, this); | 353 title_row_->SetTextLabel(string_id, this); |
356 AddChildViewAt(title_row_, child_count()); | 354 AddChildViewAt(title_row_, child_count()); |
357 } | 355 } |
358 | 356 |
359 CreateExtraTitleRowButtons(); | 357 CreateExtraTitleRowButtons(); |
360 Layout(); | 358 Layout(); |
361 } | 359 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 if (index < child_count() - 1 && child_at(index + 1) != title_row_) | 556 if (index < child_count() - 1 && child_at(index + 1) != title_row_) |
559 scroll_border_->set_visible(true); | 557 scroll_border_->set_visible(true); |
560 else | 558 else |
561 scroll_border_->set_visible(false); | 559 scroll_border_->set_visible(false); |
562 } | 560 } |
563 | 561 |
564 views::View::OnPaintBorder(canvas); | 562 views::View::OnPaintBorder(canvas); |
565 } | 563 } |
566 | 564 |
567 } // namespace ash | 565 } // namespace ash |
OLD | NEW |