| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/toolbar/recent_tabs_sub_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (service && delegate) { | 302 if (service && delegate) { |
| 303 int window_items_idx = CommandIdToWindowVectorIndex(command_id); | 303 int window_items_idx = CommandIdToWindowVectorIndex(command_id); |
| 304 DCHECK(window_items_idx >= 0 && | 304 DCHECK(window_items_idx >= 0 && |
| 305 window_items_idx < static_cast<int>(local_window_items_.size())); | 305 window_items_idx < static_cast<int>(local_window_items_.size())); |
| 306 UMA_HISTOGRAM_ENUMERATION("WrenchMenu.RecentTabsSubMenu", RESTORE_WINDOW, | 306 UMA_HISTOGRAM_ENUMERATION("WrenchMenu.RecentTabsSubMenu", RESTORE_WINDOW, |
| 307 LIMIT_RECENT_TAB_ACTION); | 307 LIMIT_RECENT_TAB_ACTION); |
| 308 service->RestoreEntryById(delegate, local_window_items_[window_items_idx], | 308 service->RestoreEntryById(delegate, local_window_items_[window_items_idx], |
| 309 browser_->host_desktop_type(), disposition); | 309 browser_->host_desktop_type(), disposition); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 UMA_HISTOGRAM_TIMES("WrenchMenu.TimeToAction.RecentTab", |
| 313 menu_opened_timer_.Elapsed()); |
| 314 UMA_HISTOGRAM_ENUMERATION("WrenchMenu.MenuAction", MENU_ACTION_RECENT_TAB, |
| 315 LIMIT_MENU_ACTION); |
| 312 } | 316 } |
| 313 | 317 |
| 314 int RecentTabsSubMenuModel::GetFirstRecentTabsCommandId() { | 318 int RecentTabsSubMenuModel::GetFirstRecentTabsCommandId() { |
| 315 return WindowVectorIndexToCommandId(0); | 319 return WindowVectorIndexToCommandId(0); |
| 316 } | 320 } |
| 317 | 321 |
| 318 const gfx::FontList* RecentTabsSubMenuModel::GetLabelFontListAt( | 322 const gfx::FontList* RecentTabsSubMenuModel::GetLabelFontListAt( |
| 319 int index) const { | 323 int index) const { |
| 320 int command_id = GetCommandIdAt(index); | 324 int command_id = GetCommandIdAt(index); |
| 321 if (command_id == kRecentlyClosedHeaderCommandId || | 325 if (command_id == kRecentlyClosedHeaderCommandId || |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 686 |
| 683 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 687 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
| 684 if (menu_model_delegate) | 688 if (menu_model_delegate) |
| 685 menu_model_delegate->OnMenuStructureChanged(); | 689 menu_model_delegate->OnMenuStructureChanged(); |
| 686 } | 690 } |
| 687 | 691 |
| 688 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( | 692 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( |
| 689 TabRestoreService* service) { | 693 TabRestoreService* service) { |
| 690 TabRestoreServiceChanged(service); | 694 TabRestoreServiceChanged(service); |
| 691 } | 695 } |
| OLD | NEW |