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/system_menu_button.h" | 9 #include "ash/system/tray/system_menu_button.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
11 #include "ash/system/tray/system_tray_item.h" | 11 #include "ash/system/tray/system_tray_item.h" |
12 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
13 #include "ash/system/tray/tray_popup_item_style.h" | 13 #include "ash/system/tray/tray_popup_item_style.h" |
14 #include "ash/system/tray/tray_popup_utils.h" | 14 #include "ash/system/tray/tray_popup_utils.h" |
15 #include "ash/system/tray/tri_view.h" | 15 #include "ash/system/tray/tri_view.h" |
16 #include "base/containers/adapters.h" | 16 #include "base/containers/adapters.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "third_party/skia/include/core/SkDrawLooper.h" | 18 #include "third_party/skia/include/core/SkDrawLooper.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/compositor/paint_context.h" | 20 #include "ui/compositor/paint_context.h" |
21 #include "ui/compositor/paint_recorder.h" | 21 #include "ui/compositor/paint_recorder.h" |
22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/skia_paint_util.h" | 23 #include "ui/gfx/skia_paint_util.h" |
24 #include "ui/native_theme/native_theme.h" | |
25 #include "ui/views/background.h" | 24 #include "ui/views/background.h" |
26 #include "ui/views/border.h" | 25 #include "ui/views/border.h" |
27 #include "ui/views/controls/label.h" | 26 #include "ui/views/controls/label.h" |
28 #include "ui/views/controls/progress_bar.h" | 27 #include "ui/views/controls/progress_bar.h" |
29 #include "ui/views/controls/scroll_view.h" | 28 #include "ui/views/controls/scroll_view.h" |
30 #include "ui/views/controls/separator.h" | 29 #include "ui/views/controls/separator.h" |
31 #include "ui/views/layout/box_layout.h" | 30 #include "ui/views/layout/box_layout.h" |
32 #include "ui/views/view_targeter.h" | 31 #include "ui/views/view_targeter.h" |
33 #include "ui/views/view_targeter_delegate.h" | 32 #include "ui/views/view_targeter_delegate.h" |
34 | 33 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 231 |
233 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) | 232 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) |
234 : owner_(owner), | 233 : owner_(owner), |
235 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)), | 234 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)), |
236 scroller_(nullptr), | 235 scroller_(nullptr), |
237 scroll_content_(nullptr), | 236 scroll_content_(nullptr), |
238 progress_bar_(nullptr), | 237 progress_bar_(nullptr), |
239 tri_view_(nullptr), | 238 tri_view_(nullptr), |
240 back_button_(nullptr) { | 239 back_button_(nullptr) { |
241 SetLayoutManager(box_layout_); | 240 SetLayoutManager(box_layout_); |
242 set_background(views::Background::CreateThemedSolidBackground( | 241 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); |
243 this, ui::NativeTheme::kColorId_BubbleBackground)); | |
244 } | 242 } |
245 | 243 |
246 TrayDetailsView::~TrayDetailsView() {} | 244 TrayDetailsView::~TrayDetailsView() {} |
247 | 245 |
248 void TrayDetailsView::OnViewClicked(views::View* sender) { | 246 void TrayDetailsView::OnViewClicked(views::View* sender) { |
249 HandleViewClicked(sender); | 247 HandleViewClicked(sender); |
250 } | 248 } |
251 | 249 |
252 void TrayDetailsView::ButtonPressed(views::Button* sender, | 250 void TrayDetailsView::ButtonPressed(views::Button* sender, |
253 const ui::Event& event) { | 251 const ui::Event& event) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 288 } |
291 | 289 |
292 void TrayDetailsView::CreateScrollableList() { | 290 void TrayDetailsView::CreateScrollableList() { |
293 DCHECK(!scroller_); | 291 DCHECK(!scroller_); |
294 scroll_content_ = new ScrollContentsView(); | 292 scroll_content_ = new ScrollContentsView(); |
295 scroller_ = new views::ScrollView; | 293 scroller_ = new views::ScrollView; |
296 scroller_->SetContents(scroll_content_); | 294 scroller_->SetContents(scroll_content_); |
297 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. | 295 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. |
298 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). | 296 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). |
299 scroller_->SetPaintToLayer(); | 297 scroller_->SetPaintToLayer(); |
300 scroller_->set_background(views::Background::CreateThemedSolidBackground( | 298 scroller_->set_background( |
301 scroller_, ui::NativeTheme::kColorId_BubbleBackground)); | 299 views::Background::CreateSolidBackground(kBackgroundColor)); |
302 scroller_->layer()->SetMasksToBounds(true); | 300 scroller_->layer()->SetMasksToBounds(true); |
303 | 301 |
304 AddChildView(scroller_); | 302 AddChildView(scroller_); |
305 box_layout_->SetFlexForView(scroller_, 1); | 303 box_layout_->SetFlexForView(scroller_, 1); |
306 } | 304 } |
307 | 305 |
308 void TrayDetailsView::Reset() { | 306 void TrayDetailsView::Reset() { |
309 RemoveAllChildViews(true); | 307 RemoveAllChildViews(true); |
310 scroller_ = nullptr; | 308 scroller_ = nullptr; |
311 scroll_content_ = nullptr; | 309 scroll_content_ = nullptr; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (bounds().IsEmpty()) | 391 if (bounds().IsEmpty()) |
394 return views::View::GetHeightForWidth(width); | 392 return views::View::GetHeightForWidth(width); |
395 | 393 |
396 // The height of the bubble that contains this detailed view is set to | 394 // The height of the bubble that contains this detailed view is set to |
397 // the preferred height of the default view, and that determines the | 395 // the preferred height of the default view, and that determines the |
398 // initial height of |this|. Always request to stay the same height. | 396 // initial height of |this|. Always request to stay the same height. |
399 return height(); | 397 return height(); |
400 } | 398 } |
401 | 399 |
402 } // namespace ash | 400 } // namespace ash |
OLD | NEW |