Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: chrome/browser/ui/cocoa/history_menu_bridge.mm

Issue 2156373002: Fix restoring individual tabs from recently closed windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Testify! Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cocoa/history_menu_bridge.h" 5 #include "chrome/browser/ui/cocoa/history_menu_bridge.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // removing the items from the map or in the dtor. 173 // removing the items from the map or in the dtor.
174 HistoryItem* dup_item = new HistoryItem(*item); 174 HistoryItem* dup_item = new HistoryItem(*item);
175 menu_item_map_.insert(std::make_pair(restore_item.get(), dup_item)); 175 menu_item_map_.insert(std::make_pair(restore_item.get(), dup_item));
176 [submenu addItem:restore_item.get()]; 176 [submenu addItem:restore_item.get()];
177 [submenu addItem:[NSMenuItem separatorItem]]; 177 [submenu addItem:[NSMenuItem separatorItem]];
178 178
179 // Loop over the window's tabs and add them to the submenu. 179 // Loop over the window's tabs and add them to the submenu.
180 NSInteger subindex = [[submenu itemArray] count]; 180 NSInteger subindex = [[submenu itemArray] count];
181 std::vector<sessions::TabRestoreService::Tab>::const_iterator it; 181 std::vector<sessions::TabRestoreService::Tab>::const_iterator it;
182 for (it = tabs.begin(); it != tabs.end(); ++it) { 182 for (it = tabs.begin(); it != tabs.end(); ++it) {
183 sessions::TabRestoreService::Tab tab = *it; 183 HistoryItem* tab_item = HistoryItemForTab(*it);
184 HistoryItem* tab_item = HistoryItemForTab(tab);
185 if (tab_item) { 184 if (tab_item) {
186 item->tabs.push_back(tab_item); 185 item->tabs.push_back(tab_item);
187 AddItemToMenu(tab_item, submenu.get(), kRecentlyClosed + 1, 186 AddItemToMenu(tab_item, submenu.get(), kRecentlyClosed + 1,
188 subindex++); 187 subindex++);
189 } 188 }
190 } 189 }
191 190
192 // Now that the number of tabs that has been added is known, set the title 191 // Now that the number of tabs that has been added is known, set the title
193 // of the parent menu item. 192 // of the parent menu item.
194 item->title = l10n_util::GetPluralStringFUTF16( 193 item->title = l10n_util::GetPluralStringFUTF16(
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const history::URLRows& deleted_rows, 453 const history::URLRows& deleted_rows,
455 const std::set<GURL>& favicon_urls) { 454 const std::set<GURL>& favicon_urls) {
456 OnHistoryChanged(); 455 OnHistoryChanged();
457 } 456 }
458 457
459 void HistoryMenuBridge::OnHistoryServiceLoaded( 458 void HistoryMenuBridge::OnHistoryServiceLoaded(
460 history::HistoryService* history_service) { 459 history::HistoryService* history_service) {
461 history_service_ = history_service; 460 history_service_ = history_service;
462 Init(); 461 Init();
463 } 462 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698