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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/translate/core/browser/translate_prefs.h"
13 #include "components/translate/core/browser/translate_step.h"
14 #include "components/translate/core/common/translate_errors.h"
25 class TranslateAcceptLanguages
;
26 class TranslateDriver
;
27 class TranslateInfoBarDelegate
;
29 // A client interface that needs to be supplied to TranslateManager by the
32 // Each client instance is associated with a given context within which a
33 // TranslateManager is used (e.g. a single tab).
34 class TranslateClient
{
36 // Gets the TranslateDriver associated with the client.
37 virtual TranslateDriver
* GetTranslateDriver() = 0;
39 // Returns the associated PrefService.
40 virtual PrefService
* GetPrefs() = 0;
42 // Returns the associated TranslatePrefs.
43 virtual scoped_ptr
<TranslatePrefs
> GetTranslatePrefs() = 0;
45 // Returns the associated TranslateAcceptLanguages.
46 virtual TranslateAcceptLanguages
* GetTranslateAcceptLanguages() = 0;
48 // Returns the resource ID of the icon to be shown for the Translate infobars.
49 virtual int GetInfobarIconID() const = 0;
51 // Returns a translate infobar that owns |delegate|.
52 virtual scoped_ptr
<infobars::InfoBar
> CreateInfoBar(
53 scoped_ptr
<TranslateInfoBarDelegate
> delegate
) const = 0;
55 // Called when the embedder should present UI to the user corresponding to the
56 // user's current |step|.
57 virtual void ShowTranslateUI(translate::TranslateStep step
,
58 const std::string source_language
,
59 const std::string target_language
,
60 TranslateErrors::Type error_type
,
61 bool triggered_from_menu
) = 0;
63 // Returns true if the URL can be translated.
64 virtual bool IsTranslatableURL(const GURL
& url
) = 0;
66 // Presents |report_url|, a URL containing information relating to reporting
67 // a language detection error, to the user to allow them to report language
68 // detection errors as desired.
69 virtual void ShowReportLanguageDetectionErrorUI(const GURL
& report_url
) = 0;
72 } // namespace translate
74 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_