| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/history_menu_bridge.h" | 5 #include "chrome/browser/cocoa/history_menu_bridge.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 11 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 12 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 13 #include "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU | 14 #include "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU |
| 14 #import "chrome/browser/app_controller_mac.h" | 15 #import "chrome/browser/app_controller_mac.h" |
| 15 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h" | 16 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h" |
| 16 #include "chrome/browser/history/page_usage_data.h" | 17 #include "chrome/browser/history/page_usage_data.h" |
| 17 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/sessions/session_types.h" | 19 #include "chrome/browser/sessions/session_types.h" |
| 19 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
| 20 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 201 } |
| 201 | 202 |
| 202 // Now that the number of tabs that has been added is known, set the title | 203 // Now that the number of tabs that has been added is known, set the title |
| 203 // of the parent menu item. | 204 // of the parent menu item. |
| 204 if (item->tabs.size() == 1) { | 205 if (item->tabs.size() == 1) { |
| 205 item->title = l10n_util::GetStringUTF16( | 206 item->title = l10n_util::GetStringUTF16( |
| 206 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE); | 207 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE); |
| 207 } else { | 208 } else { |
| 208 item->title =l10n_util::GetStringFUTF16( | 209 item->title =l10n_util::GetStringFUTF16( |
| 209 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE, | 210 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE, |
| 210 IntToString16(item->tabs.size())); | 211 base::IntToString16(item->tabs.size())); |
| 211 } | 212 } |
| 212 | 213 |
| 213 // Sometimes it is possible for there to not be any subitems for a given | 214 // Sometimes it is possible for there to not be any subitems for a given |
| 214 // window; if that is the case, do not add the entry to the main menu. | 215 // window; if that is the case, do not add the entry to the main menu. |
| 215 if ([[submenu itemArray] count] > 2) { | 216 if ([[submenu itemArray] count] > 2) { |
| 216 // Create the menu item parent. | 217 // Create the menu item parent. |
| 217 NSMenuItem* parent_item = | 218 NSMenuItem* parent_item = |
| 218 AddItemToMenu(item, menu, kRecentlyClosed, index++); | 219 AddItemToMenu(item, menu, kRecentlyClosed, index++); |
| 219 [parent_item setSubmenu:submenu.get()]; | 220 [parent_item setSubmenu:submenu.get()]; |
| 220 ++added_count; | 221 ++added_count; |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 444 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
| 444 DCHECK(item); | 445 DCHECK(item); |
| 445 if (item->icon_requested) { | 446 if (item->icon_requested) { |
| 446 FaviconService* service = | 447 FaviconService* service = |
| 447 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); | 448 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); |
| 448 service->CancelRequest(item->icon_handle); | 449 service->CancelRequest(item->icon_handle); |
| 449 item->icon_requested = false; | 450 item->icon_requested = false; |
| 450 item->icon_handle = NULL; | 451 item->icon_handle = NULL; |
| 451 } | 452 } |
| 452 } | 453 } |
| OLD | NEW |