Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: components/translate/core/browser/translate_client.h

Issue 284313008: Move TranslateInfoBarDelegate and OptionsMenuModel to the Translate component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + review comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
11 #include "components/translate/core/browser/translate_prefs.h" 12 #include "components/translate/core/browser/translate_prefs.h"
12 #include "components/translate/core/browser/translate_step.h" 13 #include "components/translate/core/browser/translate_step.h"
13 #include "components/translate/core/common/translate_errors.h" 14 #include "components/translate/core/common/translate_errors.h"
14 15
15 class GURL; 16 class GURL;
16 class PrefService; 17 class PrefService;
17 class TranslateAcceptLanguages; 18 class TranslateAcceptLanguages;
18 class TranslateDriver; 19 class TranslateDriver;
20 class TranslateInfoBarDelegate;
21
22 namespace infobars {
23 class InfoBar;
24 }
19 25
20 // A client interface that needs to be supplied to TranslateManager by the 26 // A client interface that needs to be supplied to TranslateManager by the
21 // embedder. 27 // embedder.
22 // 28 //
23 // Each client instance is associated with a given context within which a 29 // Each client instance is associated with a given context within which a
24 // TranslateManager is used (e.g. a single tab). 30 // TranslateManager is used (e.g. a single tab).
25 class TranslateClient { 31 class TranslateClient {
26 public: 32 public:
27 // Gets the TranslateDriver associated with the client. 33 // Gets the TranslateDriver associated with the client.
28 virtual TranslateDriver* GetTranslateDriver() = 0; 34 virtual TranslateDriver* GetTranslateDriver() = 0;
29 35
30 // Returns the associated PrefService. 36 // Returns the associated PrefService.
31 virtual PrefService* GetPrefs() = 0; 37 virtual PrefService* GetPrefs() = 0;
32 38
33 // Returns the associated TranslatePrefs. 39 // Returns the associated TranslatePrefs.
34 virtual scoped_ptr<TranslatePrefs> GetTranslatePrefs() = 0; 40 virtual scoped_ptr<TranslatePrefs> GetTranslatePrefs() = 0;
35 41
36 // Returns the associated TranslateAcceptLanguages. 42 // Returns the associated TranslateAcceptLanguages.
37 virtual TranslateAcceptLanguages* GetTranslateAcceptLanguages() = 0; 43 virtual TranslateAcceptLanguages* GetTranslateAcceptLanguages() = 0;
38 44
45 // Returns the resource ID of the icon to be shown for the Translate infobars.
46 virtual int GetInfobarIconID() const = 0;
47
48 // Returns a translate infobar that owns |delegate|.
49 virtual scoped_ptr<infobars::InfoBar> CreateInfoBar(
50 scoped_ptr<TranslateInfoBarDelegate> delegate) const = 0;
51
39 // Called when the embedder should present UI to the user corresponding to the 52 // Called when the embedder should present UI to the user corresponding to the
40 // user's current |step|. 53 // user's current |step|.
41 virtual void ShowTranslateUI(translate::TranslateStep step, 54 virtual void ShowTranslateUI(translate::TranslateStep step,
42 const std::string source_language, 55 const std::string source_language,
43 const std::string target_language, 56 const std::string target_language,
44 TranslateErrors::Type error_type, 57 TranslateErrors::Type error_type,
45 bool triggered_from_menu) = 0; 58 bool triggered_from_menu) = 0;
46 59
47 // Returns true if the URL can be translated. 60 // Returns true if the URL can be translated.
48 virtual bool IsTranslatableURL(const GURL& url) = 0; 61 virtual bool IsTranslatableURL(const GURL& url) = 0;
49 62
50 // Presents |report_url|, a URL containing information relating to reporting 63 // Presents |report_url|, a URL containing information relating to reporting
51 // a language detection error, to the user to allow them to report language 64 // a language detection error, to the user to allow them to report language
52 // detection errors as desired. 65 // detection errors as desired.
53 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0; 66 virtual void ShowReportLanguageDetectionErrorUI(const GURL& report_url) = 0;
54 }; 67 };
55 68
56 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_ 69 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698