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

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

Issue 186063007: Move TranslateManager unit tests out of the browser_tests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: translatetests: comment Created 6 years, 9 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 CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_ 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
7 7
8 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h" 8 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h"
9 9
10 class PrefService; 10 class PrefService;
11 11
12 // Singleton managing the resources required for Translate. 12 // Singleton managing the resources required for Translate.
13 class TranslateService : public ResourceRequestAllowedNotifier::Observer { 13 class TranslateService : public ResourceRequestAllowedNotifier::Observer {
14 public: 14 public:
15 // Must be called before the Translate feature can be used. 15 // Must be called before the Translate feature can be used.
16 static void Initialize(); 16 static void Initialize();
17 17
18 // Must be called to shut down the Translate feature. 18 // Must be called to shut down the Translate feature.
19 static void Shutdown(bool cleanup_pending_fetcher); 19 static void Shutdown(bool cleanup_pending_fetcher);
20 20
21 // Initializes the TranslateService in a way that it can be initialized
22 // multiple times in a unit test suite (once for each test). Should be paired
23 // with ShutdownForTesting at the end of the test.
24 static void InitializeForTesting();
25
26 // Shuts down the TranslateService at the end of a test in a way that the next
27 // test can initialize and use the service.
28 static void ShutdownForTesting();
29
21 // Let the caller decide if and when we should fetch the language list from 30 // Let the caller decide if and when we should fetch the language list from
22 // the translate server. This is a NOOP if switches::kDisableTranslate is set 31 // the translate server. This is a NOOP if switches::kDisableTranslate is set
23 // or if prefs::kEnableTranslate is set to false. 32 // or if prefs::kEnableTranslate is set to false.
24 static void FetchLanguageListFromTranslateServer(PrefService* prefs); 33 static void FetchLanguageListFromTranslateServer(PrefService* prefs);
25 34
26 // Returns true if the new translate bubble is enabled. 35 // Returns true if the new translate bubble is enabled.
27 static bool IsTranslateBubbleEnabled(); 36 static bool IsTranslateBubbleEnabled();
28 37
29 // Sets whether of not the infobar UI is used. This method is intended to be 38 // Sets whether of not the infobar UI is used. This method is intended to be
30 // used only for tests. 39 // used only for tests.
31 static void SetUseInfobar(bool value); 40 static void SetUseInfobar(bool value);
32 41
33 private: 42 private:
34 TranslateService(); 43 TranslateService();
35 ~TranslateService(); 44 ~TranslateService();
36 45
37 // ResourceRequestAllowedNotifier::Observer methods. 46 // ResourceRequestAllowedNotifier::Observer methods.
38 virtual void OnResourceRequestsAllowed() OVERRIDE; 47 virtual void OnResourceRequestsAllowed() OVERRIDE;
39 48
40 // Helper class to know if it's allowed to make network resource requests. 49 // Helper class to know if it's allowed to make network resource requests.
41 ResourceRequestAllowedNotifier resource_request_allowed_notifier_; 50 ResourceRequestAllowedNotifier resource_request_allowed_notifier_;
42 51
43 // Whether or not the infobar is used. This is intended to be used 52 // Whether or not the infobar is used. This is intended to be used
44 // only for testing. 53 // only for testing.
45 bool use_infobar_; 54 bool use_infobar_;
46 }; 55 };
47 56
48 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_ 57 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager_render_view_host_unittest.cc ('k') | chrome/browser/translate/translate_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698