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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "chrome/browser/extensions/extension_action_manager.h" | 8 #include "chrome/browser/extensions/extension_action_manager.h" |
9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 if (tab_order_helper_) { | 528 if (tab_order_helper_) { |
529 extra_icons = tab_order_helper_->GetExtraIconCount( | 529 extra_icons = tab_order_helper_->GetExtraIconCount( |
530 SessionTabHelper::IdForTab( | 530 SessionTabHelper::IdForTab( |
531 browser_->tab_strip_model()->GetActiveWebContents())); | 531 browser_->tab_strip_model()->GetActiveWebContents())); |
532 } | 532 } |
533 | 533 |
534 size_t visible_icons = in_overflow_mode() ? | 534 size_t visible_icons = in_overflow_mode() ? |
535 toolbar_actions_.size() - main_bar_->GetIconCount() : | 535 toolbar_actions_.size() - main_bar_->GetIconCount() : |
536 model_->visible_icon_count() + extra_icons; | 536 model_->visible_icon_count() + extra_icons; |
537 | 537 |
538 #if DCHECK_IS_ON | 538 #if DCHECK_IS_ON() |
539 // Good time for some sanity checks: We should never try to display more | 539 // Good time for some sanity checks: We should never try to display more |
540 // icons than we have, and we should always have a view per item in the model. | 540 // icons than we have, and we should always have a view per item in the model. |
541 // (The only exception is if this is in initialization.) | 541 // (The only exception is if this is in initialization.) |
542 if (!toolbar_actions_.empty() && !suppress_layout_ && | 542 if (!toolbar_actions_.empty() && !suppress_layout_ && |
543 model_->extensions_initialized()) { | 543 model_->extensions_initialized()) { |
544 size_t num_extension_actions = 0u; | 544 size_t num_extension_actions = 0u; |
545 for (ToolbarActionViewController* action : toolbar_actions_) { | 545 for (ToolbarActionViewController* action : toolbar_actions_) { |
546 // No component action should ever have a valid extension id, so we can | 546 // No component action should ever have a valid extension id, so we can |
547 // use this to check the extension amount. | 547 // use this to check the extension amount. |
548 // TODO(devlin): Fix this to just check model size when the model also | 548 // TODO(devlin): Fix this to just check model size when the model also |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 for (ToolbarActionViewController* action : toolbar_actions_) { | 893 for (ToolbarActionViewController* action : toolbar_actions_) { |
894 if (action->GetId() == id) | 894 if (action->GetId() == id) |
895 return action; | 895 return action; |
896 } | 896 } |
897 return nullptr; | 897 return nullptr; |
898 } | 898 } |
899 | 899 |
900 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 900 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
901 return browser_->tab_strip_model()->GetActiveWebContents(); | 901 return browser_->tab_strip_model()->GetActiveWebContents(); |
902 } | 902 } |
OLD | NEW |