OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/tabs/alert_indicator_button.h" | 5 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "chrome/browser/ui/views/tabs/tab.h" | 8 #include "chrome/browser/ui/views/tabs/tab.h" |
9 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 9 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
10 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" | 10 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DISALLOW_COPY_AND_ASSIGN(FadeAnimationDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(FadeAnimationDelegate); |
63 }; | 63 }; |
64 | 64 |
65 AlertIndicatorButton::AlertIndicatorButton(Tab* parent_tab) | 65 AlertIndicatorButton::AlertIndicatorButton(Tab* parent_tab) |
66 : views::ImageButton(NULL), | 66 : views::ImageButton(NULL), |
67 parent_tab_(parent_tab), | 67 parent_tab_(parent_tab), |
68 alert_state_(TabAlertState::NONE), | 68 alert_state_(TabAlertState::NONE), |
69 showing_alert_state_(TabAlertState::NONE) { | 69 showing_alert_state_(TabAlertState::NONE) { |
70 DCHECK(parent_tab_); | 70 DCHECK(parent_tab_); |
71 SetEventTargeter( | 71 SetEventTargeter( |
72 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); | 72 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); |
73 } | 73 } |
74 | 74 |
75 AlertIndicatorButton::~AlertIndicatorButton() {} | 75 AlertIndicatorButton::~AlertIndicatorButton() {} |
76 | 76 |
77 void AlertIndicatorButton::TransitionToAlertState(TabAlertState next_state) { | 77 void AlertIndicatorButton::TransitionToAlertState(TabAlertState next_state) { |
78 if (next_state == alert_state_) | 78 if (next_state == alert_state_) |
79 return; | 79 return; |
80 | 80 |
81 TabAlertState previous_alert_showing_state = showing_alert_state_; | 81 TabAlertState previous_alert_showing_state = showing_alert_state_; |
82 | 82 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 SkColor color = parent_tab_->button_color(); | 260 SkColor color = parent_tab_->button_color(); |
261 gfx::ImageSkia indicator_image = | 261 gfx::ImageSkia indicator_image = |
262 chrome::GetTabAlertIndicatorImage(state, color).AsImageSkia(); | 262 chrome::GetTabAlertIndicatorImage(state, color).AsImageSkia(); |
263 SetImage(views::CustomButton::STATE_NORMAL, &indicator_image); | 263 SetImage(views::CustomButton::STATE_NORMAL, &indicator_image); |
264 SetImage(views::CustomButton::STATE_DISABLED, &indicator_image); | 264 SetImage(views::CustomButton::STATE_DISABLED, &indicator_image); |
265 gfx::ImageSkia affordance_image = | 265 gfx::ImageSkia affordance_image = |
266 chrome::GetTabAlertIndicatorAffordanceImage(state, color).AsImageSkia(); | 266 chrome::GetTabAlertIndicatorAffordanceImage(state, color).AsImageSkia(); |
267 SetImage(views::CustomButton::STATE_HOVERED, &affordance_image); | 267 SetImage(views::CustomButton::STATE_HOVERED, &affordance_image); |
268 SetImage(views::CustomButton::STATE_PRESSED, &affordance_image); | 268 SetImage(views::CustomButton::STATE_PRESSED, &affordance_image); |
269 } | 269 } |
OLD | NEW |