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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 void BrowserActionsContainer::GetAccessibleState( | 512 void BrowserActionsContainer::GetAccessibleState( |
513 ui::AXViewState* state) { | 513 ui::AXViewState* state) { |
514 state->role = ui::AX_ROLE_GROUP; | 514 state->role = ui::AX_ROLE_GROUP; |
515 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); | 515 state->name = l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS); |
516 } | 516 } |
517 | 517 |
518 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source, | 518 void BrowserActionsContainer::OnMenuButtonClicked(views::View* source, |
519 const gfx::Point& point) { | 519 const gfx::Point& point) { |
520 if (source == chevron_) { | 520 if (source == chevron_) { |
521 overflow_menu_ = new BrowserActionOverflowMenuController( | 521 overflow_menu_ = |
522 this, browser_, chevron_, browser_action_views_, | 522 new BrowserActionOverflowMenuController(this, |
523 VisibleBrowserActions()); | 523 browser_, |
| 524 chevron_, |
| 525 browser_action_views_, |
| 526 VisibleBrowserActions(), |
| 527 false); |
524 overflow_menu_->set_observer(this); | 528 overflow_menu_->set_observer(this); |
525 overflow_menu_->RunMenu(GetWidget(), false); | 529 overflow_menu_->RunMenu(GetWidget()); |
526 } | 530 } |
527 } | 531 } |
528 | 532 |
529 void BrowserActionsContainer::WriteDragDataForView(View* sender, | 533 void BrowserActionsContainer::WriteDragDataForView(View* sender, |
530 const gfx::Point& press_pt, | 534 const gfx::Point& press_pt, |
531 OSExchangeData* data) { | 535 OSExchangeData* data) { |
532 DCHECK(data); | 536 DCHECK(data); |
533 | 537 |
534 for (size_t i = 0; i < browser_action_views_.size(); ++i) { | 538 for (size_t i = 0; i < browser_action_views_.size(); ++i) { |
535 BrowserActionButton* button = browser_action_views_[i]->button(); | 539 BrowserActionButton* button = browser_action_views_[i]->button(); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 base::MessageLoop::current()->PostDelayedTask( | 937 base::MessageLoop::current()->PostDelayedTask( |
934 FROM_HERE, | 938 FROM_HERE, |
935 base::Bind(&BrowserActionsContainer::ShowDropFolder, | 939 base::Bind(&BrowserActionsContainer::ShowDropFolder, |
936 show_menu_task_factory_.GetWeakPtr()), | 940 show_menu_task_factory_.GetWeakPtr()), |
937 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); | 941 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); |
938 } | 942 } |
939 | 943 |
940 void BrowserActionsContainer::ShowDropFolder() { | 944 void BrowserActionsContainer::ShowDropFolder() { |
941 DCHECK(!overflow_menu_); | 945 DCHECK(!overflow_menu_); |
942 SetDropIndicator(-1); | 946 SetDropIndicator(-1); |
943 overflow_menu_ = new BrowserActionOverflowMenuController( | 947 overflow_menu_ = |
944 this, browser_, chevron_, browser_action_views_, VisibleBrowserActions()); | 948 new BrowserActionOverflowMenuController(this, |
| 949 browser_, |
| 950 chevron_, |
| 951 browser_action_views_, |
| 952 VisibleBrowserActions(), |
| 953 true); |
945 overflow_menu_->set_observer(this); | 954 overflow_menu_->set_observer(this); |
946 overflow_menu_->RunMenu(GetWidget(), true); | 955 overflow_menu_->RunMenu(GetWidget()); |
947 } | 956 } |
948 | 957 |
949 void BrowserActionsContainer::SetDropIndicator(int x_pos) { | 958 void BrowserActionsContainer::SetDropIndicator(int x_pos) { |
950 if (drop_indicator_position_ != x_pos) { | 959 if (drop_indicator_position_ != x_pos) { |
951 drop_indicator_position_ = x_pos; | 960 drop_indicator_position_ = x_pos; |
952 SchedulePaint(); | 961 SchedulePaint(); |
953 } | 962 } |
954 } | 963 } |
955 | 964 |
956 int BrowserActionsContainer::IconCountToWidth(int icons, | 965 int BrowserActionsContainer::IconCountToWidth(int icons, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 views::BubbleBorder::TOP_RIGHT, | 1062 views::BubbleBorder::TOP_RIGHT, |
1054 show_action); | 1063 show_action); |
1055 popup_->GetWidget()->AddObserver(this); | 1064 popup_->GetWidget()->AddObserver(this); |
1056 popup_button_ = button; | 1065 popup_button_ = button; |
1057 | 1066 |
1058 // Only set button as pushed if it was triggered by a user click. | 1067 // Only set button as pushed if it was triggered by a user click. |
1059 if (should_grant) | 1068 if (should_grant) |
1060 popup_button_->SetButtonPushed(); | 1069 popup_button_->SetButtonPushed(); |
1061 return true; | 1070 return true; |
1062 } | 1071 } |
OLD | NEW |