| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 ui::AccessibleViewState* state) { | 703 ui::AccessibleViewState* state) { |
| 704 state->role = ui::AccessibilityTypes::ROLE_GROUPING; | 704 state->role = ui::AccessibilityTypes::ROLE_GROUPING; |
| 705 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); | 705 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { | 708 void BrowserActionsContainer::RunMenu(View* source, const gfx::Point& pt) { |
| 709 if (source == chevron_) { | 709 if (source == chevron_) { |
| 710 overflow_menu_ = new BrowserActionOverflowMenuController( | 710 overflow_menu_ = new BrowserActionOverflowMenuController( |
| 711 this, chevron_, browser_action_views_, VisibleBrowserActions()); | 711 this, chevron_, browser_action_views_, VisibleBrowserActions()); |
| 712 overflow_menu_->set_observer(this); | 712 overflow_menu_->set_observer(this); |
| 713 overflow_menu_->RunMenu(GetWindow()->GetNativeWindow(), false); | 713 overflow_menu_->RunMenu(GetWidget()->GetNativeWindow(), false); |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| 717 void BrowserActionsContainer::WriteDragDataForView(View* sender, | 717 void BrowserActionsContainer::WriteDragDataForView(View* sender, |
| 718 const gfx::Point& press_pt, | 718 const gfx::Point& press_pt, |
| 719 OSExchangeData* data) { | 719 OSExchangeData* data) { |
| 720 DCHECK(data); | 720 DCHECK(data); |
| 721 | 721 |
| 722 for (size_t i = 0; i < browser_action_views_.size(); ++i) { | 722 for (size_t i = 0; i < browser_action_views_.size(); ++i) { |
| 723 BrowserActionButton* button = browser_action_views_[i]->button(); | 723 BrowserActionButton* button = browser_action_views_[i]->button(); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 &BrowserActionsContainer::ShowDropFolder), | 1016 &BrowserActionsContainer::ShowDropFolder), |
| 1017 delay); | 1017 delay); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 void BrowserActionsContainer::ShowDropFolder() { | 1020 void BrowserActionsContainer::ShowDropFolder() { |
| 1021 DCHECK(!overflow_menu_); | 1021 DCHECK(!overflow_menu_); |
| 1022 SetDropIndicator(-1); | 1022 SetDropIndicator(-1); |
| 1023 overflow_menu_ = new BrowserActionOverflowMenuController( | 1023 overflow_menu_ = new BrowserActionOverflowMenuController( |
| 1024 this, chevron_, browser_action_views_, VisibleBrowserActions()); | 1024 this, chevron_, browser_action_views_, VisibleBrowserActions()); |
| 1025 overflow_menu_->set_observer(this); | 1025 overflow_menu_->set_observer(this); |
| 1026 overflow_menu_->RunMenu(GetWindow()->GetNativeWindow(), true); | 1026 overflow_menu_->RunMenu(GetWidget()->GetNativeWindow(), true); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 void BrowserActionsContainer::SetDropIndicator(int x_pos) { | 1029 void BrowserActionsContainer::SetDropIndicator(int x_pos) { |
| 1030 if (drop_indicator_position_ != x_pos) { | 1030 if (drop_indicator_position_ != x_pos) { |
| 1031 drop_indicator_position_ = x_pos; | 1031 drop_indicator_position_ = x_pos; |
| 1032 SchedulePaint(); | 1032 SchedulePaint(); |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 int BrowserActionsContainer::IconCountToWidth(int icons, | 1036 int BrowserActionsContainer::IconCountToWidth(int icons, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 } | 1095 } |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1098 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1099 const Extension* extension) { | 1099 const Extension* extension) { |
| 1100 // Only display incognito-enabled extensions while in incognito mode. | 1100 // Only display incognito-enabled extensions while in incognito mode. |
| 1101 return | 1101 return |
| 1102 (!profile_->IsOffTheRecord() || | 1102 (!profile_->IsOffTheRecord() || |
| 1103 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1103 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 1104 } | 1104 } |
| OLD | NEW |