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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar.cc

Issue 1809813002: [Extensions] Show a "refresh" bubble when needed with click-to-script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 4 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 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/toolbar/toolbar_actions_bar.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 dropped_index); 486 dropped_index);
487 if (delta) 487 if (delta)
488 model_->SetVisibleIconCount(model_->visible_icon_count() + delta); 488 model_->SetVisibleIconCount(model_->visible_icon_count() + delta);
489 } 489 }
490 490
491 void ToolbarActionsBar::OnAnimationEnded() { 491 void ToolbarActionsBar::OnAnimationEnded() {
492 // Check if we were waiting for animation to complete to either show a 492 // Check if we were waiting for animation to complete to either show a
493 // message bubble, or to show a popup. 493 // message bubble, or to show a popup.
494 if (pending_extension_bubble_controller_) { 494 if (pending_extension_bubble_controller_) {
495 MaybeShowExtensionBubble(std::move(pending_extension_bubble_controller_)); 495 MaybeShowExtensionBubble(std::move(pending_extension_bubble_controller_));
496 } else if (pending_toolbar_bubble_controller_) {
497 ShowToolbarActionBubble(std::move(pending_toolbar_bubble_controller_));
496 } else if (!popped_out_closure_.is_null()) { 498 } else if (!popped_out_closure_.is_null()) {
497 popped_out_closure_.Run(); 499 popped_out_closure_.Run();
498 popped_out_closure_.Reset(); 500 popped_out_closure_.Reset();
499 } 501 }
500 } 502 }
501 503
502 bool ToolbarActionsBar::IsActionVisibleOnMainBar( 504 bool ToolbarActionsBar::IsActionVisibleOnMainBar(
503 const ToolbarActionViewController* action) const { 505 const ToolbarActionViewController* action) const {
504 if (in_overflow_mode()) 506 if (in_overflow_mode())
505 return main_bar_->IsActionVisibleOnMainBar(action); 507 return main_bar_->IsActionVisibleOnMainBar(action);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 } 570 }
569 571
570 void ToolbarActionsBar::AddObserver(ToolbarActionsBarObserver* observer) { 572 void ToolbarActionsBar::AddObserver(ToolbarActionsBarObserver* observer) {
571 observers_.AddObserver(observer); 573 observers_.AddObserver(observer);
572 } 574 }
573 575
574 void ToolbarActionsBar::RemoveObserver(ToolbarActionsBarObserver* observer) { 576 void ToolbarActionsBar::RemoveObserver(ToolbarActionsBarObserver* observer) {
575 observers_.RemoveObserver(observer); 577 observers_.RemoveObserver(observer);
576 } 578 }
577 579
580 void ToolbarActionsBar::ShowToolbarActionBubble(
581 scoped_ptr<ToolbarActionsBarBubbleDelegate> bubble) {
582 DCHECK(bubble->GetAnchorActionId().empty() ||
583 GetActionForId(bubble->GetAnchorActionId()));
584 if (delegate_->IsAnimating())
585 pending_toolbar_bubble_controller_ = std::move(bubble);
586 else
587 delegate_->ShowToolbarActionBubble(std::move(bubble));
588 }
589
578 void ToolbarActionsBar::MaybeShowExtensionBubble( 590 void ToolbarActionsBar::MaybeShowExtensionBubble(
579 scoped_ptr<extensions::ExtensionMessageBubbleController> controller) { 591 scoped_ptr<extensions::ExtensionMessageBubbleController> controller) {
580 controller->HighlightExtensionsIfNecessary(); // Safe to call multiple times. 592 controller->HighlightExtensionsIfNecessary(); // Safe to call multiple times.
581 if (delegate_->IsAnimating()) { 593 if (delegate_->IsAnimating()) {
582 // If the toolbar is animating, we can't effectively anchor the bubble, 594 // If the toolbar is animating, we can't effectively anchor the bubble,
583 // so wait until animation stops. 595 // so wait until animation stops.
584 pending_extension_bubble_controller_ = std::move(controller); 596 pending_extension_bubble_controller_ = std::move(controller);
585 } else if (controller->ShouldShow()) { 597 } else if (controller->ShouldShow()) {
586 // We check ShouldShow() above because the affected extensions may have been 598 // We check ShouldShow() above because the affected extensions may have been
587 // removed since the controller was initialized. 599 // removed since the controller was initialized.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 for (ToolbarActionViewController* action : toolbar_actions_) { 795 for (ToolbarActionViewController* action : toolbar_actions_) {
784 if (action->GetId() == action_id) 796 if (action->GetId() == action_id)
785 return action; 797 return action;
786 } 798 }
787 return nullptr; 799 return nullptr;
788 } 800 }
789 801
790 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { 802 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() {
791 return browser_->tab_strip_model()->GetActiveWebContents(); 803 return browser_->tab_strip_model()->GetActiveWebContents();
792 } 804 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar.h ('k') | chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698