| 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/app_menu.h" | 5 #include "chrome/browser/ui/views/toolbar/app_menu.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 content::Source<Profile>(browser_->profile())); | 793 content::Source<Profile>(browser_->profile())); |
| 794 } | 794 } |
| 795 | 795 |
| 796 AppMenu::~AppMenu() { | 796 AppMenu::~AppMenu() { |
| 797 if (bookmark_menu_delegate_.get()) { | 797 if (bookmark_menu_delegate_.get()) { |
| 798 BookmarkModel* model = | 798 BookmarkModel* model = |
| 799 BookmarkModelFactory::GetForBrowserContext(browser_->profile()); | 799 BookmarkModelFactory::GetForBrowserContext(browser_->profile()); |
| 800 if (model) | 800 if (model) |
| 801 model->RemoveObserver(this); | 801 model->RemoveObserver(this); |
| 802 } | 802 } |
| 803 FOR_EACH_OBSERVER(AppMenuObserver, observer_list_, AppMenuDestroyed()); | 803 for (AppMenuObserver& observer : observer_list_) |
| 804 observer.AppMenuDestroyed(); |
| 804 } | 805 } |
| 805 | 806 |
| 806 void AppMenu::Init(ui::MenuModel* model) { | 807 void AppMenu::Init(ui::MenuModel* model) { |
| 807 DCHECK(!root_); | 808 DCHECK(!root_); |
| 808 root_ = new MenuItemView(this); | 809 root_ = new MenuItemView(this); |
| 809 root_->set_has_icons(true); // We have checks, radios and icons, set this | 810 root_->set_has_icons(true); // We have checks, radios and icons, set this |
| 810 // so we get the taller menu style. | 811 // so we get the taller menu style. |
| 811 PopulateMenu(root_, model); | 812 PopulateMenu(root_, model); |
| 812 | 813 |
| 813 int32_t types = views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC; | 814 int32_t types = views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 0, | 1233 0, |
| 1233 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1234 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1234 BOOKMARK_LAUNCH_LOCATION_APP_MENU); | 1235 BOOKMARK_LAUNCH_LOCATION_APP_MENU); |
| 1235 } | 1236 } |
| 1236 | 1237 |
| 1237 int AppMenu::ModelIndexFromCommandId(int command_id) const { | 1238 int AppMenu::ModelIndexFromCommandId(int command_id) const { |
| 1238 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1239 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1239 DCHECK(ix != command_id_to_entry_.end()); | 1240 DCHECK(ix != command_id_to_entry_.end()); |
| 1240 return ix->second.second; | 1241 return ix->second.second; |
| 1241 } | 1242 } |
| OLD | NEW |