| 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/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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 toolbar_actions_.weak_erase(iter); | 671 toolbar_actions_.weak_erase(iter); |
| 672 delegate_->RemoveViewForAction(removed_action.get()); | 672 delegate_->RemoveViewForAction(removed_action.get()); |
| 673 if (popped_out_action_ == removed_action.get()) | 673 if (popped_out_action_ == removed_action.get()) |
| 674 UndoPopOut(); | 674 UndoPopOut(); |
| 675 removed_action.reset(); | 675 removed_action.reset(); |
| 676 | 676 |
| 677 // If the extension is being upgraded we don't want the bar to shrink | 677 // If the extension is being upgraded we don't want the bar to shrink |
| 678 // because the icon is just going to get re-added to the same location. | 678 // because the icon is just going to get re-added to the same location. |
| 679 // There is an exception if this is an off-the-record profile, and the | 679 // There is an exception if this is an off-the-record profile, and the |
| 680 // extension is no longer incognito-enabled. | 680 // extension is no longer incognito-enabled. |
| 681 if (!extensions::ExtensionSystem::Get(browser_->profile()) | 681 if (ComponentToolbarActionsFactory::GetInstance() |
| 682 ->runtime_data() | 682 ->IsComponentActionId(action_id) || |
| 683 ->IsBeingUpgraded(action_id) || | 683 !extensions::ExtensionSystem::Get(browser_->profile()) |
| 684 ->runtime_data() |
| 685 ->IsBeingUpgraded(action_id) || |
| 684 (browser_->profile()->IsOffTheRecord() && | 686 (browser_->profile()->IsOffTheRecord() && |
| 685 !extensions::util::IsIncognitoEnabled(action_id, browser_->profile()))) { | 687 !extensions::util::IsIncognitoEnabled(action_id, browser_->profile()))) { |
| 686 if (toolbar_actions_.size() > model_->visible_icon_count()) { | 688 if (toolbar_actions_.size() > model_->visible_icon_count()) { |
| 687 // If we have more icons than we can show, then we must not be changing | 689 // If we have more icons than we can show, then we must not be changing |
| 688 // the container size (since we either removed an icon from the main | 690 // the container size (since we either removed an icon from the main |
| 689 // area and one from the overflow list will have shifted in, or we | 691 // area and one from the overflow list will have shifted in, or we |
| 690 // removed an entry directly from the overflow list). | 692 // removed an entry directly from the overflow list). |
| 691 delegate_->Redraw(false); | 693 delegate_->Redraw(false); |
| 692 } else { | 694 } else { |
| 693 // Either we went from overflow to no-overflow, or we shrunk the no- | 695 // Either we went from overflow to no-overflow, or we shrunk the no- |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 for (ToolbarActionViewController* action : toolbar_actions_) { | 826 for (ToolbarActionViewController* action : toolbar_actions_) { |
| 825 if (action->GetId() == action_id) | 827 if (action->GetId() == action_id) |
| 826 return action; | 828 return action; |
| 827 } | 829 } |
| 828 return nullptr; | 830 return nullptr; |
| 829 } | 831 } |
| 830 | 832 |
| 831 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 833 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
| 832 return browser_->tab_strip_model()->GetActiveWebContents(); | 834 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 833 } | 835 } |
| OLD | NEW |