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

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

Issue 267019: Add the ability to unload the HistoryBackend.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « chrome/browser/bookmarks/bookmark_storage.cc ('k') | chrome/browser/history/history.h » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "base/sys_string_conversions.h" 6 #include "base/sys_string_conversions.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU 8 #include "chrome/app/chrome_dll_resource.h" // IDC_HISTORY_MENU
9 #import "chrome/browser/app_controller_mac.h" 9 #import "chrome/browser/app_controller_mac.h"
10 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h" 10 #import "chrome/browser/cocoa/history_menu_cocoa_controller.h"
(...skipping 30 matching lines...) Expand all
41 tab_restore_service_(NULL), 41 tab_restore_service_(NULL),
42 create_in_progress_(false), 42 create_in_progress_(false),
43 need_recreate_(false) { 43 need_recreate_(false) {
44 // If we don't have a profile, do not bother initializing our data sources. 44 // If we don't have a profile, do not bother initializing our data sources.
45 // This shouldn't happen except in unit tests. 45 // This shouldn't happen except in unit tests.
46 if (profile_) { 46 if (profile_) {
47 // Check to see if the history service is ready. Because it loads async, it 47 // Check to see if the history service is ready. Because it loads async, it
48 // may not be ready when the Bridge is created. If this happens, register 48 // may not be ready when the Bridge is created. If this happens, register
49 // for a notification that tells us the HistoryService is ready. 49 // for a notification that tells us the HistoryService is ready.
50 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 50 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
51 if (hs != NULL && hs->backend_loaded()) { 51 if (hs != NULL && hs->BackendLoaded()) {
52 history_service_ = hs; 52 history_service_ = hs;
53 Init(); 53 Init();
54 } 54 }
55 55
56 // TODO(???): NULL here means we're OTR. Show this in the GUI somehow? 56 // TODO(???): NULL here means we're OTR. Show this in the GUI somehow?
57 tab_restore_service_ = profile_->GetTabRestoreService(); 57 tab_restore_service_ = profile_->GetTabRestoreService();
58 if (tab_restore_service_) 58 if (tab_restore_service_)
59 tab_restore_service_->AddObserver(this); 59 tab_restore_service_->AddObserver(this);
60 } 60 }
61 61
(...skipping 21 matching lines...) Expand all
83 } 83 }
84 84
85 void HistoryMenuBridge::Observe(NotificationType type, 85 void HistoryMenuBridge::Observe(NotificationType type,
86 const NotificationSource& source, 86 const NotificationSource& source,
87 const NotificationDetails& details) { 87 const NotificationDetails& details) {
88 // A history service is now ready. Check to see if it's the one for the main 88 // A history service is now ready. Check to see if it's the one for the main
89 // profile. If so, perform final initialization. 89 // profile. If so, perform final initialization.
90 if (type == NotificationType::HISTORY_LOADED) { 90 if (type == NotificationType::HISTORY_LOADED) {
91 HistoryService* hs = 91 HistoryService* hs =
92 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 92 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
93 if (hs != NULL && hs->backend_loaded()) { 93 if (hs != NULL && hs->BackendLoaded()) {
94 history_service_ = hs; 94 history_service_ = hs;
95 Init(); 95 Init();
96 96
97 // Found our HistoryService, so stop listening for this notification. 97 // Found our HistoryService, so stop listening for this notification.
98 registrar_.Remove(this, 98 registrar_.Remove(this,
99 NotificationType::HISTORY_LOADED, 99 NotificationType::HISTORY_LOADED,
100 NotificationService::AllSources()); 100 NotificationService::AllSources());
101 } 101 }
102 } 102 }
103 103
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 entry.navigations.at(entry.current_navigation_index); 308 entry.navigations.at(entry.current_navigation_index);
309 if (current_navigation.url() == GURL(chrome::kChromeUINewTabURL)) 309 if (current_navigation.url() == GURL(chrome::kChromeUINewTabURL))
310 return false; 310 return false;
311 311
312 HistoryItem item; 312 HistoryItem item;
313 item.title = current_navigation.title(); 313 item.title = current_navigation.title();
314 item.url = current_navigation.url(); 314 item.url = current_navigation.url();
315 closed_results_.push_back(item); 315 closed_results_.push_back(item);
316 return true; 316 return true;
317 } 317 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.cc ('k') | chrome/browser/history/history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698