Commit fdd7aab6 authored by Yasmin's avatar Yasmin Committed by Commit Bot

Make protected member variables of sharing_icon_view private with proper setters and getters.

Bug: 988461
Change-Id: I86be68ebf6ad07bf680f11c49864a4ccb056e19e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761276Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Yasmin Molazadeh <yasmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688593}
parent 855ede69
...@@ -42,8 +42,8 @@ bool ClickToCallIconView::Update() { ...@@ -42,8 +42,8 @@ bool ClickToCallIconView::Update() {
if (!controller) if (!controller)
return false; return false;
if (show_error_ != controller->send_failed()) { if (should_show_error() != controller->send_failed()) {
show_error_ = controller->send_failed(); set_should_show_error(controller->send_failed());
UpdateIconImage(); UpdateIconImage();
} }
...@@ -54,13 +54,14 @@ bool ClickToCallIconView::Update() { ...@@ -54,13 +54,14 @@ bool ClickToCallIconView::Update() {
const bool is_bubble_showing = IsBubbleShowing(); const bool is_bubble_showing = IsBubbleShowing();
if (is_bubble_showing || loading_animation_ || last_controller_ != controller) if (is_bubble_showing || isLoadingAnimationVisible() ||
last_controller_ != controller)
ResetSlideAnimation(/*show=*/false); ResetSlideAnimation(/*show=*/false);
last_controller_ = controller; last_controller_ = controller;
const bool is_visible = const bool is_visible =
is_bubble_showing || loading_animation_ || label()->GetVisible(); is_bubble_showing || isLoadingAnimationVisible() || label()->GetVisible();
const bool visibility_changed = GetVisible() != is_visible; const bool visibility_changed = GetVisible() != is_visible;
SetVisible(is_visible); SetVisible(is_visible);
......
...@@ -44,7 +44,7 @@ void SharingIconView::StopLoadingAnimation(base::Optional<int> string_id) { ...@@ -44,7 +44,7 @@ void SharingIconView::StopLoadingAnimation(base::Optional<int> string_id) {
if (!loading_animation_) if (!loading_animation_)
return; return;
if (!show_error_) if (!should_show_error_)
AnimateIn(string_id); AnimateIn(string_id);
loading_animation_.reset(); loading_animation_.reset();
...@@ -154,8 +154,12 @@ bool SharingIconView::IsTriggerableEvent(const ui::Event& event) { ...@@ -154,8 +154,12 @@ bool SharingIconView::IsTriggerableEvent(const ui::Event& event) {
} }
const gfx::VectorIcon& SharingIconView::GetVectorIconBadge() const { const gfx::VectorIcon& SharingIconView::GetVectorIconBadge() const {
return show_error_ ? kBlockedBadgeIcon : gfx::kNoneIcon; return should_show_error_ ? kBlockedBadgeIcon : gfx::kNoneIcon;
} }
void SharingIconView::OnExecuting( void SharingIconView::OnExecuting(
PageActionIconView::ExecuteSource execute_source) {} PageActionIconView::ExecuteSource execute_source) {}
bool SharingIconView::isLoadingAnimationVisible() {
return loading_animation_.get();
}
...@@ -42,9 +42,15 @@ class SharingIconView : public PageActionIconView { ...@@ -42,9 +42,15 @@ class SharingIconView : public PageActionIconView {
void UpdateInkDrop(bool activate); void UpdateInkDrop(bool activate);
void UpdateOpacity(); void UpdateOpacity();
void UpdateLoaderColor(); void UpdateLoaderColor();
bool isLoadingAnimationVisible();
bool should_show_error() { return should_show_error_; }
void set_should_show_error(bool should_show_error) {
should_show_error_ = should_show_error;
}
private:
std::unique_ptr<gfx::ThrobAnimation> loading_animation_; std::unique_ptr<gfx::ThrobAnimation> loading_animation_;
bool show_error_ = false; bool should_show_error_ = false;
SkColor loader_color_; SkColor loader_color_;
DISALLOW_COPY_AND_ASSIGN(SharingIconView); DISALLOW_COPY_AND_ASSIGN(SharingIconView);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment