OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 void BrowserActionsContainer::CloseOverflowMenu() { | 1039 void BrowserActionsContainer::CloseOverflowMenu() { |
1040 if (overflow_menu_) | 1040 if (overflow_menu_) |
1041 overflow_menu_->CancelMenu(); | 1041 overflow_menu_->CancelMenu(); |
1042 } | 1042 } |
1043 | 1043 |
1044 void BrowserActionsContainer::StopShowFolderDropMenuTimer() { | 1044 void BrowserActionsContainer::StopShowFolderDropMenuTimer() { |
1045 show_menu_task_factory_.InvalidateWeakPtrs(); | 1045 show_menu_task_factory_.InvalidateWeakPtrs(); |
1046 } | 1046 } |
1047 | 1047 |
1048 void BrowserActionsContainer::StartShowFolderDropMenuTimer() { | 1048 void BrowserActionsContainer::StartShowFolderDropMenuTimer() { |
1049 int delay = views::GetMenuShowDelay(); | |
1050 MessageLoop::current()->PostDelayedTask( | 1049 MessageLoop::current()->PostDelayedTask( |
1051 FROM_HERE, | 1050 FROM_HERE, |
1052 base::Bind(&BrowserActionsContainer::ShowDropFolder, | 1051 base::Bind(&BrowserActionsContainer::ShowDropFolder, |
1053 show_menu_task_factory_.GetWeakPtr()), | 1052 show_menu_task_factory_.GetWeakPtr()), |
1054 delay); | 1053 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); |
1055 } | 1054 } |
1056 | 1055 |
1057 void BrowserActionsContainer::ShowDropFolder() { | 1056 void BrowserActionsContainer::ShowDropFolder() { |
1058 DCHECK(!overflow_menu_); | 1057 DCHECK(!overflow_menu_); |
1059 SetDropIndicator(-1); | 1058 SetDropIndicator(-1); |
1060 overflow_menu_ = new BrowserActionOverflowMenuController( | 1059 overflow_menu_ = new BrowserActionOverflowMenuController( |
1061 this, chevron_, browser_action_views_, VisibleBrowserActions()); | 1060 this, chevron_, browser_action_views_, VisibleBrowserActions()); |
1062 overflow_menu_->set_observer(this); | 1061 overflow_menu_->set_observer(this); |
1063 overflow_menu_->RunMenu(GetWidget(), true); | 1062 overflow_menu_->RunMenu(GetWidget(), true); |
1064 } | 1063 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 } | 1131 } |
1133 } | 1132 } |
1134 | 1133 |
1135 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1134 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
1136 const Extension* extension) { | 1135 const Extension* extension) { |
1137 // Only display incognito-enabled extensions while in incognito mode. | 1136 // Only display incognito-enabled extensions while in incognito mode. |
1138 return | 1137 return |
1139 (!profile_->IsOffTheRecord() || | 1138 (!profile_->IsOffTheRecord() || |
1140 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1139 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
1141 } | 1140 } |
OLD | NEW |