| 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/cocoa/history_menu_bridge.h" | 5 #include "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // build the "Recently Closed" section. Otherwise it will be when the | 98 // build the "Recently Closed" section. Otherwise it will be when the |
| 99 // backend loads. | 99 // backend loads. |
| 100 if (!tab_restore_service_->IsLoaded()) | 100 if (!tab_restore_service_->IsLoaded()) |
| 101 tab_restore_service_->LoadTabsFromLastSession(); | 101 tab_restore_service_->LoadTabsFromLastSession(); |
| 102 else | 102 else |
| 103 TabRestoreServiceChanged(tab_restore_service_); | 103 TabRestoreServiceChanged(tab_restore_service_); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 107 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 108 default_favicon_.reset([rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); | 108 default_favicon_.reset( |
| 109 rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).CopyNSImage()); |
| 109 | 110 |
| 110 // Set the static icons in the menu. | 111 // Set the static icons in the menu. |
| 111 NSMenuItem* item = [HistoryMenu() itemWithTag:IDC_SHOW_HISTORY]; | 112 NSMenuItem* item = [HistoryMenu() itemWithTag:IDC_SHOW_HISTORY]; |
| 112 [item setImage:rb.GetNativeImageNamed(IDR_HISTORY_FAVICON)]; | 113 [item setImage:rb.GetNativeImageNamed(IDR_HISTORY_FAVICON).ToNSImage()]; |
| 113 | 114 |
| 114 // The service is not ready for use yet, so become notified when it does. | 115 // The service is not ready for use yet, so become notified when it does. |
| 115 if (!history_service_) { | 116 if (!history_service_) { |
| 116 registrar_.Add( | 117 registrar_.Add( |
| 117 this, chrome::NOTIFICATION_HISTORY_LOADED, | 118 this, chrome::NOTIFICATION_HISTORY_LOADED, |
| 118 content::Source<Profile>(profile_)); | 119 content::Source<Profile>(profile_)); |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 | 122 |
| 122 // Note that all requests sent to either the history service or the favicon | 123 // Note that all requests sent to either the history service or the favicon |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 489 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
| 489 DCHECK(item); | 490 DCHECK(item); |
| 490 if (item->icon_requested) { | 491 if (item->icon_requested) { |
| 491 FaviconService* service = FaviconServiceFactory::GetForProfile( | 492 FaviconService* service = FaviconServiceFactory::GetForProfile( |
| 492 profile_, Profile::EXPLICIT_ACCESS); | 493 profile_, Profile::EXPLICIT_ACCESS); |
| 493 service->CancelRequest(item->icon_handle); | 494 service->CancelRequest(item->icon_handle); |
| 494 item->icon_requested = false; | 495 item->icon_requested = false; |
| 495 item->icon_handle = 0; | 496 item->icon_handle = 0; |
| 496 } | 497 } |
| 497 } | 498 } |
| OLD | NEW |