Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: chrome/browser/ui/cocoa/history_menu_bridge.mm

Issue 10823114: [Mac] When creating a HistoryMenuBridge, manually poke the TabRestoreService if already loaded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 HistoryService* hs = HistoryServiceFactory::GetForProfile( 85 HistoryService* hs = HistoryServiceFactory::GetForProfile(
86 profile_, Profile::EXPLICIT_ACCESS); 86 profile_, Profile::EXPLICIT_ACCESS);
87 if (hs != NULL && hs->BackendLoaded()) { 87 if (hs != NULL && hs->BackendLoaded()) {
88 history_service_ = hs; 88 history_service_ = hs;
89 Init(); 89 Init();
90 } 90 }
91 91
92 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_); 92 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_);
93 if (tab_restore_service_) { 93 if (tab_restore_service_) {
94 tab_restore_service_->AddObserver(this); 94 tab_restore_service_->AddObserver(this);
95 tab_restore_service_->LoadTabsFromLastSession(); 95 // If the tab entries are already loaded, invoke the observer method to
96 // build the "Recently Closed" section. Otherwise it will be when the
97 // backend loads.
98 if (!tab_restore_service_->IsLoaded())
99 tab_restore_service_->LoadTabsFromLastSession();
100 else
101 TabRestoreServiceChanged(tab_restore_service_);
96 } 102 }
97 } 103 }
98 104
99 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 105 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
100 default_favicon_.reset([rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]); 106 default_favicon_.reset([rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON) retain]);
101 107
102 // Set the static icons in the menu. 108 // Set the static icons in the menu.
103 NSMenuItem* item = [HistoryMenu() itemWithTag:IDC_SHOW_HISTORY]; 109 NSMenuItem* item = [HistoryMenu() itemWithTag:IDC_SHOW_HISTORY];
104 [item setImage:rb.GetNativeImageNamed(IDR_HISTORY_FAVICON)]; 110 [item setImage:rb.GetNativeImageNamed(IDR_HISTORY_FAVICON)];
105 111
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { 491 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) {
486 DCHECK(item); 492 DCHECK(item);
487 if (item->icon_requested) { 493 if (item->icon_requested) {
488 FaviconService* service = 494 FaviconService* service =
489 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 495 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
490 service->CancelRequest(item->icon_handle); 496 service->CancelRequest(item->icon_handle);
491 item->icon_requested = false; 497 item->icon_requested = false;
492 item->icon_handle = NULL; 498 item->icon_handle = NULL;
493 } 499 }
494 } 500 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698