Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: ash/common/system/tray/tray_details_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "ash/common/system/tray/system_tray.h" 11 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_item.h" 12 #include "ash/common/system/tray/system_tray_item.h"
13 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_item_style.h" 14 #include "ash/common/system/tray/tray_popup_item_style.h"
15 #include "ash/common/system/tray/tray_popup_utils.h" 15 #include "ash/common/system/tray/tray_popup_utils.h"
16 #include "ash/common/system/tray/tri_view.h" 16 #include "ash/common/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 "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
21 #include "third_party/skia/include/core/SkDrawLooper.h" 21 #include "third_party/skia/include/core/SkDrawLooper.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/compositor/layer_type.h"
23 #include "ui/compositor/paint_context.h" 24 #include "ui/compositor/paint_context.h"
24 #include "ui/compositor/paint_recorder.h" 25 #include "ui/compositor/paint_recorder.h"
25 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
26 #include "ui/gfx/skia_util.h" 27 #include "ui/gfx/skia_util.h"
27 #include "ui/views/background.h" 28 #include "ui/views/background.h"
28 #include "ui/views/border.h" 29 #include "ui/views/border.h"
29 #include "ui/views/controls/label.h" 30 #include "ui/views/controls/label.h"
30 #include "ui/views/controls/progress_bar.h" 31 #include "ui/views/controls/progress_bar.h"
31 #include "ui/views/controls/scroll_view.h" 32 #include "ui/views/controls/scroll_view.h"
32 #include "ui/views/controls/separator.h" 33 #include "ui/views/controls/separator.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 Layout(); 361 Layout();
361 } 362 }
362 363
363 void TrayDetailsView::CreateScrollableList() { 364 void TrayDetailsView::CreateScrollableList() {
364 DCHECK(!scroller_); 365 DCHECK(!scroller_);
365 scroll_content_ = new ScrollContentsView(); 366 scroll_content_ = new ScrollContentsView();
366 scroller_ = new FixedSizedScrollView; 367 scroller_ = new FixedSizedScrollView;
367 scroller_->SetContentsView(scroll_content_); 368 scroller_->SetContentsView(scroll_content_);
368 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. 369 // Make the |scroller_| have a layer to clip |scroll_content_|'s children.
369 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). 370 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer().
370 scroller_->SetPaintToLayer(true); 371 scroller_->SetPaintToLayer(ui::LAYER_TEXTURED);
371 scroller_->set_background( 372 scroller_->set_background(
372 views::Background::CreateSolidBackground(kBackgroundColor)); 373 views::Background::CreateSolidBackground(kBackgroundColor));
373 scroller_->layer()->SetMasksToBounds(true); 374 scroller_->layer()->SetMasksToBounds(true);
374 375
375 // Note: |scroller_| takes ownership of |scroll_border_|. 376 // Note: |scroller_| takes ownership of |scroll_border_|.
376 if (!UseMd()) { 377 if (!UseMd()) {
377 // In MD, the scroller is always the last thing, so this border is 378 // In MD, the scroller is always the last thing, so this border is
378 // unnecessary and reserves extra space we don't want. 379 // unnecessary and reserves extra space we don't want.
379 scroll_border_ = new ScrollBorder; 380 scroll_border_ = new ScrollBorder;
380 scroller_->SetBorder(std::unique_ptr<views::Border>(scroll_border_)); 381 scroller_->SetBorder(std::unique_ptr<views::Border>(scroll_border_));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 if (index < child_count() - 1 && child_at(index + 1) != title_row_) 559 if (index < child_count() - 1 && child_at(index + 1) != title_row_)
559 scroll_border_->set_visible(true); 560 scroll_border_->set_visible(true);
560 else 561 else
561 scroll_border_->set_visible(false); 562 scroll_border_->set_visible(false);
562 } 563 }
563 564
564 views::View::OnPaintBorder(canvas); 565 views::View::OnPaintBorder(canvas);
565 } 566 }
566 567
567 } // namespace ash 568 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698