cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / browser / translate / chrome_ios_translate_client.h
blob743210f1910f8e71520af5338b652f21f9dde1d8
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_CHROME_IOS_TRANSLATE_CLIENT_H_
6 #define IOS_CHROME_BROWSER_TRANSLATE_CHROME_IOS_TRANSLATE_CLIENT_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "components/translate/core/browser/translate_client.h"
12 #include "components/translate/core/browser/translate_step.h"
13 #include "components/translate/core/common/translate_errors.h"
14 #include "components/translate/ios/browser/ios_translate_driver.h"
15 #include "ios/web/public/web_state/web_state_observer.h"
16 #include "ios/web/public/web_state/web_state_user_data.h"
18 class PrefService;
20 namespace translate {
21 class TranslateAcceptLanguages;
22 class TranslatePrefs;
23 class TranslateManager;
24 } // namespace translate
26 namespace web {
27 class WebState;
30 class ChromeIOSTranslateClient
31 : public translate::TranslateClient,
32 public web::WebStateObserver,
33 public web::WebStateUserData<ChromeIOSTranslateClient> {
34 public:
35 ~ChromeIOSTranslateClient() override;
37 // Helper method to return a new TranslatePrefs instance.
38 static scoped_ptr<translate::TranslatePrefs> CreateTranslatePrefs(
39 PrefService* prefs);
41 // Gets the associated TranslateManager.
42 translate::TranslateManager* GetTranslateManager();
44 // TranslateClient implementation.
45 translate::TranslateDriver* GetTranslateDriver() override;
46 PrefService* GetPrefs() override;
47 scoped_ptr<translate::TranslatePrefs> GetTranslatePrefs() override;
48 translate::TranslateAcceptLanguages* GetTranslateAcceptLanguages() override;
49 int GetInfobarIconID() const override;
50 scoped_ptr<infobars::InfoBar> CreateInfoBar(
51 scoped_ptr<translate::TranslateInfoBarDelegate> delegate) const override;
52 void ShowTranslateUI(translate::TranslateStep step,
53 const std::string source_language,
54 const std::string target_language,
55 translate::TranslateErrors::Type error_type,
56 bool triggered_from_menu) override;
57 bool IsTranslatableURL(const GURL& url) override;
58 void ShowReportLanguageDetectionErrorUI(const GURL& report_url) override;
60 private:
61 explicit ChromeIOSTranslateClient(web::WebState* web_state);
62 friend class web::WebStateUserData<ChromeIOSTranslateClient>;
64 // web::WebStateObserver implementation.
65 void WebStateDestroyed() override;
67 scoped_ptr<translate::TranslateManager> translate_manager_;
68 translate::IOSTranslateDriver translate_driver_;
70 DISALLOW_COPY_AND_ASSIGN(ChromeIOSTranslateClient);
73 #endif // IOS_CHROME_BROWSER_TRANSLATE_CHROME_IOS_TRANSLATE_CLIENT_H_