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

Side by Side Diff: chrome/browser/ui/views/location_bar/bubble_icon_view.cc

Issue 2644903004: Move around more vector icons. (Closed)
Patch Set: fix comment Created 3 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/location_bar/bubble_icon_view.h" 5 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h"
6 6
7 #include "chrome/browser/command_updater.h" 7 #include "chrome/browser/command_updater.h"
8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
9 #include "ui/accessibility/ax_node_data.h" 9 #include "ui/accessibility/ax_node_data.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
11 #include "ui/gfx/color_utils.h" 11 #include "ui/gfx/color_utils.h"
12 #include "ui/gfx/paint_vector_icon.h" 12 #include "ui/gfx/paint_vector_icon.h"
13 #include "ui/native_theme/native_theme.h" 13 #include "ui/native_theme/native_theme.h"
14 #include "ui/views/animation/ink_drop_highlight.h" 14 #include "ui/views/animation/ink_drop_highlight.h"
15 #include "ui/views/animation/ink_drop_impl.h" 15 #include "ui/views/animation/ink_drop_impl.h"
16 #include "ui/views/bubble/bubble_dialog_delegate.h" 16 #include "ui/views/bubble/bubble_dialog_delegate.h"
17 17
18 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) 18 void BubbleIconView::Init() {
19 : image_(new views::ImageView()),
20 command_updater_(command_updater),
21 command_id_(command_id),
22 active_(false),
23 suppress_mouse_released_action_(false) {
24 AddChildView(image_); 19 AddChildView(image_);
25 image_->set_interactive(false); 20 image_->set_interactive(false);
26 image_->EnableCanvasFlippingForRTLUI(true); 21 image_->EnableCanvasFlippingForRTLUI(true);
27 SetInkDropMode(InkDropMode::ON); 22 SetInkDropMode(InkDropMode::ON);
28 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); 23 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
29 } 24 }
30 25
26 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id)
27 : image_(new views::ImageView()),
28 command_updater_(command_updater),
29 command_id_(command_id),
30 active_(false),
31 suppress_mouse_released_action_(false) {}
32
31 BubbleIconView::~BubbleIconView() {} 33 BubbleIconView::~BubbleIconView() {}
32 34
33 bool BubbleIconView::IsBubbleShowing() const { 35 bool BubbleIconView::IsBubbleShowing() const {
34 // If the bubble is being destroyed, it's considered showing though it may be 36 // If the bubble is being destroyed, it's considered showing though it may be
35 // already invisible currently. 37 // already invisible currently.
36 return GetBubble() != nullptr; 38 return GetBubble() != nullptr;
37 } 39 }
38 40
39 void BubbleIconView::SetImage(const gfx::ImageSkia* image_skia) { 41 void BubbleIconView::SetImage(const gfx::ImageSkia* image_skia) {
40 image_->SetImage(image_skia); 42 image_->SetImage(image_skia);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 if (!visible) 172 if (!visible)
171 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */); 173 AnimateInkDrop(views::InkDropState::DEACTIVATED, nullptr /* event */);
172 } 174 }
173 175
174 void BubbleIconView::ExecuteCommand(ExecuteSource source) { 176 void BubbleIconView::ExecuteCommand(ExecuteSource source) {
175 OnExecuting(source); 177 OnExecuting(source);
176 if (command_updater_) 178 if (command_updater_)
177 command_updater_->ExecuteCommand(command_id_); 179 command_updater_->ExecuteCommand(command_id_);
178 } 180 }
179 181
180 gfx::VectorIconId BubbleIconView::GetVectorIcon() const {
181 return gfx::VectorIconId::VECTOR_ICON_NONE;
182 }
183
184 void BubbleIconView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 182 void BubbleIconView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
185 views::BubbleDialogDelegateView* bubble = GetBubble(); 183 views::BubbleDialogDelegateView* bubble = GetBubble();
186 if (bubble) 184 if (bubble)
187 bubble->OnAnchorBoundsChanged(); 185 bubble->OnAnchorBoundsChanged();
188 } 186 }
189 187
190 void BubbleIconView::UpdateIcon() { 188 void BubbleIconView::UpdateIcon() {
191 const ui::NativeTheme* theme = GetNativeTheme(); 189 const ui::NativeTheme* theme = GetNativeTheme();
192 SkColor icon_color = 190 SkColor icon_color =
193 active_ 191 active_
194 ? theme->GetSystemColor( 192 ? theme->GetSystemColor(
195 ui::NativeTheme::kColorId_ProminentButtonColor) 193 ui::NativeTheme::kColorId_ProminentButtonColor)
196 : GetInkDropBaseColor(); 194 : GetInkDropBaseColor();
197 image_->SetImage(gfx::CreateVectorIcon( 195 image_->SetImage(gfx::CreateVectorIcon(
198 GetVectorIcon(), LocationBarView::kIconWidth, icon_color)); 196 GetVectorIcon(), LocationBarView::kIconWidth, icon_color));
199 } 197 }
200 198
201 void BubbleIconView::SetActiveInternal(bool active) { 199 void BubbleIconView::SetActiveInternal(bool active) {
202 if (active_ == active) 200 if (active_ == active)
203 return; 201 return;
204 active_ = active; 202 active_ = active;
205 UpdateIcon(); 203 UpdateIcon();
206 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/bubble_icon_view.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698