OLD | NEW |
---|---|
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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 | 17 |
18 namespace translate { | 18 namespace translate { |
19 | 19 |
20 class TranslateScriptTest; | 20 class TranslateScriptTest; |
21 class TranslateURLFetcher; | 21 class TranslateURLFetcher; |
22 | 22 |
23 class TranslateScript { | 23 class TranslateScript { |
24 public: | 24 public: |
25 typedef base::Callback<void(bool, const std::string&)> RequestCallback; | 25 typedef base::Callback<void(bool, const std::string&)> RequestCallback; |
26 | 26 |
27 static const int kFetcherId = 0; | 27 static const int kFetcherId = 0; |
28 | 28 |
29 // Study name in finch config file for the server params. | |
30 static const char kTranslateServerStudy[]; | |
groby-ooo-7-16
2016/08/02 21:14:10
Please don't expose in the header - I think we can
ftang
2016/08/02 23:46:23
Done.
| |
31 | |
32 // Param name in finch config file for the server params. | |
33 static const char kServerParams[]; | |
34 | |
29 TranslateScript(); | 35 TranslateScript(); |
30 virtual ~TranslateScript(); | 36 virtual ~TranslateScript(); |
31 | 37 |
32 // Returns the feched the translate script. | 38 // Returns the feched the translate script. |
33 const std::string& data() { return data_; } | 39 const std::string& data() { return data_; } |
34 | 40 |
35 // Used by unit-tests to override some defaults: | 41 // Used by unit-tests to override some defaults: |
36 // Delay after which the translate script is fetched again from the | 42 // Delay after which the translate script is fetched again from the |
37 // translation server. | 43 // translation server. |
38 void set_expiration_delay(int delay_ms) { | 44 void set_expiration_delay(int delay_ms) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 RequestCallbackList callback_list_; | 95 RequestCallbackList callback_list_; |
90 | 96 |
91 base::WeakPtrFactory<TranslateScript> weak_method_factory_; | 97 base::WeakPtrFactory<TranslateScript> weak_method_factory_; |
92 | 98 |
93 DISALLOW_COPY_AND_ASSIGN(TranslateScript); | 99 DISALLOW_COPY_AND_ASSIGN(TranslateScript); |
94 }; | 100 }; |
95 | 101 |
96 } // namespace translate | 102 } // namespace translate |
97 | 103 |
98 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ | 104 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ |
OLD | NEW |