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

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

Issue 2816193002: Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | ash/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
24 #include "ui/views/background.h" 25 #include "ui/views/background.h"
25 #include "ui/views/border.h" 26 #include "ui/views/border.h"
26 #include "ui/views/controls/label.h" 27 #include "ui/views/controls/label.h"
27 #include "ui/views/controls/progress_bar.h" 28 #include "ui/views/controls/progress_bar.h"
28 #include "ui/views/controls/scroll_view.h" 29 #include "ui/views/controls/scroll_view.h"
29 #include "ui/views/controls/separator.h" 30 #include "ui/views/controls/separator.h"
30 #include "ui/views/layout/box_layout.h" 31 #include "ui/views/layout/box_layout.h"
31 #include "ui/views/view_targeter.h" 32 #include "ui/views/view_targeter.h"
32 #include "ui/views/view_targeter_delegate.h" 33 #include "ui/views/view_targeter_delegate.h"
33 34
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 232
232 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner) 233 TrayDetailsView::TrayDetailsView(SystemTrayItem* owner)
233 : owner_(owner), 234 : owner_(owner),
234 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)), 235 box_layout_(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)),
235 scroller_(nullptr), 236 scroller_(nullptr),
236 scroll_content_(nullptr), 237 scroll_content_(nullptr),
237 progress_bar_(nullptr), 238 progress_bar_(nullptr),
238 tri_view_(nullptr), 239 tri_view_(nullptr),
239 back_button_(nullptr) { 240 back_button_(nullptr) {
240 SetLayoutManager(box_layout_); 241 SetLayoutManager(box_layout_);
241 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 242 set_background(views::Background::CreateThemedSolidBackground(
243 this, ui::NativeTheme::kColorId_BubbleBackground));
242 } 244 }
243 245
244 TrayDetailsView::~TrayDetailsView() {} 246 TrayDetailsView::~TrayDetailsView() {}
245 247
246 void TrayDetailsView::OnViewClicked(views::View* sender) { 248 void TrayDetailsView::OnViewClicked(views::View* sender) {
247 HandleViewClicked(sender); 249 HandleViewClicked(sender);
248 } 250 }
249 251
250 void TrayDetailsView::ButtonPressed(views::Button* sender, 252 void TrayDetailsView::ButtonPressed(views::Button* sender,
251 const ui::Event& event) { 253 const ui::Event& event) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 290 }
289 291
290 void TrayDetailsView::CreateScrollableList() { 292 void TrayDetailsView::CreateScrollableList() {
291 DCHECK(!scroller_); 293 DCHECK(!scroller_);
292 scroll_content_ = new ScrollContentsView(); 294 scroll_content_ = new ScrollContentsView();
293 scroller_ = new views::ScrollView; 295 scroller_ = new views::ScrollView;
294 scroller_->SetContents(scroll_content_); 296 scroller_->SetContents(scroll_content_);
295 // Make the |scroller_| have a layer to clip |scroll_content_|'s children. 297 // Make the |scroller_| have a layer to clip |scroll_content_|'s children.
296 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer(). 298 // TODO(varkha): Make the sticky rows work with EnableViewPortLayer().
297 scroller_->SetPaintToLayer(); 299 scroller_->SetPaintToLayer();
298 scroller_->set_background( 300 scroller_->set_background(views::Background::CreateThemedSolidBackground(
299 views::Background::CreateSolidBackground(kBackgroundColor)); 301 scroller_, ui::NativeTheme::kColorId_BubbleBackground));
300 scroller_->layer()->SetMasksToBounds(true); 302 scroller_->layer()->SetMasksToBounds(true);
301 303
302 AddChildView(scroller_); 304 AddChildView(scroller_);
303 box_layout_->SetFlexForView(scroller_, 1); 305 box_layout_->SetFlexForView(scroller_, 1);
304 } 306 }
305 307
306 void TrayDetailsView::Reset() { 308 void TrayDetailsView::Reset() {
307 RemoveAllChildViews(true); 309 RemoveAllChildViews(true);
308 scroller_ = nullptr; 310 scroller_ = nullptr;
309 scroll_content_ = nullptr; 311 scroll_content_ = nullptr;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (bounds().IsEmpty()) 393 if (bounds().IsEmpty())
392 return views::View::GetHeightForWidth(width); 394 return views::View::GetHeightForWidth(width);
393 395
394 // The height of the bubble that contains this detailed view is set to 396 // The height of the bubble that contains this detailed view is set to
395 // the preferred height of the default view, and that determines the 397 // the preferred height of the default view, and that determines the
396 // initial height of |this|. Always request to stay the same height. 398 // initial height of |this|. Always request to stay the same height.
397 return height(); 399 return height();
398 } 400 }
399 401
400 } // namespace ash 402 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | ash/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698