| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 zoom_label_max_width_ = max_w + border_width; | 709 zoom_label_max_width_ = max_w + border_width; |
| 710 | 710 |
| 711 zoom_label_max_width_valid_ = true; | 711 zoom_label_max_width_valid_ = true; |
| 712 } | 712 } |
| 713 return zoom_label_max_width_; | 713 return zoom_label_max_width_; |
| 714 } | 714 } |
| 715 | 715 |
| 716 // Index of the fullscreen menu item in the model. | 716 // Index of the fullscreen menu item in the model. |
| 717 const int fullscreen_index_; | 717 const int fullscreen_index_; |
| 718 | 718 |
| 719 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; | 719 std::unique_ptr<content::HostZoomMap::Subscription> |
| 720 browser_zoom_subscription_; |
| 720 content::NotificationRegistrar registrar_; | 721 content::NotificationRegistrar registrar_; |
| 721 | 722 |
| 722 // Button for incrementing the zoom. | 723 // Button for incrementing the zoom. |
| 723 LabelButton* increment_button_; | 724 LabelButton* increment_button_; |
| 724 | 725 |
| 725 // Label showing zoom as a percent. | 726 // Label showing zoom as a percent. |
| 726 Label* zoom_label_; | 727 Label* zoom_label_; |
| 727 | 728 |
| 728 // Button for decrementing the zoom. | 729 // Button for decrementing the zoom. |
| 729 LabelButton* decrement_button_; | 730 LabelButton* decrement_button_; |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 #endif | 1146 #endif |
| 1146 | 1147 |
| 1147 item->SetMargins(top_margin, bottom_margin); | 1148 item->SetMargins(top_margin, bottom_margin); |
| 1148 } | 1149 } |
| 1149 | 1150 |
| 1150 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) | 1151 if (model->GetTypeAt(i) == MenuModel::TYPE_SUBMENU) |
| 1151 PopulateMenu(item, model->GetSubmenuModelAt(i)); | 1152 PopulateMenu(item, model->GetSubmenuModelAt(i)); |
| 1152 | 1153 |
| 1153 switch (model->GetCommandIdAt(i)) { | 1154 switch (model->GetCommandIdAt(i)) { |
| 1154 case IDC_EXTENSIONS_OVERFLOW_MENU: { | 1155 case IDC_EXTENSIONS_OVERFLOW_MENU: { |
| 1155 scoped_ptr<ExtensionToolbarMenuView> extension_toolbar( | 1156 std::unique_ptr<ExtensionToolbarMenuView> extension_toolbar( |
| 1156 new ExtensionToolbarMenuView(browser_, this, item)); | 1157 new ExtensionToolbarMenuView(browser_, this, item)); |
| 1157 if (ui::MaterialDesignController::IsModeMaterial()) { | 1158 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 1158 for (int i = 0; i < extension_toolbar->contents()->child_count(); | 1159 for (int i = 0; i < extension_toolbar->contents()->child_count(); |
| 1159 ++i) { | 1160 ++i) { |
| 1160 View* action_view = extension_toolbar->contents()->child_at(i); | 1161 View* action_view = extension_toolbar->contents()->child_at(i); |
| 1161 action_view->set_background(new InMenuButtonBackground( | 1162 action_view->set_background(new InMenuButtonBackground( |
| 1162 InMenuButtonBackground::ROUNDED_BUTTON)); | 1163 InMenuButtonBackground::ROUNDED_BUTTON)); |
| 1163 } | 1164 } |
| 1164 } | 1165 } |
| 1165 extension_toolbar_ = extension_toolbar.get(); | 1166 extension_toolbar_ = extension_toolbar.get(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 0, | 1289 0, |
| 1289 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1290 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1290 BOOKMARK_LAUNCH_LOCATION_APP_MENU); | 1291 BOOKMARK_LAUNCH_LOCATION_APP_MENU); |
| 1291 } | 1292 } |
| 1292 | 1293 |
| 1293 int AppMenu::ModelIndexFromCommandId(int command_id) const { | 1294 int AppMenu::ModelIndexFromCommandId(int command_id) const { |
| 1294 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1295 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1295 DCHECK(ix != command_id_to_entry_.end()); | 1296 DCHECK(ix != command_id_to_entry_.end()); |
| 1296 return ix->second.second; | 1297 return ix->second.second; |
| 1297 } | 1298 } |
| OLD | NEW |