| 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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/wrench_menu.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (bookmark_menu_delegate_.get()) { | 790 if (bookmark_menu_delegate_.get()) { |
| 791 BookmarkModel* model = BookmarkModelFactory::GetForProfile( | 791 BookmarkModel* model = BookmarkModelFactory::GetForProfile( |
| 792 browser_->profile()); | 792 browser_->profile()); |
| 793 if (model) | 793 if (model) |
| 794 model->RemoveObserver(this); | 794 model->RemoveObserver(this); |
| 795 } | 795 } |
| 796 if (selected_menu_model_) | 796 if (selected_menu_model_) |
| 797 selected_menu_model_->ActivatedAt(selected_index_); | 797 selected_menu_model_->ActivatedAt(selected_index_); |
| 798 } | 798 } |
| 799 | 799 |
| 800 bool WrenchMenu::IsShowing() { |
| 801 return menu_runner_.get() && menu_runner_->IsRunning(); |
| 802 } |
| 803 |
| 800 string16 WrenchMenu::GetTooltipText(int id, | 804 string16 WrenchMenu::GetTooltipText(int id, |
| 801 const gfx::Point& p) const { | 805 const gfx::Point& p) const { |
| 802 return is_bookmark_command(id) ? | 806 return is_bookmark_command(id) ? |
| 803 bookmark_menu_delegate_->GetTooltipText(id, p) : string16(); | 807 bookmark_menu_delegate_->GetTooltipText(id, p) : string16(); |
| 804 } | 808 } |
| 805 | 809 |
| 806 bool WrenchMenu::IsTriggerableEvent(views::MenuItemView* menu, | 810 bool WrenchMenu::IsTriggerableEvent(views::MenuItemView* menu, |
| 807 const ui::Event& e) { | 811 const ui::Event& e) { |
| 808 return is_bookmark_command(menu->GetCommand()) ? | 812 return is_bookmark_command(menu->GetCommand()) ? |
| 809 bookmark_menu_delegate_->IsTriggerableEvent(menu, e) : | 813 bookmark_menu_delegate_->IsTriggerableEvent(menu, e) : |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 bookmark_menu_delegate_.reset( | 1118 bookmark_menu_delegate_.reset( |
| 1115 new BookmarkMenuDelegate(browser_, | 1119 new BookmarkMenuDelegate(browser_, |
| 1116 browser_, | 1120 browser_, |
| 1117 parent, | 1121 parent, |
| 1118 first_bookmark_command_id_)); | 1122 first_bookmark_command_id_)); |
| 1119 bookmark_menu_delegate_->Init( | 1123 bookmark_menu_delegate_->Init( |
| 1120 this, bookmark_menu_, model->bookmark_bar_node(), 0, | 1124 this, bookmark_menu_, model->bookmark_bar_node(), 0, |
| 1121 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1125 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1122 bookmark_utils::LAUNCH_WRENCH_MENU); | 1126 bookmark_utils::LAUNCH_WRENCH_MENU); |
| 1123 } | 1127 } |
| OLD | NEW |