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/system/tray/tray_details_view.h" | 5 #include "ash/system/tray/tray_details_view.h" |
6 | 6 |
7 #include "ash/ash_view_ids.h" | 7 #include "ash/ash_view_ids.h" |
8 #include "ash/strings/grit/ash_strings.h" | 8 #include "ash/strings/grit/ash_strings.h" |
9 #include "ash/system/tray/hover_highlight_view.h" | 9 #include "ash/system/tray/hover_highlight_view.h" |
10 #include "ash/system/tray/system_menu_button.h" | 10 #include "ash/system/tray/system_menu_button.h" |
11 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
12 #include "ash/system/tray/system_tray_item.h" | 12 #include "ash/system/tray/system_tray_item.h" |
13 #include "ash/system/tray/tray_constants.h" | 13 #include "ash/system/tray/tray_constants.h" |
14 #include "ash/system/tray/tray_popup_item_style.h" | 14 #include "ash/system/tray/tray_popup_item_style.h" |
15 #include "ash/system/tray/tray_popup_utils.h" | 15 #include "ash/system/tray/tray_popup_utils.h" |
16 #include "ash/system/tray/tri_view.h" | 16 #include "ash/system/tray/tri_view.h" |
17 #include "base/containers/adapters.h" | 17 #include "base/containers/adapters.h" |
18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "third_party/skia/include/core/SkDrawLooper.h" | 19 #include "third_party/skia/include/core/SkDrawLooper.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/compositor/paint_context.h" | 22 #include "ui/compositor/paint_context.h" |
23 #include "ui/compositor/paint_recorder.h" | 23 #include "ui/compositor/paint_recorder.h" |
24 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
25 #include "ui/gfx/image/image_skia.h" | 25 #include "ui/gfx/image/image_skia.h" |
26 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
27 #include "ui/gfx/skia_paint_util.h" | 27 #include "ui/gfx/skia_paint_util.h" |
28 #include "ui/gfx/vector_icon_types.h" | 28 #include "ui/gfx/vector_icon_types.h" |
| 29 #include "ui/native_theme/native_theme.h" |
29 #include "ui/views/background.h" | 30 #include "ui/views/background.h" |
30 #include "ui/views/border.h" | 31 #include "ui/views/border.h" |
31 #include "ui/views/controls/image_view.h" | 32 #include "ui/views/controls/image_view.h" |
32 #include "ui/views/controls/label.h" | 33 #include "ui/views/controls/label.h" |
33 #include "ui/views/controls/progress_bar.h" | 34 #include "ui/views/controls/progress_bar.h" |
34 #include "ui/views/controls/scroll_view.h" | 35 #include "ui/views/controls/scroll_view.h" |
35 #include "ui/views/controls/separator.h" | 36 #include "ui/views/controls/separator.h" |
36 #include "ui/views/layout/box_layout.h" | 37 #include "ui/views/layout/box_layout.h" |
37 #include "ui/views/view_targeter.h" | 38 #include "ui/views/view_targeter.h" |
38 #include "ui/views/view_targeter_delegate.h" | 39 #include "ui/views/view_targeter_delegate.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 238 |
238 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 239 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
239 : owner_(owner), | 240 : owner_(owner), |
240 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)), | 241 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)), |
241 scroller_(nullptr), | 242 scroller_(nullptr), |
242 scroll_content_(nullptr), | 243 scroll_content_(nullptr), |
243 progress_bar_(nullptr), | 244 progress_bar_(nullptr), |
244 tri_view_(nullptr), | 245 tri_view_(nullptr), |
245 back_button_(nullptr) { | 246 back_button_(nullptr) { |
246 SetLayoutManager(box_layout_); | 247 SetLayoutManager(box_layout_); |
247 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 248 set_background(views::Background::CreateThemedSolidBackground( |
| 249 this, ui::NativeTheme::kColorId_BubbleBackground)); |
248 } | 250 } |
249 | 251 |
250 TrayDetailsView::~TrayDetailsView() {} | 252 TrayDetailsView::~TrayDetailsView() {} |
251 | 253 |
252 void TrayDetailsView::OnViewClicked(views::View* sender) { | 254 void TrayDetailsView::OnViewClicked(views::View* sender) { |
253 HandleViewClicked(sender); | 255 HandleViewClicked(sender); |
254 } | 256 } |
255 | 257 |
256 void TrayDetailsView::ButtonPressed(views::Button* sender, | 258 void TrayDetailsView::ButtonPressed(views::Button* sender, |
257 const ui::Event& event) { | 259 const ui::Event& event) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 296 } |
295 | 297 |
296 void TrayDetailsView::CreateScrollableList() { | 298 void TrayDetailsView::CreateScrollableList() { |
297 DCHECK(!scroller_); | 299 DCHECK(!scroller_); |
298 scroll_content_ = new ScrollContentsView(); | 300 scroll_content_ = new ScrollContentsView(); |
299 scroller_ = new views::ScrollView; | 301 scroller_ = new views::ScrollView; |
300 scroller_->SetContents(scroll_content_); | 302 scroller_->SetContents(scroll_content_); |
301 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. | 303 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. |
302 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). | 304 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). |
303 scroller_->SetPaintToLayer(); | 305 scroller_->SetPaintToLayer(); |
304 scroller_->set_background( | 306 scroller_->set_background(views::Background::CreateThemedSolidBackground( |
305 views::Background::CreateSolidBackground(kBackgroundColor)); | 307 scroller_, ui::NativeTheme::kColorId_BubbleBackground)); |
306 scroller_->layer()->SetMasksToBounds(true); | 308 scroller_->layer()->SetMasksToBounds(true); |
307 | 309 |
308 AddChildView(scroller_); | 310 AddChildView(scroller_); |
309 box_layout_->SetFlexForView(scroller_, 1); | 311 box_layout_->SetFlexForView(scroller_, 1); |
310 } | 312 } |
311 | 313 |
312 HoverHighlightView* TrayDetailsView::AddScrollListItem( | 314 HoverHighlightView* TrayDetailsView::AddScrollListItem( |
313 const gfx::VectorIcon& icon, | 315 const gfx::VectorIcon& icon, |
314 const base::string16& text) { | 316 const base::string16& text) { |
315 HoverHighlightView* item = new HoverHighlightView(this); | 317 HoverHighlightView* item = new HoverHighlightView(this); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 if (bounds().IsEmpty()) | 453 if (bounds().IsEmpty()) |
452 return views::View::GetHeightForWidth(width); | 454 return views::View::GetHeightForWidth(width); |
453 | 455 |
454 // The height of the bubble that contains this detailed view is set to | 456 // The height of the bubble that contains this detailed view is set to |
455 // the preferred height of the default view, and that determines the | 457 // the preferred height of the default view, and that determines the |
456 // initial height of |this|. Always request to stay the same height. | 458 // initial height of |this|. Always request to stay the same height. |
457 return height(); | 459 return height(); |
458 } | 460 } |
459 | 461 |
460 } // namespace ash | 462 } // namespace ash |
OLD | NEW |