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

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

Issue 11748023: M26 new bluetooth UI. List all bluetooth devices in detailed view and automatically discover all BT… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and nit. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/tray/tray_details_view.h ('k') | ash/system/tray/tray_views.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/system/tray/system_tray_item.h" 7 #include "ash/system/tray/system_tray_item.h"
8 #include "ash/system/tray/tray_constants.h" 8 #include "ash/system/tray/tray_constants.h"
9 #include "ash/system/tray/tray_views.h" 9 #include "ash/system/tray/tray_views.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/views/background.h" 11 #include "ui/views/background.h"
12 #include "ui/views/controls/scroll_view.h" 12 #include "ui/views/controls/scroll_view.h"
13 #include "ui/views/layout/box_layout.h" 13 #include "ui/views/layout/box_layout.h"
14 14
15 namespace ash { 15 namespace ash {
16 namespace internal { 16 namespace internal {
17 17
18 class ScrollSeparator : public views::View {
19 public:
20 ScrollSeparator() {}
21
22 virtual ~ScrollSeparator() {}
23
24 private:
25 // Overriden from views::View.
26 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
27 canvas->FillRect(gfx::Rect(0, height() / 2, width(), 1), kBorderLightColor);
28 }
29 virtual gfx::Size GetPreferredSize() OVERRIDE {
30 return gfx::Size(1, kTrayPopupScrollSeparatorHeight);
31 }
32
33 DISALLOW_COPY_AND_ASSIGN(ScrollSeparator);
34 };
35
18 class ScrollBorder : public views::Border { 36 class ScrollBorder : public views::Border {
19 public: 37 public:
20 ScrollBorder() {} 38 ScrollBorder() {}
21 virtual ~ScrollBorder() {} 39 virtual ~ScrollBorder() {}
22 40
23 void set_visible(bool visible) { visible_ = visible; } 41 void set_visible(bool visible) { visible_ = visible; }
24 42
25 private: 43 private:
26 // Overridden from views::Border. 44 // Overridden from views::Border.
27 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE { 45 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 scroller_ = new FixedSizedScrollView; 88 scroller_ = new FixedSizedScrollView;
71 scroller_->SetContentsView(scroll_content_); 89 scroller_->SetContentsView(scroll_content_);
72 90
73 // Note: |scroller_| takes ownership of |scroll_border_|. 91 // Note: |scroller_| takes ownership of |scroll_border_|.
74 scroll_border_ = new ScrollBorder; 92 scroll_border_ = new ScrollBorder;
75 scroller_->set_border(scroll_border_); 93 scroller_->set_border(scroll_border_);
76 94
77 AddChildView(scroller_); 95 AddChildView(scroller_);
78 } 96 }
79 97
98 void TrayDetailsView::AddScrollSeparator() {
99 DCHECK(scroll_content_);
100 // Do not draw the separator if it is the very first item
101 // in the scrollable list.
102 if (scroll_content_->has_children())
103 scroll_content_->AddChildView(new ScrollSeparator);
104 }
105
80 void TrayDetailsView::Reset() { 106 void TrayDetailsView::Reset() {
81 RemoveAllChildViews(true); 107 RemoveAllChildViews(true);
82 footer_ = NULL; 108 footer_ = NULL;
83 scroller_ = NULL; 109 scroller_ = NULL;
84 scroll_content_ = NULL; 110 scroll_content_ = NULL;
85 } 111 }
86 112
87 void TrayDetailsView::Layout() { 113 void TrayDetailsView::Layout() {
88 if (!scroller_ || !footer_ || bounds().IsEmpty()) { 114 if (!scroller_ || !footer_ || bounds().IsEmpty()) {
89 views::View::Layout(); 115 views::View::Layout();
(...skipping 24 matching lines...) Expand all
114 scroll_border_->set_visible(true); 140 scroll_border_->set_visible(true);
115 else 141 else
116 scroll_border_->set_visible(false); 142 scroll_border_->set_visible(false);
117 } 143 }
118 144
119 views::View::OnPaintBorder(canvas); 145 views::View::OnPaintBorder(canvas);
120 } 146 }
121 147
122 } // namespace internal 148 } // namespace internal
123 } // namespace ash 149 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_details_view.h ('k') | ash/system/tray/tray_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698