16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file.
46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
56e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "components/power/origin_power_map_factory.h"
66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "base/memory/singleton.h"
86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "components/keyed_service/content/browser_context_dependency_manager.h"
96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "components/power/origin_power_map.h"
106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)namespace power {
126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// static
136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)OriginPowerMap* OriginPowerMapFactory::GetForBrowserContext(
146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    content::BrowserContext* context) {
156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  return static_cast<OriginPowerMap*>(
166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      GetInstance()->GetServiceForBrowserContext(context, true));
176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// static
206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)OriginPowerMapFactory* OriginPowerMapFactory::GetInstance() {
216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  return Singleton<OriginPowerMapFactory>::get();
226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)OriginPowerMapFactory::OriginPowerMapFactory()
256e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    : BrowserContextKeyedServiceFactory(
266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)          "OriginPowerMap",
276e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)          BrowserContextDependencyManager::GetInstance()) {
286e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
296e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
306e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)OriginPowerMapFactory::~OriginPowerMapFactory() {
316e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
326e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
336e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)KeyedService* OriginPowerMapFactory::BuildServiceInstanceFor(
346e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    content::BrowserContext* context) const {
356e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  return new OriginPowerMap();
366e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}
376e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
386e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}  // namespace power
39