| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/app_mode/kiosk_diagnosis_runner.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_diagnosis_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" | 12 #include "chrome/browser/extensions/api/feedback_private/feedback_private_api.h" |
| 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 14 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 14 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "extensions/browser/extension_system_provider.h" |
| 17 #include "extensions/browser/extensions_browser_client.h" |
| 16 | 18 |
| 17 namespace chromeos { | 19 namespace chromeos { |
| 18 | 20 |
| 19 class KioskDiagnosisRunner::Factory : public BrowserContextKeyedServiceFactory { | 21 class KioskDiagnosisRunner::Factory : public BrowserContextKeyedServiceFactory { |
| 20 public: | 22 public: |
| 21 static KioskDiagnosisRunner* GetForProfile(Profile* profile) { | 23 static KioskDiagnosisRunner* GetForProfile(Profile* profile) { |
| 22 return static_cast<KioskDiagnosisRunner*>( | 24 return static_cast<KioskDiagnosisRunner*>( |
| 23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 25 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 24 } | 26 } |
| 25 | 27 |
| 26 static Factory* GetInstance() { | 28 static Factory* GetInstance() { |
| 27 return Singleton<Factory>::get(); | 29 return Singleton<Factory>::get(); |
| 28 } | 30 } |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 friend struct DefaultSingletonTraits<Factory>; | 33 friend struct DefaultSingletonTraits<Factory>; |
| 32 | 34 |
| 33 Factory() | 35 Factory() |
| 34 : BrowserContextKeyedServiceFactory( | 36 : BrowserContextKeyedServiceFactory( |
| 35 "KioskDiagnosisRunner", | 37 "KioskDiagnosisRunner", |
| 36 BrowserContextDependencyManager::GetInstance()) { | 38 BrowserContextDependencyManager::GetInstance()) { |
| 37 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); | 39 DependsOn(extensions::ExtensionsBrowserClient::Get() |
| 40 ->GetExtensionSystemFactory()); |
| 38 DependsOn(extensions::FeedbackPrivateAPI::GetFactoryInstance()); | 41 DependsOn(extensions::FeedbackPrivateAPI::GetFactoryInstance()); |
| 39 } | 42 } |
| 40 | 43 |
| 41 virtual ~Factory() {} | 44 virtual ~Factory() {} |
| 42 | 45 |
| 43 // BrowserContextKeyedServiceFactory overrides: | 46 // BrowserContextKeyedServiceFactory overrides: |
| 44 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 47 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| 45 content::BrowserContext* context) const OVERRIDE { | 48 content::BrowserContext* context) const OVERRIDE { |
| 46 Profile* profile = static_cast<Profile*>(context); | 49 Profile* profile = static_cast<Profile*>(context); |
| 47 return new KioskDiagnosisRunner(profile); | 50 return new KioskDiagnosisRunner(profile); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 feedback_data, | 117 feedback_data, |
| 115 base::Bind(&KioskDiagnosisRunner::OnFeedbackSent, | 118 base::Bind(&KioskDiagnosisRunner::OnFeedbackSent, |
| 116 weak_factory_.GetWeakPtr())); | 119 weak_factory_.GetWeakPtr())); |
| 117 } | 120 } |
| 118 | 121 |
| 119 void KioskDiagnosisRunner::OnFeedbackSent(bool) { | 122 void KioskDiagnosisRunner::OnFeedbackSent(bool) { |
| 120 // Do nothing. | 123 // Do nothing. |
| 121 } | 124 } |
| 122 | 125 |
| 123 } // namespace chromeos | 126 } // namespace chromeos |
| OLD | NEW |