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

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

Issue 3304015: Use PrefChangeRegistrar everywhere (Closed)
Patch Set: final version for commit Created 10 years, 2 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_MANAGER_H_ 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/singleton.h" 15 #include "base/singleton.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "chrome/browser/prefs/pref_change_registrar.h"
17 #include "chrome/common/net/url_fetcher.h" 18 #include "chrome/common/net/url_fetcher.h"
18 #include "chrome/common/notification_observer.h" 19 #include "chrome/common/notification_observer.h"
19 #include "chrome/common/notification_registrar.h" 20 #include "chrome/common/notification_registrar.h"
20 #include "chrome/common/translate_errors.h" 21 #include "chrome/common/translate_errors.h"
21 22
22 class GURL; 23 class GURL;
23 struct PageTranslatedDetails; 24 struct PageTranslatedDetails;
24 class PrefService; 25 class PrefService;
25 class TabContents; 26 class TabContents;
26 class TranslateInfoBarDelegate; 27 class TranslateInfoBarDelegate;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Returns the language to translate to, which is the language the UI is 147 // Returns the language to translate to, which is the language the UI is
147 // configured in. Returns an empty string if that language is not supported 148 // configured in. Returns an empty string if that language is not supported
148 // by the translation service. 149 // by the translation service.
149 static std::string GetTargetLanguage(); 150 static std::string GetTargetLanguage();
150 151
151 // Returns the translate info bar showing in |tab| or NULL if none is showing. 152 // Returns the translate info bar showing in |tab| or NULL if none is showing.
152 static TranslateInfoBarDelegate* GetTranslateInfoBarDelegate( 153 static TranslateInfoBarDelegate* GetTranslateInfoBarDelegate(
153 TabContents* tab); 154 TabContents* tab);
154 155
155 NotificationRegistrar notification_registrar_; 156 NotificationRegistrar notification_registrar_;
157 PrefChangeRegistrar pref_change_registrar_;
156 158
157 // A map that associates a profile with its parsed "accept languages". 159 // A map that associates a profile with its parsed "accept languages".
158 typedef std::set<std::string> LanguageSet; 160 typedef std::set<std::string> LanguageSet;
159 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap; 161 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap;
160 PrefServiceLanguagesMap accept_languages_; 162 PrefServiceLanguagesMap accept_languages_;
161 163
162 ScopedRunnableMethodFactory<TranslateManager> method_factory_; 164 ScopedRunnableMethodFactory<TranslateManager> method_factory_;
163 165
164 // The JS injected in the page to do the translation. 166 // The JS injected in the page to do the translation.
165 std::string translate_script_; 167 std::string translate_script_;
(...skipping 10 matching lines...) Expand all
176 // server. 178 // server.
177 std::vector<PendingRequest> pending_requests_; 179 std::vector<PendingRequest> pending_requests_;
178 180
179 // The languages supported by the translation server. 181 // The languages supported by the translation server.
180 static base::LazyInstance<std::set<std::string> > supported_languages_; 182 static base::LazyInstance<std::set<std::string> > supported_languages_;
181 183
182 DISALLOW_COPY_AND_ASSIGN(TranslateManager); 184 DISALLOW_COPY_AND_ASSIGN(TranslateManager);
183 }; 185 };
184 186
185 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ 187 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.cc ('k') | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698