blob: 2b98086caa142b131f5a0f4f34d1a10b27857128 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_
#define IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_
#include "base/macros.h"
#include "components/web_resource/resource_request_allowed_notifier.h"
class GURL;
// Singleton managing the resources required for Translate.
class TranslateServiceIOS
: public web_resource::ResourceRequestAllowedNotifier::Observer {
public:
// Must be called before the Translate feature can be used.
static void Initialize();
// Must be called to shut down the Translate feature.
static void Shutdown();
// Returns true if the URL can be translated.
static bool IsTranslatableURL(const GURL& url);
private:
TranslateServiceIOS();
~TranslateServiceIOS();
// ResourceRequestAllowedNotifier::Observer methods.
void OnResourceRequestsAllowed() override;
// Helper class to know if it's allowed to make network resource requests.
web_resource::ResourceRequestAllowedNotifier
resource_request_allowed_notifier_;
DISALLOW_COPY_AND_ASSIGN(TranslateServiceIOS);
};
#endif // IOS_CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_IOS_H_
|