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