| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 (item->tabs.size() == 1) ? | 462 (item->tabs.size() == 1) ? |
| 463 l10n_util::GetStringUTF8( | 463 l10n_util::GetStringUTF8( |
| 464 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE) : | 464 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE) : |
| 465 l10n_util::GetStringFUTF8( | 465 l10n_util::GetStringFUTF8( |
| 466 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE, | 466 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE, |
| 467 base::IntToString16(item->tabs.size())); | 467 base::IntToString16(item->tabs.size())); |
| 468 | 468 |
| 469 // Create the menu item parent. Unlike mac, it's can't be activated. | 469 // Create the menu item parent. Unlike mac, it's can't be activated. |
| 470 GtkWidget* parent_item = gtk_image_menu_item_new_with_label( | 470 GtkWidget* parent_item = gtk_image_menu_item_new_with_label( |
| 471 title.c_str()); | 471 title.c_str()); |
| 472 gtk_util::SetAlwaysShowImage(parent_item); |
| 472 gtk_widget_show(parent_item); | 473 gtk_widget_show(parent_item); |
| 473 g_object_set_data(G_OBJECT(parent_item), "type-tag", | 474 g_object_set_data(G_OBJECT(parent_item), "type-tag", |
| 474 GINT_TO_POINTER(GlobalMenuBar::TAG_RECENTLY_CLOSED)); | 475 GINT_TO_POINTER(GlobalMenuBar::TAG_RECENTLY_CLOSED)); |
| 475 gtk_menu_item_set_submenu(GTK_MENU_ITEM(parent_item), submenu); | 476 gtk_menu_item_set_submenu(GTK_MENU_ITEM(parent_item), submenu); |
| 476 | 477 |
| 477 gtk_menu_shell_insert(GTK_MENU_SHELL(history_menu_.get()), parent_item, | 478 gtk_menu_shell_insert(GTK_MENU_SHELL(history_menu_.get()), parent_item, |
| 478 index++); | 479 index++); |
| 479 ++added_count; | 480 ++added_count; |
| 480 } else if (entry->type == TabRestoreService::TAB) { | 481 } else if (entry->type == TabRestoreService::TAB) { |
| 481 TabRestoreService::Tab* tab = | 482 TabRestoreService::Tab* tab = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 tab_restore_service_->LoadTabsFromLastSession(); | 524 tab_restore_service_->LoadTabsFromLastSession(); |
| 524 tab_restore_service_->AddObserver(this); | 525 tab_restore_service_->AddObserver(this); |
| 525 | 526 |
| 526 // If LoadTabsFromLastSession doesn't load tabs, it won't call | 527 // If LoadTabsFromLastSession doesn't load tabs, it won't call |
| 527 // TabRestoreServiceChanged(). This ensures that all new windows after | 528 // TabRestoreServiceChanged(). This ensures that all new windows after |
| 528 // the first one will have their menus populated correctly. | 529 // the first one will have their menus populated correctly. |
| 529 TabRestoreServiceChanged(tab_restore_service_); | 530 TabRestoreServiceChanged(tab_restore_service_); |
| 530 } | 531 } |
| 531 } | 532 } |
| 532 } | 533 } |
| OLD | NEW |