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

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

Issue 9215005: Revert 117824 - Convert use of int ms to TimeDelta in files owned by brettw. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_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>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 virtual void Observe(int type, 76 virtual void Observe(int type,
77 const content::NotificationSource& source, 77 const content::NotificationSource& source,
78 const content::NotificationDetails& details) OVERRIDE; 78 const content::NotificationDetails& details) OVERRIDE;
79 79
80 // content::URLFetcherDelegate implementation: 80 // content::URLFetcherDelegate implementation:
81 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; 81 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE;
82 82
83 // Used by unit-tests to override the default delay after which the translate 83 // Used by unit-tests to override the default delay after which the translate
84 // script is fetched again from the translation server. 84 // script is fetched again from the translation server.
85 void set_translate_script_expiration_delay(int delay_ms) { 85 void set_translate_script_expiration_delay(int delay_ms) {
86 translate_script_expiration_delay_ = 86 translate_script_expiration_delay_ = delay_ms;
87 base::TimeDelta::FromMilliseconds(delay_ms);
88 } 87 }
89 88
90 // Convenience method to know if a tab is showing a translate infobar. 89 // Convenience method to know if a tab is showing a translate infobar.
91 static bool IsShowingTranslateInfobar(content::WebContents* tab); 90 static bool IsShowingTranslateInfobar(content::WebContents* tab);
92 91
93 // Returns true if the URL can be translated. 92 // Returns true if the URL can be translated.
94 static bool IsTranslatableURL(const GURL& url); 93 static bool IsTranslatableURL(const GURL& url);
95 94
96 // Fills |languages| with the list of languages that the translate server can 95 // Fills |languages| with the list of languages that the translate server can
97 // translate to and from. 96 // translate to and from.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // A map that associates a profile with its parsed "accept languages". 191 // A map that associates a profile with its parsed "accept languages".
193 typedef std::set<std::string> LanguageSet; 192 typedef std::set<std::string> LanguageSet;
194 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap; 193 typedef std::map<PrefService*, LanguageSet> PrefServiceLanguagesMap;
195 PrefServiceLanguagesMap accept_languages_; 194 PrefServiceLanguagesMap accept_languages_;
196 195
197 base::WeakPtrFactory<TranslateManager> weak_method_factory_; 196 base::WeakPtrFactory<TranslateManager> weak_method_factory_;
198 197
199 // The JS injected in the page to do the translation. 198 // The JS injected in the page to do the translation.
200 std::string translate_script_; 199 std::string translate_script_;
201 200
202 // Delay after which the translate script is fetched again 201 // Delay in milli-seconds after which the translate script is fetched again
203 // from the translate server. 202 // from the translate server.
204 base::TimeDelta translate_script_expiration_delay_; 203 int translate_script_expiration_delay_;
205 204
206 // Set when the translate JS is currently being retrieved. NULL otherwise. 205 // Set when the translate JS is currently being retrieved. NULL otherwise.
207 scoped_ptr<content::URLFetcher> translate_script_request_pending_; 206 scoped_ptr<content::URLFetcher> translate_script_request_pending_;
208 207
209 // Set when the list of languages is currently being retrieved. 208 // Set when the list of languages is currently being retrieved.
210 // NULL otherwise. 209 // NULL otherwise.
211 scoped_ptr<content::URLFetcher> language_list_request_pending_; 210 scoped_ptr<content::URLFetcher> language_list_request_pending_;
212 211
213 // The list of pending translate requests. Translate requests are queued when 212 // The list of pending translate requests. Translate requests are queued when
214 // the translate script is not ready and has to be fetched from the translate 213 // the translate script is not ready and has to be fetched from the translate
215 // server. 214 // server.
216 std::vector<PendingRequest> pending_requests_; 215 std::vector<PendingRequest> pending_requests_;
217 216
218 // The languages supported by the translation server. 217 // The languages supported by the translation server.
219 static base::LazyInstance<std::set<std::string> > supported_languages_; 218 static base::LazyInstance<std::set<std::string> > supported_languages_;
220 219
221 DISALLOW_COPY_AND_ASSIGN(TranslateManager); 220 DISALLOW_COPY_AND_ASSIGN(TranslateManager);
222 }; 221 };
223 222
224 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_ 223 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager.cc ('k') | chrome/browser/translate/translate_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698