| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/browser_actions_container.h" | 5 #include "chrome/browser/views/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 void BrowserActionsContainer::RemoveBrowserAction(Extension* extension) { | 294 void BrowserActionsContainer::RemoveBrowserAction(Extension* extension) { |
| 295 if (!extension->browser_action()) | 295 if (!extension->browser_action()) |
| 296 return; | 296 return; |
| 297 | 297 |
| 298 for (std::vector<BrowserActionView*>::iterator iter = | 298 for (std::vector<BrowserActionView*>::iterator iter = |
| 299 browser_action_views_.begin(); iter != browser_action_views_.end(); | 299 browser_action_views_.begin(); iter != browser_action_views_.end(); |
| 300 ++iter) { | 300 ++iter) { |
| 301 if ((*iter)->button()->extension() == extension) { | 301 if ((*iter)->button()->extension() == extension) { |
| 302 RemoveChildView(*iter); | 302 RemoveChildView(*iter); |
| 303 delete *iter; |
| 303 browser_action_views_.erase(iter); | 304 browser_action_views_.erase(iter); |
| 304 if (GetParent()) | 305 if (GetParent()) |
| 305 GetParent()->SchedulePaint(); | 306 GetParent()->SchedulePaint(); |
| 306 return; | 307 return; |
| 307 } | 308 } |
| 308 } | 309 } |
| 309 } | 310 } |
| 310 | 311 |
| 311 void BrowserActionsContainer::DeleteBrowserActionViews() { | 312 void BrowserActionsContainer::DeleteBrowserActionViews() { |
| 312 if (!browser_action_views_.empty()) { | 313 if (!browser_action_views_.empty()) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 std::min(static_cast<int>(browser_action_views_.size()), | 470 std::min(static_cast<int>(browser_action_views_.size()), |
| 470 kMinimumNumberOfVisibleBrowserActions) * kButtonSize; | 471 kMinimumNumberOfVisibleBrowserActions) * kButtonSize; |
| 471 | 472 |
| 472 // Even if available_width is <= 0, we still return at least the |min_width|. | 473 // Even if available_width is <= 0, we still return at least the |min_width|. |
| 473 if (available_width <= 0) | 474 if (available_width <= 0) |
| 474 return min_width; | 475 return min_width; |
| 475 | 476 |
| 476 return std::max(min_width, available_width - available_width % kButtonSize + | 477 return std::max(min_width, available_width - available_width % kButtonSize + |
| 477 kHorizontalPadding * 2); | 478 kHorizontalPadding * 2); |
| 478 } | 479 } |
| OLD | NEW |