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

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

Issue 225263017: Move TranslateManager::IsTranslatableURL to be a client-level concept. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 8 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 GURL;
10 class PrefService; 11 class PrefService;
11 12
12 // Singleton managing the resources required for Translate. 13 // Singleton managing the resources required for Translate.
13 class TranslateService : public ResourceRequestAllowedNotifier::Observer { 14 class TranslateService : public ResourceRequestAllowedNotifier::Observer {
14 public: 15 public:
15 // Must be called before the Translate feature can be used. 16 // Must be called before the Translate feature can be used.
16 static void Initialize(); 17 static void Initialize();
17 18
18 // Must be called to shut down the Translate feature. 19 // Must be called to shut down the Translate feature.
19 static void Shutdown(bool cleanup_pending_fetcher); 20 static void Shutdown(bool cleanup_pending_fetcher);
(...skipping 20 matching lines...) Expand all
40 static void SetUseInfobar(bool value); 41 static void SetUseInfobar(bool value);
41 42
42 // Returns the language to translate to. The language returned is the 43 // Returns the language to translate to. The language returned is the
43 // first language found in the following list that is supported by the 44 // first language found in the following list that is supported by the
44 // translation service: 45 // translation service:
45 // the UI language 46 // the UI language
46 // the accept-language list 47 // the accept-language list
47 // If no language is found then an empty string is returned. 48 // If no language is found then an empty string is returned.
48 static std::string GetTargetLanguage(PrefService* prefs); 49 static std::string GetTargetLanguage(PrefService* prefs);
49 50
51 // Returns true if the URL can be translated.
52 static bool IsTranslatableURL(const GURL& url);
53
50 private: 54 private:
51 TranslateService(); 55 TranslateService();
52 ~TranslateService(); 56 ~TranslateService();
53 57
54 // ResourceRequestAllowedNotifier::Observer methods. 58 // ResourceRequestAllowedNotifier::Observer methods.
55 virtual void OnResourceRequestsAllowed() OVERRIDE; 59 virtual void OnResourceRequestsAllowed() OVERRIDE;
56 60
57 // Helper class to know if it's allowed to make network resource requests. 61 // Helper class to know if it's allowed to make network resource requests.
58 ResourceRequestAllowedNotifier resource_request_allowed_notifier_; 62 ResourceRequestAllowedNotifier resource_request_allowed_notifier_;
59 63
60 // Whether or not the infobar is used. This is intended to be used 64 // Whether or not the infobar is used. This is intended to be used
61 // only for testing. 65 // only for testing.
62 bool use_infobar_; 66 bool use_infobar_;
63 }; 67 };
64 68
65 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_ 69 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_manager_unittest.cc ('k') | chrome/browser/translate/translate_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698