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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
8 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h"
12 // Singleton managing the resources required for Translate.
13 class TranslateService
: public ResourceRequestAllowedNotifier::Observer
{
15 // Must be called before the Translate feature can be used.
16 static void Initialize();
18 // Must be called to shut down the Translate feature.
19 static void Shutdown(bool cleanup_pending_fetcher
);
21 // Let the caller decide if and when we should fetch the language list from
22 // the translate server. This is a NOOP if switches::kDisableTranslate is set
23 // or if prefs::kEnableTranslate is set to false.
24 static void FetchLanguageListFromTranslateServer(PrefService
* prefs
);
26 // Returns true if the new translate bubble is enabled.
27 static bool IsTranslateBubbleEnabled();
29 // Sets whether of not the infobar UI is used. This method is intended to be
30 // used only for tests.
31 static void SetUseInfobar(bool value
);
37 // ResourceRequestAllowedNotifier::Observer methods.
38 virtual void OnResourceRequestsAllowed() OVERRIDE
;
40 // Helper class to know if it's allowed to make network resource requests.
41 ResourceRequestAllowedNotifier resource_request_allowed_notifier_
;
43 // Whether or not the infobar is used. This is intended to be used
48 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_