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 IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_
6 #define IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_
8 #include "base/macros.h"
9 #include "components/web_resource/resource_request_allowed_notifier.h"
13 // Singleton managing the resources required for Translate.
14 class TranslateServiceIOS
15 : public web_resource::ResourceRequestAllowedNotifier::Observer
{
17 // Must be called before the Translate feature can be used.
18 static void Initialize();
20 // Must be called to shut down the Translate feature.
21 static void Shutdown();
23 // Returns true if the URL can be translated.
24 static bool IsTranslatableURL(const GURL
& url
);
27 TranslateServiceIOS();
28 ~TranslateServiceIOS();
30 // ResourceRequestAllowedNotifier::Observer methods.
31 void OnResourceRequestsAllowed() override
;
33 // Helper class to know if it's allowed to make network resource requests.
34 web_resource::ResourceRequestAllowedNotifier
35 resource_request_allowed_notifier_
;
37 DISALLOW_COPY_AND_ASSIGN(TranslateServiceIOS
);
40 #endif // IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_