diff options
Diffstat (limited to 'chrome/browser/ui/toolbar')
9 files changed, 4 insertions, 104 deletions
diff --git a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc index 5860926..a9d2a72 100644 --- a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc +++ b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc @@ -314,34 +314,11 @@ IN_PROC_BROWSER_TEST_F(BrowserActionsBarRedesignBrowserTest, // Reduce the visible icon count so that the extension is hidden. toolbar_model()->SetVisibleIconCount(3); - EXPECT_FALSE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - // Make the extension want to run, and verify that the overflow button (the - // wrench) has the correct UI. Then, make the extension not want to run and - // verify it goes away. + // The extension should want to run whether or not it's hidden. action->SetIsVisible(tab_id, true); extension_action_api->NotifyChange(action, web_contents, profile()); - EXPECT_TRUE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - action->SetIsVisible(tab_id, false); - extension_action_api->NotifyChange(action, web_contents, profile()); - EXPECT_FALSE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - - // Make the extension want to run again, and then move it out of the overflow - // menu. This should stop the wrench menu from having the special UI. - action->SetIsVisible(tab_id, true); - extension_action_api->NotifyChange(action, web_contents, profile()); - EXPECT_TRUE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - toolbar_model()->SetVisibleIconCount(4); - EXPECT_FALSE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - - // Adjusting the visible count down should mean an overflowed action wants - // to run again. Removing the action that wants to run should result in - // no overflowed action wanting to run. - toolbar_model()->SetVisibleIconCount(3); - EXPECT_TRUE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); - extension_service()->DisableExtension(page_action_extension->id(), - extensions::Extension::DISABLE_NONE); - EXPECT_FALSE(browser_actions_bar()->OverflowedActionButtonWantsToRun()); + EXPECT_TRUE(browser_actions_bar()->ActionButtonWantsToRun(3)); } IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc index e6cb99c..4760d0b 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.cc @@ -103,9 +103,6 @@ void SortContainer(std::vector<Type1>* to_sort, // static bool ToolbarActionsBar::disable_animations_for_testing_ = false; -// static -bool ToolbarActionsBar::send_overflowed_action_changes_ = true; - ToolbarActionsBar::PlatformSettings::PlatformSettings(bool in_overflow_mode) : left_padding(in_overflow_mode ? kOverflowLeftPadding : kLeftPadding), right_padding(in_overflow_mode ? kOverflowRightPadding : kRightPadding), @@ -127,7 +124,6 @@ ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate, model_observer_(this), suppress_layout_(false), suppress_animation_(true), - overflowed_action_wants_to_run_(false), checked_extension_bubble_(false), popped_out_action_(nullptr), weak_ptr_factory_(this) { @@ -617,8 +613,6 @@ void ToolbarActionsBar::OnToolbarActionRemoved(const std::string& action_id) { ResizeDelegate(gfx::Tween::EASE_OUT, false); } } - - SetOverflowedActionWantsToRun(); } void ToolbarActionsBar::OnToolbarActionMoved(const std::string& action_id, @@ -634,15 +628,12 @@ void ToolbarActionsBar::OnToolbarActionUpdated(const std::string& action_id) { ToolbarActionViewController* action = GetActionForId(action_id); // There might not be a view in cases where we are highlighting or if we // haven't fully initialized the actions. - if (action) { + if (action) action->UpdateState(); - SetOverflowedActionWantsToRun(); - } } void ToolbarActionsBar::OnToolbarVisibleCountChanged() { ResizeDelegate(gfx::Tween::EASE_OUT, false); - SetOverflowedActionWantsToRun(); } void ToolbarActionsBar::ResizeDelegate(gfx::Tween::Type tween_type, @@ -709,28 +700,6 @@ void ToolbarActionsBar::ReorderActions() { ResizeDelegate(gfx::Tween::EASE_OUT, false); delegate_->Redraw(true); } - - SetOverflowedActionWantsToRun(); -} - -void ToolbarActionsBar::SetOverflowedActionWantsToRun() { - if (in_overflow_mode()) - return; - bool overflowed_action_wants_to_run = false; - content::WebContents* web_contents = GetCurrentWebContents(); - for (size_t i = GetIconCount(); i < toolbar_actions_.size(); ++i) { - if (toolbar_actions_[i]->WantsToRun(web_contents)) { - overflowed_action_wants_to_run = true; - break; - } - } - - if (overflowed_action_wants_to_run_ != overflowed_action_wants_to_run) { - overflowed_action_wants_to_run_ = overflowed_action_wants_to_run; - if (send_overflowed_action_changes_) - delegate_->OnOverflowedActionWantsToRunChanged( - overflowed_action_wants_to_run_); - } } ToolbarActionViewController* ToolbarActionsBar::GetActionForId( diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar.h b/chrome/browser/ui/toolbar/toolbar_actions_bar.h index a0e1b7c..2e78ef3 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar.h +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar.h @@ -197,11 +197,6 @@ class ToolbarActionsBar : public ToolbarActionsModel::Observer { ToolbarActionsBarDelegate* delegate_for_test() { return delegate_; } - static void set_send_overflowed_action_changes_for_testing( - bool send_overflowed_action_changes) { - send_overflowed_action_changes_ = send_overflowed_action_changes; - } - // During testing we can disable animations by setting this flag to true, // so that the bar resizes instantly, instead of having to poll it while it // animates to open/closed status. @@ -234,9 +229,6 @@ class ToolbarActionsBar : public ToolbarActionsModel::Observer { // value of |pop_out_actions_to_run|. void ReorderActions(); - // Sets |overflowed_action_wants_to_run_| to the proper value. - void SetOverflowedActionWantsToRun(); - // Shows an extension message bubble, if any should be shown. void MaybeShowExtensionBubble( scoped_ptr<extensions::ExtensionMessageBubbleController> controller); @@ -280,14 +272,6 @@ class ToolbarActionsBar : public ToolbarActionsModel::Observer { // See also TabOrderHelper in the .cc file. static bool pop_out_actions_to_run_; - // If set to false, notifications for OnOverflowedActionWantsToRunChanged() - // will not be sent. Used because in unit tests there is no wrench menu to - // alter. - static bool send_overflowed_action_changes_; - - // True if an action in the overflow menu wants to run. - bool overflowed_action_wants_to_run_; - // True if we have checked to see if there is an extension bubble that should // be displayed, and, if there is, shown that bubble. bool checked_extension_bubble_; diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h b/chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h index d7c6df29..e00da80 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h @@ -57,11 +57,6 @@ class ToolbarActionsBarDelegate { // Returns the width (including padding) for the overflow chevron. virtual int GetChevronWidth() const = 0; - // Notifies the delegate that the value of whether or not any overflowed - // action wants to run has changed. - virtual void OnOverflowedActionWantsToRunChanged( - bool overflowed_action_wants_to_run) = 0; - // Displays the bubble for the passed ExtensionMessageBubbleController, // anchored to |anchor_action|. If |anchor_action| is null, it should be // anchored to the hotdog menu. diff --git a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc index 18fab96..6fb1a2a 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc @@ -114,7 +114,6 @@ void ToolbarActionsBarUnitTest::SetUp() { profile()); ToolbarActionsBar::disable_animations_for_testing_ = true; - ToolbarActionsBar::set_send_overflowed_action_changes_for_testing(false); browser_action_test_util_.reset(new BrowserActionTestUtil(browser(), false)); if (use_redesign_) { diff --git a/chrome/browser/ui/toolbar/wrench_icon_painter.cc b/chrome/browser/ui/toolbar/wrench_icon_painter.cc index 81aabc1..d654160 100644 --- a/chrome/browser/ui/toolbar/wrench_icon_painter.cc +++ b/chrome/browser/ui/toolbar/wrench_icon_painter.cc @@ -146,8 +146,6 @@ int WrenchIconPainter::GetCurrentSeverityImageID() const { switch (severity_) { case SEVERITY_NONE: return 0; - case SEVERITY_INFO: - return IDR_TOOLS_BAR_INFO; case SEVERITY_LOW: return IDR_TOOLS_BAR_LOW; case SEVERITY_MEDIUM: diff --git a/chrome/browser/ui/toolbar/wrench_icon_painter.h b/chrome/browser/ui/toolbar/wrench_icon_painter.h index cf4f7f1..c50d7b2 100644 --- a/chrome/browser/ui/toolbar/wrench_icon_painter.h +++ b/chrome/browser/ui/toolbar/wrench_icon_painter.h @@ -32,7 +32,6 @@ class WrenchIconPainter : gfx::AnimationDelegate { enum Severity { SEVERITY_NONE, - SEVERITY_INFO, SEVERITY_LOW, SEVERITY_MEDIUM, SEVERITY_HIGH, diff --git a/chrome/browser/ui/toolbar/wrench_menu_badge_controller.cc b/chrome/browser/ui/toolbar/wrench_menu_badge_controller.cc index d3838b1..da80866 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_badge_controller.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_badge_controller.cc @@ -78,8 +78,7 @@ bool ShouldShowIncompatibilityWarning() { WrenchMenuBadgeController::WrenchMenuBadgeController(Profile* profile, Delegate* delegate) : profile_(profile), - delegate_(delegate), - overflowed_toolbar_action_wants_to_run_(false) { + delegate_(delegate) { DCHECK(profile_); DCHECK(delegate_); @@ -126,22 +125,10 @@ void WrenchMenuBadgeController::UpdateDelegate() { return; } - if (overflowed_toolbar_action_wants_to_run_) { - delegate_->UpdateBadgeSeverity(BADGE_TYPE_NONE, - WrenchIconPainter::SEVERITY_INFO, true); - return; - } - delegate_->UpdateBadgeSeverity(BADGE_TYPE_NONE, WrenchIconPainter::SEVERITY_NONE, true); } -void WrenchMenuBadgeController::SetOverflowedToolbarActionWantsToRun( - bool wants_to_run) { - overflowed_toolbar_action_wants_to_run_ = wants_to_run; - UpdateDelegate(); -} - void WrenchMenuBadgeController::Observe( int type, const content::NotificationSource& source, diff --git a/chrome/browser/ui/toolbar/wrench_menu_badge_controller.h b/chrome/browser/ui/toolbar/wrench_menu_badge_controller.h index c75b371..abdfd40 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_badge_controller.h +++ b/chrome/browser/ui/toolbar/wrench_menu_badge_controller.h @@ -50,13 +50,6 @@ class WrenchMenuBadgeController : public content::NotificationObserver { // delegate. void UpdateDelegate(); - // Sets |overflowed_toolbar_action_wants_to_run_| and updates the delegate. - void SetOverflowedToolbarActionWantsToRun(bool wants_to_run); - - bool overflowed_toolbar_action_wants_to_run() const { - return overflowed_toolbar_action_wants_to_run_; - } - private: // content::NotificationObserver: void Observe(int type, @@ -66,7 +59,6 @@ class WrenchMenuBadgeController : public content::NotificationObserver { Profile* profile_; Delegate* delegate_; content::NotificationRegistrar registrar_; - bool overflowed_toolbar_action_wants_to_run_; DISALLOW_COPY_AND_ASSIGN(WrenchMenuBadgeController); }; |