OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/views/toolbar/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.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_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return in_overflow_mode(); | 284 return in_overflow_mode(); |
285 } | 285 } |
286 | 286 |
287 void BrowserActionsContainer::OnBrowserActionViewDragDone() { | 287 void BrowserActionsContainer::OnBrowserActionViewDragDone() { |
288 ToolbarVisibleCountChanged(); | 288 ToolbarVisibleCountChanged(); |
289 FOR_EACH_OBSERVER(BrowserActionsContainerObserver, | 289 FOR_EACH_OBSERVER(BrowserActionsContainerObserver, |
290 observers_, | 290 observers_, |
291 OnBrowserActionDragDone()); | 291 OnBrowserActionDragDone()); |
292 } | 292 } |
293 | 293 |
294 views::View* BrowserActionsContainer::GetOverflowReferenceView() { | 294 views::MenuButton* BrowserActionsContainer::GetOverflowReferenceView() { |
295 // With traditional overflow, the reference is the chevron. With the | 295 // With traditional overflow, the reference is the chevron. With the |
296 // redesign, we use the wrench menu instead. | 296 // redesign, we use the wrench menu instead. |
297 return chevron_ ? | 297 return chevron_ ? |
298 chevron_ : | 298 chevron_ : |
299 BrowserView::GetBrowserViewForBrowser(browser_)->toolbar()->app_menu(); | 299 BrowserView::GetBrowserViewForBrowser(browser_)->toolbar()->app_menu(); |
300 } | 300 } |
301 | 301 |
302 void BrowserActionsContainer::SetPopupOwner(BrowserActionView* popup_owner) { | 302 void BrowserActionsContainer::SetPopupOwner(BrowserActionView* popup_owner) { |
303 // We should never be setting a popup owner when one already exists. | 303 // We should never be setting a popup owner when one already exists, and |
304 DCHECK(!popup_owner_ || !popup_owner); | 304 // never unsetting one when one wasn't set. |
| 305 DCHECK((!popup_owner_ && popup_owner) || |
| 306 (popup_owner_ && !popup_owner)); |
305 popup_owner_ = popup_owner; | 307 popup_owner_ = popup_owner; |
306 } | 308 } |
307 | 309 |
308 void BrowserActionsContainer::HideActivePopup() { | 310 void BrowserActionsContainer::HideActivePopup() { |
309 if (popup_owner_) | 311 if (popup_owner_) |
310 popup_owner_->view_controller()->HidePopup(); | 312 popup_owner_->view_controller()->HidePopup(); |
311 } | 313 } |
312 | 314 |
313 BrowserActionView* BrowserActionsContainer::GetMainViewForExtension( | 315 BrowserActionView* BrowserActionsContainer::GetMainViewForExtension( |
314 const Extension* extension) { | 316 const Extension* extension) { |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 if (initialized_ && profile_->IsOffTheRecord()) { | 1136 if (initialized_ && profile_->IsOffTheRecord()) { |
1135 main_displayed = in_overflow_mode() ? | 1137 main_displayed = in_overflow_mode() ? |
1136 main_container_->VisibleBrowserActionsAfterAnimation() : | 1138 main_container_->VisibleBrowserActionsAfterAnimation() : |
1137 VisibleBrowserActionsAfterAnimation(); | 1139 VisibleBrowserActionsAfterAnimation(); |
1138 } | 1140 } |
1139 | 1141 |
1140 // The overflow displays any (displayable) icons not shown by the main bar. | 1142 // The overflow displays any (displayable) icons not shown by the main bar. |
1141 return in_overflow_mode() ? | 1143 return in_overflow_mode() ? |
1142 displayable_icon_count - main_displayed : main_displayed; | 1144 displayable_icon_count - main_displayed : main_displayed; |
1143 } | 1145 } |
OLD | NEW |