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/ui/cocoa/history_menu_bridge.h" | 5 #include "chrome/browser/ui/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" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 if (profile_) { | 75 if (profile_) { |
76 // Check to see if the history service is ready. Because it loads async, it | 76 // Check to see if the history service is ready. Because it loads async, it |
77 // may not be ready when the Bridge is created. If this happens, register | 77 // may not be ready when the Bridge is created. If this happens, register |
78 // for a notification that tells us the HistoryService is ready. | 78 // for a notification that tells us the HistoryService is ready. |
79 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 79 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
80 if (hs != NULL && hs->BackendLoaded()) { | 80 if (hs != NULL && hs->BackendLoaded()) { |
81 history_service_ = hs; | 81 history_service_ = hs; |
82 Init(); | 82 Init(); |
83 } | 83 } |
84 | 84 |
85 // TODO(???): NULL here means we're OTR. Show this in the GUI somehow? | |
86 tab_restore_service_ = profile_->GetTabRestoreService(); | 85 tab_restore_service_ = profile_->GetTabRestoreService(); |
87 if (tab_restore_service_) { | 86 if (tab_restore_service_) { |
88 tab_restore_service_->AddObserver(this); | 87 tab_restore_service_->AddObserver(this); |
89 tab_restore_service_->LoadTabsFromLastSession(); | 88 tab_restore_service_->LoadTabsFromLastSession(); |
90 } | 89 } |
91 } | 90 } |
92 | 91 |
93 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 92 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
94 default_favicon_.reset([rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); | 93 default_favicon_.reset([rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); |
95 | 94 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 460 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
462 DCHECK(item); | 461 DCHECK(item); |
463 if (item->icon_requested) { | 462 if (item->icon_requested) { |
464 FaviconService* service = | 463 FaviconService* service = |
465 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); | 464 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); |
466 service->CancelRequest(item->icon_handle); | 465 service->CancelRequest(item->icon_handle); |
467 item->icon_requested = false; | 466 item->icon_requested = false; |
468 item->icon_handle = NULL; | 467 item->icon_handle = NULL; |
469 } | 468 } |
470 } | 469 } |
OLD | NEW |