pinned_tab_service_factory.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
12b8ee6c2994f738e5162ff46b638974870f51662Steve Naroff// Copyright (c) 2012 The Chromium Authors. All rights reserved.
250398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff// Use of this source code is governed by a BSD-style license that can be
350398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff// found in the LICENSE file.
41e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor
50c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor#include "chrome/browser/ui/tabs/pinned_tab_service_factory.h"
689922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff
7af08ddc8f1c53fed8d8d0ad82aa2a0bb7d654bd1Steve Naroff#include "chrome/browser/profiles/profile.h"
8f2c87bd0368775927ead93e0dee3e4f3ca3f9a63Douglas Gregor#include "chrome/browser/profiles/profile_dependency_manager.h"
9af08ddc8f1c53fed8d8d0ad82aa2a0bb7d654bd1Steve Naroff#include "chrome/browser/ui/tabs/pinned_tab_service.h"
100d435191fc8f78338c2ef26d566cfe4d2c52c706Ted Kremenek
110d435191fc8f78338c2ef26d566cfe4d2c52c706Ted Kremenek// static
120d435191fc8f78338c2ef26d566cfe4d2c52c706Ted KremenekPinnedTabService* PinnedTabServiceFactory::GetForProfile(
130d435191fc8f78338c2ef26d566cfe4d2c52c706Ted Kremenek    Profile* profile) {
142e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  return static_cast<PinnedTabService*>(
152e06fc877a633abea3b40a64950c7316dac29ca8John Thompson      GetInstance()->GetServiceForProfile(profile, true));
162e06fc877a633abea3b40a64950c7316dac29ca8John Thompson}
172e06fc877a633abea3b40a64950c7316dac29ca8John Thompson
182e06fc877a633abea3b40a64950c7316dac29ca8John ThompsonPinnedTabServiceFactory* PinnedTabServiceFactory::GetInstance() {
192e06fc877a633abea3b40a64950c7316dac29ca8John Thompson  return Singleton<PinnedTabServiceFactory>::get();
202e06fc877a633abea3b40a64950c7316dac29ca8John Thompson}
212e06fc877a633abea3b40a64950c7316dac29ca8John Thompson
222e06fc877a633abea3b40a64950c7316dac29ca8John ThompsonPinnedTabServiceFactory::PinnedTabServiceFactory()
232e06fc877a633abea3b40a64950c7316dac29ca8John Thompson    : ProfileKeyedServiceFactory("PinnedTabService",
242e06fc877a633abea3b40a64950c7316dac29ca8John Thompson                                 ProfileDependencyManager::GetInstance()) {
252e06fc877a633abea3b40a64950c7316dac29ca8John Thompson}
262e06fc877a633abea3b40a64950c7316dac29ca8John Thompson
272e06fc877a633abea3b40a64950c7316dac29ca8John ThompsonPinnedTabServiceFactory::~PinnedTabServiceFactory() {
282e06fc877a633abea3b40a64950c7316dac29ca8John Thompson}
29ff9e18cb3863defa98257500ef49d93a9d2bc216Steve Naroff
302e06fc877a633abea3b40a64950c7316dac29ca8John ThompsonProfileKeyedService* PinnedTabServiceFactory::BuildServiceInstanceFor(
31ff9e18cb3863defa98257500ef49d93a9d2bc216Steve Naroff    Profile* profile) const {
3245ba9a1b31110568d0d362c8d31c6133cf9011b7Douglas Gregor  return new PinnedTabService(profile);
3344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor}
3444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor
3544c181aec37789f25f6c15543c164416f72e562aDouglas Gregorbool PinnedTabServiceFactory::ServiceIsCreatedWithProfile() const {
3644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor  return true;
37b1c031be513705d924038f497279b9b599868ba1Douglas Gregor}
3887c08a5d6b9e1e44ae6f554df40139d3a6f60b33Douglas Gregor
3987c08a5d6b9e1e44ae6f554df40139d3a6f60b33Douglas Gregorbool PinnedTabServiceFactory::ServiceIsNULLWhileTesting() const {
40dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor  return true;
41dca8ee8b7bc86076916a3a80f553f7a4e98c14afDouglas Gregor}
4244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor