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

Side by Side Diff: chrome/browser/translate/translate_tab_helper.h

Issue 159883002: Move TranslatePrefs to the Translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@acceptLanguages
Patch Set: Fix typo Created 6 years, 10 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/translate/translate_bubble_model.h" 11 #include "chrome/browser/ui/translate/translate_bubble_model.h"
11 #include "components/translate/content/browser/content_translate_driver.h" 12 #include "components/translate/content/browser/content_translate_driver.h"
12 #include "components/translate/core/common/translate_errors.h" 13 #include "components/translate/core/common/translate_errors.h"
13 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 15 #include "content/public/browser/web_contents_user_data.h"
15 16
16 namespace content { 17 namespace content {
18 class BrowserContext;
17 class WebContents; 19 class WebContents;
18 } 20 }
19 21
20 struct LanguageDetectionDetails; 22 struct LanguageDetectionDetails;
23 class PrefService;
24 class TranslatePrefs;
21 25
22 class TranslateTabHelper 26 class TranslateTabHelper
23 : public content::WebContentsObserver, 27 : public content::WebContentsObserver,
24 public content::WebContentsUserData<TranslateTabHelper> { 28 public content::WebContentsUserData<TranslateTabHelper> {
25 public: 29 public:
26 virtual ~TranslateTabHelper(); 30 virtual ~TranslateTabHelper();
27 31
28 // Gets the LanguageState associated with the page. 32 // Gets the LanguageState associated with the page.
29 LanguageState& GetLanguageState(); 33 LanguageState& GetLanguageState();
30 34
31 // Returns the ContentTranslateDriver instance associated with this 35 // Returns the ContentTranslateDriver instance associated with this
32 // WebContents. 36 // WebContents.
33 ContentTranslateDriver& translate_driver() { return translate_driver_; } 37 ContentTranslateDriver& translate_driver() { return translate_driver_; }
34 38
39 // Helper method to return a new TranslatePrefs instance.
40 static scoped_ptr<TranslatePrefs> CreateTranslatePrefs(PrefService* prefs);
41
42 // Returns true if the passed language has been configured by the user as an
43 // accept language. |language| will be converted if it has the synonym of
blundell 2014/02/12 14:01:43 I don't understand the second sentence here.
44 // accept languages.
45 static bool IsAcceptLanguage(content::BrowserContext* browser_context,
46 const std::string& language);
47
35 // Denotes which state the user is in with respect to translate. 48 // Denotes which state the user is in with respect to translate.
36 enum TranslateStep { 49 enum TranslateStep {
37 BEFORE_TRANSLATE, 50 BEFORE_TRANSLATE,
38 TRANSLATING, 51 TRANSLATING,
39 AFTER_TRANSLATE, 52 AFTER_TRANSLATE,
40 TRANSLATE_ERROR 53 TRANSLATE_ERROR
41 }; 54 };
42 55
43 // Called when the embedder should present UI to the user corresponding to the 56 // Called when the embedder should present UI to the user corresponding to the
44 // user's current |step|. 57 // user's current |step|.
(...skipping 24 matching lines...) Expand all
69 void ShowBubble(content::WebContents* web_contents, 82 void ShowBubble(content::WebContents* web_contents,
70 TranslateBubbleModel::ViewState view_state, 83 TranslateBubbleModel::ViewState view_state,
71 TranslateErrors::Type error_type); 84 TranslateErrors::Type error_type);
72 85
73 ContentTranslateDriver translate_driver_; 86 ContentTranslateDriver translate_driver_;
74 87
75 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper); 88 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper);
76 }; 89 };
77 90
78 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ 91 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698