| 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 "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "chrome/browser/extensions/extension_action_manager.h" | 9 #include "chrome/browser/extensions/extension_action_manager.h" |
| 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return GetIconDimension(HEIGHT); | 147 return GetIconDimension(HEIGHT); |
| 148 } | 148 } |
| 149 | 149 |
| 150 // static | 150 // static |
| 151 void ToolbarActionsBar::RegisterProfilePrefs( | 151 void ToolbarActionsBar::RegisterProfilePrefs( |
| 152 user_prefs::PrefRegistrySyncable* registry) { | 152 user_prefs::PrefRegistrySyncable* registry) { |
| 153 registry->RegisterBooleanPref( | 153 registry->RegisterBooleanPref( |
| 154 prefs::kToolbarIconSurfacingBubbleAcknowledged, | 154 prefs::kToolbarIconSurfacingBubbleAcknowledged, |
| 155 false, | 155 false, |
| 156 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 156 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 157 registry->RegisterInt64Pref( | 157 registry->RegisterInt64Pref(prefs::kToolbarIconSurfacingBubbleLastShowTime, |
| 158 prefs::kToolbarIconSurfacingBubbleLastShowTime, | 158 0); |
| 159 0, | |
| 160 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 161 } | 159 } |
| 162 | 160 |
| 163 gfx::Size ToolbarActionsBar::GetPreferredSize() const { | 161 gfx::Size ToolbarActionsBar::GetPreferredSize() const { |
| 164 int icon_count = GetIconCount(); | 162 int icon_count = GetIconCount(); |
| 165 if (in_overflow_mode()) { | 163 if (in_overflow_mode()) { |
| 166 // In overflow, we always have a preferred size of a full row (even if we | 164 // In overflow, we always have a preferred size of a full row (even if we |
| 167 // don't use it), and always of at least one row. The parent may decide to | 165 // don't use it), and always of at least one row. The parent may decide to |
| 168 // show us even when empty, e.g. as a drag target for dragging in icons from | 166 // show us even when empty, e.g. as a drag target for dragging in icons from |
| 169 // the main container. | 167 // the main container. |
| 170 int row_count = ((std::max(0, icon_count - 1)) / | 168 int row_count = ((std::max(0, icon_count - 1)) / |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 for (ToolbarActionViewController* action : toolbar_actions_) { | 629 for (ToolbarActionViewController* action : toolbar_actions_) { |
| 632 if (action->GetId() == id) | 630 if (action->GetId() == id) |
| 633 return action; | 631 return action; |
| 634 } | 632 } |
| 635 return nullptr; | 633 return nullptr; |
| 636 } | 634 } |
| 637 | 635 |
| 638 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { | 636 content::WebContents* ToolbarActionsBar::GetCurrentWebContents() { |
| 639 return browser_->tab_strip_model()->GetActiveWebContents(); | 637 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 640 } | 638 } |
| OLD | NEW |