| 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/cocoa/history_menu_bridge.h" | 5 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 6 | 6 |
| 7 #include "app/mac/nsimage_cache.h" | |
| 8 #include "base/callback.h" | 7 #include "base/callback.h" |
| 9 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 10 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 12 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 13 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU | 12 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU |
| 14 #import "chrome/browser/app_controller_mac.h" | 13 #import "chrome/browser/app_controller_mac.h" |
| 15 #include "chrome/browser/history/page_usage_data.h" | 14 #include "chrome/browser/history/page_usage_data.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/sessions/session_types.h" | 16 #include "chrome/browser/sessions/session_types.h" |
| 18 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 19 #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" | 18 #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" |
| 20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 21 #include "content/common/notification_registrar.h" | 20 #include "content/common/notification_registrar.h" |
| 22 #include "content/common/notification_service.h" | 21 #include "content/common/notification_service.h" |
| 23 #include "grit/app_resources.h" | 22 #include "grit/app_resources.h" |
| 24 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 25 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 26 #include "skia/ext/skia_utils_mac.h" | 25 #include "skia/ext/skia_utils_mac.h" |
| 27 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/codec/png_codec.h" | 29 #include "ui/gfx/codec/png_codec.h" |
| 31 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
| 31 #include "ui/gfx/mac/nsimage_cache.h" |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // Menus more than this many chars long will get trimmed. | 35 // Menus more than this many chars long will get trimmed. |
| 36 const NSUInteger kMaximumMenuWidthInChars = 50; | 36 const NSUInteger kMaximumMenuWidthInChars = 50; |
| 37 | 37 |
| 38 // When trimming, use this many chars from each side. | 38 // When trimming, use this many chars from each side. |
| 39 const NSUInteger kMenuTrimSizeInChars = 25; | 39 const NSUInteger kMenuTrimSizeInChars = 25; |
| 40 | 40 |
| 41 // Number of days to consider when getting the number of most visited items. | 41 // Number of days to consider when getting the number of most visited items. |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 475 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
| 476 DCHECK(item); | 476 DCHECK(item); |
| 477 if (item->icon_requested) { | 477 if (item->icon_requested) { |
| 478 FaviconService* service = | 478 FaviconService* service = |
| 479 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); | 479 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); |
| 480 service->CancelRequest(item->icon_handle); | 480 service->CancelRequest(item->icon_handle); |
| 481 item->icon_requested = false; | 481 item->icon_requested = false; |
| 482 item->icon_handle = NULL; | 482 item->icon_handle = NULL; |
| 483 } | 483 } |
| 484 } | 484 } |
| OLD | NEW |