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

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

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time Created 9 years, 8 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
OLDNEW
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" 7 #include "app/mac/nsimage_cache.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU 13 #include "chrome/app/chrome_command_ids.h" // IDC_HISTORY_MENU
14 #import "chrome/browser/app_controller_mac.h" 14 #import "chrome/browser/app_controller_mac.h"
15 #include "chrome/browser/history/page_usage_data.h" 15 #include "chrome/browser/history/page_usage_data.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/sessions/session_types.h" 17 #include "chrome/browser/sessions/session_types.h"
18 #include "chrome/browser/sessions/tab_restore_service_factory.h"
18 #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h" 19 #import "chrome/browser/ui/cocoa/history_menu_cocoa_controller.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "content/common/notification_registrar.h" 21 #include "content/common/notification_registrar.h"
21 #include "content/common/notification_service.h" 22 #include "content/common/notification_service.h"
22 #include "grit/app_resources.h" 23 #include "grit/app_resources.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
25 #include "skia/ext/skia_utils_mac.h" 26 #include "skia/ext/skia_utils_mac.h"
26 #include "third_party/skia/include/core/SkBitmap.h" 27 #include "third_party/skia/include/core/SkBitmap.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 if (profile_) { 78 if (profile_) {
78 // Check to see if the history service is ready. Because it loads async, it 79 // Check to see if the history service is ready. Because it loads async, it
79 // may not be ready when the Bridge is created. If this happens, register 80 // may not be ready when the Bridge is created. If this happens, register
80 // for a notification that tells us the HistoryService is ready. 81 // for a notification that tells us the HistoryService is ready.
81 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); 82 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
82 if (hs != NULL && hs->BackendLoaded()) { 83 if (hs != NULL && hs->BackendLoaded()) {
83 history_service_ = hs; 84 history_service_ = hs;
84 Init(); 85 Init();
85 } 86 }
86 87
87 tab_restore_service_ = profile_->GetTabRestoreService(); 88 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile_);
88 if (tab_restore_service_) { 89 if (tab_restore_service_) {
89 tab_restore_service_->AddObserver(this); 90 tab_restore_service_->AddObserver(this);
90 tab_restore_service_->LoadTabsFromLastSession(); 91 tab_restore_service_->LoadTabsFromLastSession();
91 } 92 }
92 } 93 }
93 94
94 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 95 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
95 default_favicon_.reset([app::mac::GetCachedImageWithName(@"nav.pdf") retain]); 96 default_favicon_.reset([app::mac::GetCachedImageWithName(@"nav.pdf") retain]);
96 97
97 // Set the static icons in the menu. 98 // Set the static icons in the menu.
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { 461 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) {
461 DCHECK(item); 462 DCHECK(item);
462 if (item->icon_requested) { 463 if (item->icon_requested) {
463 FaviconService* service = 464 FaviconService* service =
464 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS); 465 profile_->GetFaviconService(Profile::EXPLICIT_ACCESS);
465 service->CancelRequest(item->icon_handle); 466 service->CancelRequest(item->icon_handle);
466 item->icon_requested = false; 467 item->icon_requested = false;
467 item->icon_handle = NULL; 468 item->icon_handle = NULL;
468 } 469 }
469 } 470 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_init.cc ('k') | chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698