diff options
author | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 19:20:32 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 19:20:32 +0000 |
commit | edb2617b376a60d628b3775db2ce32a36c6c5000 (patch) | |
tree | 2eb5ace2de8e279b9a5fa0cf72f8043cc1241e16 | |
parent | 933bc5c6bb5b54c1103ef29fc85eb41572151bb6 (diff) | |
download | chromium_src-edb2617b376a60d628b3775db2ce32a36c6c5000.zip chromium_src-edb2617b376a60d628b3775db2ce32a36c6c5000.tar.gz chromium_src-edb2617b376a60d628b3775db2ce32a36c6c5000.tar.bz2 |
Revert 81278 - Profile shouldn't own PinnedTabService.PinnedTabService is now owned by PinnedTabServiceFactory, using Profileas a key. This uses the ProfileKeyedService infrastructure originallycreated for ThemeServiceFactory.BUG=77155TEST=existing testsReview URL: http://codereview.chromium.org/6820065
TBR=torne@chromium.org
Review URL: http://codereview.chromium.org/6822063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81284 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/profiles/profile.h | 1 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 4 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.h | 1 | ||||
-rw-r--r-- | chrome/browser/tabs/pinned_tab_service.h | 4 | ||||
-rw-r--r-- | chrome/browser/tabs/pinned_tab_service_factory.cc | 32 | ||||
-rw-r--r-- | chrome/browser/tabs/pinned_tab_service_factory.h | 35 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 |
7 files changed, 5 insertions, 74 deletions
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index 1054aad..e7d1741 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -72,6 +72,7 @@ class NTPResourceCache; class NavigationController; class PasswordStore; class PersonalDataManager; +class PinnedTabService; class PrefProxyConfigTracker; class PrefService; class ProfileSyncFactory; diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 66a28b1..b0148d1 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -66,7 +66,7 @@ #include "chrome/browser/status_icons/status_tray.h" #include "chrome/browser/sync/profile_sync_factory_impl.h" #include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/tabs/pinned_tab_service_factory.h" +#include "chrome/browser/tabs/pinned_tab_service.h" #include "chrome/browser/transport_security_persister.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/find_bar/find_bar_state.h" @@ -290,7 +290,7 @@ ProfileImpl::ProfileImpl(const FilePath& path) ssl_config_service_manager_.reset( SSLConfigServiceManager::CreateDefaultManager(GetPrefs(), local_state)); - PinnedTabServiceFactory::GetForProfile(this); + pinned_tab_service_.reset(new PinnedTabService(this)); // Initialize the BackgroundModeManager - this has to be done here before // InitExtensions() is called because it relies on receiving notifications diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 7e7095f..e25079e 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -247,6 +247,7 @@ class ProfileImpl : public Profile, scoped_ptr<BackgroundModeManager> background_mode_manager_; scoped_ptr<StatusTray> status_tray_; scoped_refptr<PersonalDataManager> personal_data_manager_; + scoped_ptr<PinnedTabService> pinned_tab_service_; scoped_refptr<fileapi::FileSystemContext> file_system_context_; scoped_ptr<BrowserSignin> browser_signin_; bool history_service_created_; diff --git a/chrome/browser/tabs/pinned_tab_service.h b/chrome/browser/tabs/pinned_tab_service.h index be802e9..8eff427 100644 --- a/chrome/browser/tabs/pinned_tab_service.h +++ b/chrome/browser/tabs/pinned_tab_service.h @@ -6,7 +6,6 @@ #define CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_H_ #pragma once -#include "chrome/browser/profiles/profile_keyed_service.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" @@ -15,8 +14,7 @@ class Profile; // PinnedTabService is responsible for updating preferences with the set of // pinned tabs to restore at startup. PinnedTabService listens for the // appropriate set of notifications to know it should update preferences. -class PinnedTabService : public NotificationObserver, - public ProfileKeyedService { +class PinnedTabService : public NotificationObserver { public: explicit PinnedTabService(Profile* profile); diff --git a/chrome/browser/tabs/pinned_tab_service_factory.cc b/chrome/browser/tabs/pinned_tab_service_factory.cc deleted file mode 100644 index 13789c6..0000000 --- a/chrome/browser/tabs/pinned_tab_service_factory.cc +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/tabs/pinned_tab_service_factory.h" - -#include "chrome/browser/tabs/pinned_tab_service.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_dependency_manager.h" - -// static -PinnedTabService* PinnedTabServiceFactory::GetForProfile( - Profile* profile) { - return static_cast<PinnedTabService*>( - GetInstance()->GetServiceForProfile(profile)); -} - -PinnedTabServiceFactory* PinnedTabServiceFactory::GetInstance() { - return Singleton<PinnedTabServiceFactory>::get(); -} - -PinnedTabServiceFactory::PinnedTabServiceFactory() - : ProfileKeyedServiceFactory(ProfileDependencyManager::GetInstance()) { -} - -PinnedTabServiceFactory::~PinnedTabServiceFactory() { -} - -ProfileKeyedService* PinnedTabServiceFactory::BuildServiceInstanceFor( - Profile* profile) const { - return new PinnedTabService(profile); -} diff --git a/chrome/browser/tabs/pinned_tab_service_factory.h b/chrome/browser/tabs/pinned_tab_service_factory.h deleted file mode 100644 index 353ba17..0000000 --- a/chrome/browser/tabs/pinned_tab_service_factory.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_FACTORY_H_ -#define CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_FACTORY_H_ - -#include "base/memory/singleton.h" -#include "chrome/browser/profiles/profile_keyed_service_factory.h" - -class PinnedTabService; -class Profile; - -// Singleton that owns all PinnedTabServices and associates them with Profiles. -// Listens for the Profile's destruction notification and cleans up the -// associated PinnedTabService. -class PinnedTabServiceFactory : public ProfileKeyedServiceFactory { - public: - // Returns the PinnedTabService that tracks pinning changes for |profile|. - static PinnedTabService* GetForProfile(Profile* profile); - - static PinnedTabServiceFactory* GetInstance(); - - private: - friend struct DefaultSingletonTraits<PinnedTabServiceFactory>; - - PinnedTabServiceFactory(); - virtual ~PinnedTabServiceFactory(); - - // ProfileKeyedServiceFactory: - virtual ProfileKeyedService* BuildServiceInstanceFor( - Profile* profile) const OVERRIDE; -}; - -#endif // CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_FACTORY_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 1a6d3e3..85215cd 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2005,8 +2005,6 @@ 'browser/tabs/pinned_tab_codec.h', 'browser/tabs/pinned_tab_service.cc', 'browser/tabs/pinned_tab_service.h', - 'browser/tabs/pinned_tab_service_factory.cc', - 'browser/tabs/pinned_tab_service_factory.h', 'browser/tabs/tab_handler.h', 'browser/tabs/tab_finder.cc', 'browser/tabs/tab_finder.h', |