| OLD | NEW |
| 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/gtk/global_history_menu.h" | 5 #include "chrome/browser/ui/gtk/global_history_menu.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 GlobalHistoryMenu::HistoryItem* GlobalHistoryMenu::HistoryItemForMenuItem( | 167 GlobalHistoryMenu::HistoryItem* GlobalHistoryMenu::HistoryItemForMenuItem( |
| 168 GtkWidget* menu_item) { | 168 GtkWidget* menu_item) { |
| 169 MenuItemToHistoryMap::iterator it = menu_item_history_map_.find(menu_item); | 169 MenuItemToHistoryMap::iterator it = menu_item_history_map_.find(menu_item); |
| 170 return it != menu_item_history_map_.end() ? it->second : NULL; | 170 return it != menu_item_history_map_.end() ? it->second : NULL; |
| 171 } | 171 } |
| 172 | 172 |
| 173 GlobalHistoryMenu::HistoryItem* GlobalHistoryMenu::HistoryItemForTab( | 173 GlobalHistoryMenu::HistoryItem* GlobalHistoryMenu::HistoryItemForTab( |
| 174 const TabRestoreService::Tab& entry) { | 174 const TabRestoreService::Tab& entry) { |
| 175 const TabNavigation& current_navigation = | 175 const components::SerializedNavigationEntry& current_navigation = |
| 176 entry.navigations.at(entry.current_navigation_index); | 176 entry.navigations.at(entry.current_navigation_index); |
| 177 HistoryItem* item = new HistoryItem(); | 177 HistoryItem* item = new HistoryItem(); |
| 178 item->title = current_navigation.title(); | 178 item->title = current_navigation.title(); |
| 179 item->url = current_navigation.virtual_url(); | 179 item->url = current_navigation.virtual_url(); |
| 180 item->session_id = entry.id; | 180 item->session_id = entry.id; |
| 181 | 181 |
| 182 return item; | 182 return item; |
| 183 } | 183 } |
| 184 | 184 |
| 185 GtkWidget* GlobalHistoryMenu::AddHistoryItemToMenu(HistoryItem* item, | 185 GtkWidget* GlobalHistoryMenu::AddHistoryItemToMenu(HistoryItem* item, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 tab_restore_service_->LoadTabsFromLastSession(); | 402 tab_restore_service_->LoadTabsFromLastSession(); |
| 403 tab_restore_service_->AddObserver(this); | 403 tab_restore_service_->AddObserver(this); |
| 404 | 404 |
| 405 // If LoadTabsFromLastSession doesn't load tabs, it won't call | 405 // If LoadTabsFromLastSession doesn't load tabs, it won't call |
| 406 // TabRestoreServiceChanged(). This ensures that all new windows after | 406 // TabRestoreServiceChanged(). This ensures that all new windows after |
| 407 // the first one will have their menus populated correctly. | 407 // the first one will have their menus populated correctly. |
| 408 TabRestoreServiceChanged(tab_restore_service_); | 408 TabRestoreServiceChanged(tab_restore_service_); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 } | 411 } |
| OLD | NEW |