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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sessions/session_tab_helper.h" | 10 #include "chrome/browser/sessions/session_tab_helper.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 if (tab_order_helper_) { | 522 if (tab_order_helper_) { |
523 extra_icons = tab_order_helper_->GetExtraIconCount( | 523 extra_icons = tab_order_helper_->GetExtraIconCount( |
524 SessionTabHelper::IdForTab( | 524 SessionTabHelper::IdForTab( |
525 browser_->tab_strip_model()->GetActiveWebContents())); | 525 browser_->tab_strip_model()->GetActiveWebContents())); |
526 } | 526 } |
527 | 527 |
528 size_t visible_icons = in_overflow_mode() ? | 528 size_t visible_icons = in_overflow_mode() ? |
529 toolbar_actions_.size() - main_bar_->GetIconCount() : | 529 toolbar_actions_.size() - main_bar_->GetIconCount() : |
530 model_->visible_icon_count() + extra_icons; | 530 model_->visible_icon_count() + extra_icons; |
531 | 531 |
532 #if DCHECK_IS_ON | 532 #if !DCHECK_IS_OFF |
533 // Good time for some sanity checks: We should never try to display more | 533 // Good time for some sanity checks: We should never try to display more |
534 // icons than we have, and we should always have a view per item in the model. | 534 // icons than we have, and we should always have a view per item in the model. |
535 // (The only exception is if this is in initialization.) | 535 // (The only exception is if this is in initialization.) |
536 if (!toolbar_actions_.empty() && !suppress_layout_ && | 536 if (!toolbar_actions_.empty() && !suppress_layout_ && |
537 model_->extensions_initialized()) { | 537 model_->extensions_initialized()) { |
538 size_t num_extension_actions = 0u; | 538 size_t num_extension_actions = 0u; |
539 for (ToolbarActionViewController* action : toolbar_actions_) { | 539 for (ToolbarActionViewController* action : toolbar_actions_) { |
540 // No component action should ever have a valid extension id, so we can | 540 // No component action should ever have a valid extension id, so we can |
541 // use this to check the extension amount. | 541 // use this to check the extension amount. |
542 // TODO(devlin): Fix this to just check model size when the model also | 542 // TODO(devlin): Fix this to just check model size when the model also |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 for (ToolbarActionViewController* action : toolbar_actions_) { | 859 for (ToolbarActionViewController* action : toolbar_actions_) { |
860 if (action->GetId() == id) | 860 if (action->GetId() == id) |
861 return action; | 861 return action; |
862 } | 862 } |
863 return nullptr; | 863 return nullptr; |
864 } | 864 } |
865 | 865 |
866 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 866 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
867 return browser_->tab_strip_model()->GetActiveWebContents(); | 867 return browser_->tab_strip_model()->GetActiveWebContents(); |
868 } | 868 } |
OLD | NEW |