| Index: chrome/browser/views/browser_actions_container.cc
|
| diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc
|
| index 6786ed6f738c12bf645f16c8229925ff5cce16dd..d5dd123326a7fb4b5e7fb7aea887620adc1bce5e 100644
|
| --- a/chrome/browser/views/browser_actions_container.cc
|
| +++ b/chrome/browser/views/browser_actions_container.cc
|
| @@ -443,6 +443,9 @@ void BrowserActionsContainer::CreateBrowserActionViews() {
|
| DCHECK(browser_action_views_.empty());
|
| for (ExtensionList::iterator iter = model_->begin();
|
| iter != model_->end(); ++iter) {
|
| + if (!ShouldDisplayBrowserAction(*iter))
|
| + continue;
|
| +
|
| BrowserActionView* view = new BrowserActionView(*iter, this);
|
| browser_action_views_.push_back(view);
|
| AddChildView(view);
|
| @@ -666,6 +669,7 @@ void BrowserActionsContainer::ViewHierarchyChanged(bool is_add,
|
| bool BrowserActionsContainer::GetDropFormats(
|
| int* formats, std::set<OSExchangeData::CustomFormat>* custom_formats) {
|
| custom_formats->insert(BrowserActionDragData::GetBrowserActionCustomFormat());
|
| +
|
| return true;
|
| }
|
|
|
| @@ -766,6 +770,9 @@ int BrowserActionsContainer::OnPerformDrop(
|
| if (i > data.index())
|
| --i;
|
|
|
| + if (profile_->IsOffTheRecord())
|
| + i = model_->IncognitoIndexToOriginal(i);
|
| +
|
| model_->MoveBrowserAction(dragging, i);
|
|
|
| OnDragExited(); // Perform clean up after dragging.
|
| @@ -928,6 +935,12 @@ void BrowserActionsContainer::BrowserActionAdded(Extension* extension,
|
|
|
| CloseOverflowMenu();
|
|
|
| + if (!ShouldDisplayBrowserAction(extension))
|
| + return;
|
| +
|
| + if (profile_->IsOffTheRecord())
|
| + index = model_->OriginalIndexToIncognito(index);
|
| +
|
| // Before we change anything, determine the number of visible browser actions.
|
| size_t visible_actions = VisibleBrowserActions();
|
|
|
| @@ -1006,6 +1019,12 @@ void BrowserActionsContainer::BrowserActionRemoved(Extension* extension) {
|
|
|
| void BrowserActionsContainer::BrowserActionMoved(Extension* extension,
|
| int index) {
|
| + if (!ShouldDisplayBrowserAction(extension))
|
| + return;
|
| +
|
| + if (profile_->IsOffTheRecord())
|
| + index = model_->OriginalIndexToIncognito(index);
|
| +
|
| DCHECK(index >= 0 && index < static_cast<int>(browser_action_views_.size()));
|
|
|
| DeleteBrowserActionViews();
|
| @@ -1099,3 +1118,10 @@ void BrowserActionsContainer::NotifyMenuDeleted(
|
| DCHECK(controller == overflow_menu_);
|
| overflow_menu_ = NULL;
|
| }
|
| +
|
| +bool BrowserActionsContainer::ShouldDisplayBrowserAction(Extension* extension) {
|
| + // Only display incognito-enabled extensions while in incognito mode.
|
| + return (!profile_->IsOffTheRecord() ||
|
| + profile_->GetExtensionsService()->
|
| + IsIncognitoEnabled(extension->id()));
|
| +}
|
|
|