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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: WIP: use observer Created 3 years, 9 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 "chrome/browser/ui/views/download/download_item_view.h" 5 #include "chrome/browser/ui/views/download/download_item_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 DISALLOW_COPY_AND_ASSIGN(SeparatorBorder); 152 DISALLOW_COPY_AND_ASSIGN(SeparatorBorder);
153 }; 153 };
154 154
155 } // namespace 155 } // namespace
156 156
157 // Allows the DownloadItemView to control the InkDrop on the drop down button. 157 // Allows the DownloadItemView to control the InkDrop on the drop down button.
158 class DownloadItemView::DropDownButton : public views::VectorIconButton { 158 class DownloadItemView::DropDownButton : public views::VectorIconButton {
159 public: 159 public:
160 explicit DropDownButton(views::VectorIconButtonDelegate* delegate) 160 explicit DropDownButton(views::VectorIconButtonDelegate* delegate)
161 : views::VectorIconButton(delegate) {} 161 : views::VectorIconButton(delegate) {
162 SetPadding(gfx::Insets(kDropdownBorderWidth));
163 }
162 ~DropDownButton() override {} 164 ~DropDownButton() override {}
163 165
164 // Promoted visibility to public. 166 // Promoted visibility to public.
165 void AnimateInkDrop(views::InkDropState state) { 167 void AnimateInkDrop(views::InkDropState state) {
166 // TODO(bruthig): Plumb in the proper Event. 168 // TODO(bruthig): Plumb in the proper Event.
167 views::VectorIconButton::AnimateInkDrop(state, nullptr /* event */); 169 views::VectorIconButton::AnimateInkDrop(state, nullptr /* event */);
168 } 170 }
169 171
170 private: 172 private:
171 DISALLOW_COPY_AND_ASSIGN(DropDownButton); 173 DISALLOW_COPY_AND_ASSIGN(DropDownButton);
(...skipping 15 matching lines...) Expand all
187 dangerous_download_label_sized_(false), 189 dangerous_download_label_sized_(false),
188 disabled_while_opening_(false), 190 disabled_while_opening_(false),
189 creation_time_(base::Time::Now()), 191 creation_time_(base::Time::Now()),
190 time_download_warning_shown_(base::Time()), 192 time_download_warning_shown_(base::Time()),
191 weak_ptr_factory_(this) { 193 weak_ptr_factory_(this) {
192 SetInkDropMode(InkDropMode::ON); 194 SetInkDropMode(InkDropMode::ON);
193 DCHECK(download()); 195 DCHECK(download());
194 download()->AddObserver(this); 196 download()->AddObserver(this);
195 set_context_menu_controller(this); 197 set_context_menu_controller(this);
196 198
197 dropdown_button_->SetBorder(
198 views::CreateEmptyBorder(gfx::Insets(kDropdownBorderWidth)));
199 AddChildView(dropdown_button_); 199 AddChildView(dropdown_button_);
200 200
201 LoadIcon(); 201 LoadIcon();
202 202
203 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 203 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
204 font_list_ = 204 font_list_ =
205 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1); 205 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(1);
206 status_font_list_ = 206 status_font_list_ =
207 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2); 207 rb.GetFontList(ui::ResourceBundle::BaseFont).DeriveWithSizeDelta(-2);
208 208
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 SchedulePaint(); 1124 SchedulePaint();
1125 } 1125 }
1126 1126
1127 SkColor DownloadItemView::GetTextColor() const { 1127 SkColor DownloadItemView::GetTextColor() const {
1128 return GetTextColorForThemeProvider(GetThemeProvider()); 1128 return GetTextColorForThemeProvider(GetThemeProvider());
1129 } 1129 }
1130 1130
1131 SkColor DownloadItemView::GetDimmedTextColor() const { 1131 SkColor DownloadItemView::GetDimmedTextColor() const {
1132 return SkColorSetA(GetTextColor(), 0xC7); 1132 return SkColorSetA(GetTextColor(), 0xC7);
1133 } 1133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698