Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/speech/tts_extension_loader_chromeos.cc

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/speech/tts_extension_loader_chromeos.h" 5 #include "chrome/browser/speech/tts_extension_loader_chromeos.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/extensions/component_loader.h" 9 #include "chrome/browser/extensions/component_loader.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h" 12 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/profiles/incognito_helpers.h" 13 #include "chrome/browser/profiles/incognito_helpers.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h" 15 #include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
16 #include "chrome/browser/speech/tts_controller.h" 16 #include "chrome/browser/speech/tts_controller.h"
17 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
18 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 18 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
19 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 19 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
20 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 20 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
21 #include "grit/browser_resources.h" 21 #include "grit/browser_resources.h"
22 22
23 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile. 23 // Factory to load one instance of TtsExtensionLoaderChromeOs per profile.
24 class TtsExtensionLoaderChromeOsFactory : public ProfileKeyedServiceFactory { 24 class TtsExtensionLoaderChromeOsFactory
25 : public BrowserContextKeyedServiceFactory {
25 public: 26 public:
26 static TtsExtensionLoaderChromeOs* GetForProfile(Profile* profile) { 27 static TtsExtensionLoaderChromeOs* GetForProfile(Profile* profile) {
27 return static_cast<TtsExtensionLoaderChromeOs*>( 28 return static_cast<TtsExtensionLoaderChromeOs*>(
28 GetInstance()->GetServiceForProfile(profile, true)); 29 GetInstance()->GetServiceForBrowserContext(profile, true));
29 } 30 }
30 31
31 static TtsExtensionLoaderChromeOsFactory* GetInstance() { 32 static TtsExtensionLoaderChromeOsFactory* GetInstance() {
32 return Singleton<TtsExtensionLoaderChromeOsFactory>::get(); 33 return Singleton<TtsExtensionLoaderChromeOsFactory>::get();
33 } 34 }
34 35
35 private: 36 private:
36 friend struct DefaultSingletonTraits<TtsExtensionLoaderChromeOsFactory>; 37 friend struct DefaultSingletonTraits<TtsExtensionLoaderChromeOsFactory>;
37 38
38 TtsExtensionLoaderChromeOsFactory() : ProfileKeyedServiceFactory( 39 TtsExtensionLoaderChromeOsFactory() : BrowserContextKeyedServiceFactory(
39 "TtsExtensionLoaderChromeOs", 40 "TtsExtensionLoaderChromeOs",
40 ProfileDependencyManager::GetInstance()) 41 BrowserContextDependencyManager::GetInstance())
41 {} 42 {}
42 43
43 virtual ~TtsExtensionLoaderChromeOsFactory() {} 44 virtual ~TtsExtensionLoaderChromeOsFactory() {}
44 45
45 virtual content::BrowserContext* GetBrowserContextToUse( 46 virtual content::BrowserContext* GetBrowserContextToUse(
46 content::BrowserContext* context) const OVERRIDE{ 47 content::BrowserContext* context) const OVERRIDE{
47 // If given an incognito profile (including the Chrome OS login 48 // If given an incognito profile (including the Chrome OS login
48 // profile), share the service with the original profile. 49 // profile), share the service with the original profile.
49 return chrome::GetBrowserContextRedirectedInIncognito(context); 50 return chrome::GetBrowserContextRedirectedInIncognito(context);
50 } 51 }
51 52
52 virtual ProfileKeyedService* BuildServiceInstanceFor( 53 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
53 content::BrowserContext* profile) const OVERRIDE { 54 content::BrowserContext* profile) const OVERRIDE {
54 return new TtsExtensionLoaderChromeOs(static_cast<Profile*>(profile)); 55 return new TtsExtensionLoaderChromeOs(static_cast<Profile*>(profile));
55 } 56 }
56 }; 57 };
57 58
58 TtsExtensionLoaderChromeOs* 59 TtsExtensionLoaderChromeOs*
59 TtsExtensionLoaderChromeOs::GetInstance(Profile* profile) { 60 TtsExtensionLoaderChromeOs::GetInstance(Profile* profile) {
60 return TtsExtensionLoaderChromeOsFactory::GetInstance() 61 return TtsExtensionLoaderChromeOsFactory::GetInstance()
61 ->GetForProfile(profile); 62 ->GetForProfile(profile);
62 } 63 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 117
117 if (!IsTtsLoadedInThisProfile()) 118 if (!IsTtsLoadedInThisProfile())
118 return; 119 return;
119 120
120 if (tts_state_ == TTS_LOADING) { 121 if (tts_state_ == TTS_LOADING) {
121 LOG(INFO) << "TTS component extension loaded, retrying queued utterances."; 122 LOG(INFO) << "TTS component extension loaded, retrying queued utterances.";
122 tts_state_ = TTS_LOADED; 123 tts_state_ = TTS_LOADED;
123 TtsController::GetInstance()->RetrySpeakingQueuedUtterances(); 124 TtsController::GetInstance()->RetrySpeakingQueuedUtterances();
124 } 125 }
125 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698