Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / ash / app_sync_ui_state_factory.cc
blobedceaf055ac3609bd16ae19470c0c2da535c28be
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/ash/app_sync_ui_state_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service_factory.h"
9 #include "chrome/browser/ui/ash/app_sync_ui_state.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
12 // static
13 AppSyncUIState* AppSyncUIStateFactory::GetForProfile(Profile* profile) {
14 if (!AppSyncUIState::ShouldObserveAppSyncForProfile(profile))
15 return NULL;
17 return static_cast<AppSyncUIState*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true));
21 // static
22 AppSyncUIStateFactory* AppSyncUIStateFactory::GetInstance() {
23 return Singleton<AppSyncUIStateFactory>::get();
26 AppSyncUIStateFactory::AppSyncUIStateFactory()
27 : BrowserContextKeyedServiceFactory(
28 "AppSyncUIState",
29 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(ProfileSyncServiceFactory::GetInstance());
33 AppSyncUIStateFactory::~AppSyncUIStateFactory() {
36 BrowserContextKeyedService* AppSyncUIStateFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 Profile* profile = static_cast<Profile*>(context);
39 DCHECK(AppSyncUIState::ShouldObserveAppSyncForProfile(profile));
40 return new AppSyncUIState(profile);