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/translate/translate_accept_languages_factory.h" | 5 #include "chrome/browser/translate/translate_accept_languages_factory.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 PrefService* prefs) | 35 PrefService* prefs) |
36 : accept_languages_(prefs, prefs::kAcceptLanguages) {} | 36 : accept_languages_(prefs, prefs::kAcceptLanguages) {} |
37 | 37 |
38 TranslateAcceptLanguagesService::~TranslateAcceptLanguagesService() {} | 38 TranslateAcceptLanguagesService::~TranslateAcceptLanguagesService() {} |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 // static | 42 // static |
43 TranslateAcceptLanguagesFactory* | 43 TranslateAcceptLanguagesFactory* |
44 TranslateAcceptLanguagesFactory::GetInstance() { | 44 TranslateAcceptLanguagesFactory::GetInstance() { |
45 return Singleton<TranslateAcceptLanguagesFactory>::get(); | 45 return base::Singleton<TranslateAcceptLanguagesFactory>::get(); |
46 } | 46 } |
47 | 47 |
48 // static | 48 // static |
49 translate::TranslateAcceptLanguages* | 49 translate::TranslateAcceptLanguages* |
50 TranslateAcceptLanguagesFactory::GetForBrowserContext( | 50 TranslateAcceptLanguagesFactory::GetForBrowserContext( |
51 content::BrowserContext* context) { | 51 content::BrowserContext* context) { |
52 TranslateAcceptLanguagesService* service = | 52 TranslateAcceptLanguagesService* service = |
53 static_cast<TranslateAcceptLanguagesService*>( | 53 static_cast<TranslateAcceptLanguagesService*>( |
54 GetInstance()->GetServiceForBrowserContext(context, true)); | 54 GetInstance()->GetServiceForBrowserContext(context, true)); |
55 return &service->accept_languages(); | 55 return &service->accept_languages(); |
(...skipping 10 matching lines...) Expand all Loading... |
66 content::BrowserContext* browser_context) const { | 66 content::BrowserContext* browser_context) const { |
67 Profile* profile = Profile::FromBrowserContext(browser_context); | 67 Profile* profile = Profile::FromBrowserContext(browser_context); |
68 return new TranslateAcceptLanguagesService(profile->GetPrefs()); | 68 return new TranslateAcceptLanguagesService(profile->GetPrefs()); |
69 } | 69 } |
70 | 70 |
71 content::BrowserContext* | 71 content::BrowserContext* |
72 TranslateAcceptLanguagesFactory::GetBrowserContextToUse( | 72 TranslateAcceptLanguagesFactory::GetBrowserContextToUse( |
73 content::BrowserContext* context) const { | 73 content::BrowserContext* context) const { |
74 return chrome::GetBrowserContextRedirectedInIncognito(context); | 74 return chrome::GetBrowserContextRedirectedInIncognito(context); |
75 } | 75 } |
OLD | NEW |