| 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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/toolbar/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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 #endif // defined(DEBUG) | 945 #endif // defined(DEBUG) |
| 946 | 946 |
| 947 menu_runner_.reset(new views::MenuRunner(root_)); | 947 menu_runner_.reset(new views::MenuRunner(root_)); |
| 948 } | 948 } |
| 949 | 949 |
| 950 void WrenchMenu::RunMenu(views::MenuButton* host) { | 950 void WrenchMenu::RunMenu(views::MenuButton* host) { |
| 951 gfx::Point screen_loc; | 951 gfx::Point screen_loc; |
| 952 views::View::ConvertPointToScreen(host, &screen_loc); | 952 views::View::ConvertPointToScreen(host, &screen_loc); |
| 953 gfx::Rect bounds(screen_loc, host->size()); | 953 gfx::Rect bounds(screen_loc, host->size()); |
| 954 content::RecordAction(UserMetricsAction("ShowAppMenu")); | 954 content::RecordAction(UserMetricsAction("ShowAppMenu")); |
| 955 if (menu_runner_->RunMenuAt(host->GetWidget(), host, bounds, | 955 if (menu_runner_->RunMenuAt(host->GetWidget(), |
| 956 MenuItemView::TOPRIGHT, ui::MENU_SOURCE_NONE, | 956 host, |
| 957 views::MenuRunner::HAS_MNEMONICS) == | 957 bounds, |
| 958 ui::MENU_ANCHOR_TOPRIGHT, |
| 959 ui::MENU_SOURCE_NONE, |
| 960 views::MenuRunner::HAS_MNEMONICS) == |
| 958 views::MenuRunner::MENU_DELETED) | 961 views::MenuRunner::MENU_DELETED) |
| 959 return; | 962 return; |
| 960 if (bookmark_menu_delegate_.get()) { | 963 if (bookmark_menu_delegate_.get()) { |
| 961 BookmarkModel* model = BookmarkModelFactory::GetForProfile( | 964 BookmarkModel* model = BookmarkModelFactory::GetForProfile( |
| 962 browser_->profile()); | 965 browser_->profile()); |
| 963 if (model) | 966 if (model) |
| 964 model->RemoveObserver(this); | 967 model->RemoveObserver(this); |
| 965 } | 968 } |
| 966 if (selected_menu_model_) | 969 if (selected_menu_model_) |
| 967 selected_menu_model_->ActivatedAt(selected_index_); | 970 selected_menu_model_->ActivatedAt(selected_index_); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 0, | 1359 0, |
| 1357 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1360 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1358 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); | 1361 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
| 1359 } | 1362 } |
| 1360 | 1363 |
| 1361 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { | 1364 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { |
| 1362 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1365 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1363 DCHECK(ix != command_id_to_entry_.end()); | 1366 DCHECK(ix != command_id_to_entry_.end()); |
| 1364 return ix->second.second; | 1367 return ix->second.second; |
| 1365 } | 1368 } |
| OLD | NEW |