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