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

Side by Side Diff: chrome/browser/ui/views/status_bubble_views.cc

Issue 2824363002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/ui (Closed)
Patch Set: Created 3 years, 8 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/status_bubble_views.h" 5 #include "chrome/browser/ui/views/status_bubble_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 text_.clear(); 259 text_.clear();
260 popup_->Hide(); 260 popup_->Hide();
261 state_ = BUBBLE_HIDDEN; 261 state_ = BUBBLE_HIDDEN;
262 } 262 }
263 263
264 void StatusBubbleViews::StatusView::StartTimer(base::TimeDelta time) { 264 void StatusBubbleViews::StatusView::StartTimer(base::TimeDelta time) {
265 if (timer_factory_.HasWeakPtrs()) 265 if (timer_factory_.HasWeakPtrs())
266 timer_factory_.InvalidateWeakPtrs(); 266 timer_factory_.InvalidateWeakPtrs();
267 267
268 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 268 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
269 FROM_HERE, base::Bind(&StatusBubbleViews::StatusView::OnTimer, 269 FROM_HERE,
270 timer_factory_.GetWeakPtr()), 270 base::BindOnce(&StatusBubbleViews::StatusView::OnTimer,
271 timer_factory_.GetWeakPtr()),
271 time); 272 time);
272 } 273 }
273 274
274 void StatusBubbleViews::StatusView::OnTimer() { 275 void StatusBubbleViews::StatusView::OnTimer() {
275 if (state_ == BUBBLE_HIDING_TIMER) { 276 if (state_ == BUBBLE_HIDING_TIMER) {
276 state_ = BUBBLE_HIDING_FADE; 277 state_ = BUBBLE_HIDING_FADE;
277 StartFade(1.0f, 0.0f, kHideFadeDurationMS); 278 StartFade(1.0f, 0.0f, kHideFadeDurationMS);
278 } else if (state_ == BUBBLE_SHOWING_TIMER) { 279 } else if (state_ == BUBBLE_SHOWING_TIMER) {
279 state_ = BUBBLE_SHOWING_FADE; 280 state_ = BUBBLE_SHOWING_FADE;
280 StartFade(0.0f, 1.0f, kShowFadeDurationMS); 281 StartFade(0.0f, 1.0f, kShowFadeDurationMS);
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 772
772 CancelExpandTimer(); 773 CancelExpandTimer();
773 774
774 // If bubble is already in expanded state, shift to adjust to new text 775 // If bubble is already in expanded state, shift to adjust to new text
775 // size (shrinking or expanding). Otherwise delay. 776 // size (shrinking or expanding). Otherwise delay.
776 if (is_expanded_ && !url.is_empty()) { 777 if (is_expanded_ && !url.is_empty()) {
777 ExpandBubble(); 778 ExpandBubble();
778 } else if (url_formatter::FormatUrl(url).length() > 779 } else if (url_formatter::FormatUrl(url).length() >
779 url_text_.length()) { 780 url_text_.length()) {
780 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 781 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
781 FROM_HERE, base::Bind(&StatusBubbleViews::ExpandBubble, 782 FROM_HERE,
782 expand_timer_factory_.GetWeakPtr()), 783 base::BindOnce(&StatusBubbleViews::ExpandBubble,
784 expand_timer_factory_.GetWeakPtr()),
783 base::TimeDelta::FromMilliseconds(kExpandHoverDelayMS)); 785 base::TimeDelta::FromMilliseconds(kExpandHoverDelayMS));
784 } 786 }
785 } 787 }
786 } 788 }
787 789
788 void StatusBubbleViews::Hide() { 790 void StatusBubbleViews::Hide() {
789 status_text_ = base::string16(); 791 status_text_ = base::string16();
790 url_text_ = base::string16(); 792 url_text_ = base::string16();
791 if (view_) 793 if (view_)
792 view_->Hide(); 794 view_->Hide();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 void StatusBubbleViews::SetBubbleWidth(int width) { 950 void StatusBubbleViews::SetBubbleWidth(int width) {
949 size_.set_width(width); 951 size_.set_width(width);
950 SetBounds(original_position_.x(), original_position_.y(), 952 SetBounds(original_position_.x(), original_position_.y(),
951 size_.width(), size_.height()); 953 size_.width(), size_.height());
952 } 954 }
953 955
954 void StatusBubbleViews::CancelExpandTimer() { 956 void StatusBubbleViews::CancelExpandTimer() {
955 if (expand_timer_factory_.HasWeakPtrs()) 957 if (expand_timer_factory_.HasWeakPtrs())
956 expand_timer_factory_.InvalidateWeakPtrs(); 958 expand_timer_factory_.InvalidateWeakPtrs();
957 } 959 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698