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 #include "components/translate/core/browser/translate_script.h" | 5 #include "components/translate/core/browser/translate_script.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "components/translate/core/browser/translate_url_fetcher.h" | 14 #include "components/translate/core/browser/translate_url_fetcher.h" |
15 #include "components/translate/core/browser/translate_url_util.h" | 15 #include "components/translate/core/browser/translate_url_util.h" |
16 #include "components/translate/core/common/translate_switches.h" | 16 #include "components/translate/core/common/translate_switches.h" |
17 #include "components/translate/core/common/translate_util.h" | 17 #include "components/translate/core/common/translate_util.h" |
18 #include "google_apis/google_api_keys.h" | 18 #include "google_apis/google_api_keys.h" |
19 #include "grit/component_resources.h" | 19 #include "grit/component_resources.h" |
20 #include "net/base/escape.h" | 20 #include "net/base/escape.h" |
21 #include "net/base/url_util.h" | 21 #include "net/base/url_util.h" |
22 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
23 | 23 |
| 24 namespace translate { |
| 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 const int kExpirationDelayDays = 1; | 28 const int kExpirationDelayDays = 1; |
27 | 29 |
28 } // namespace | 30 } // namespace |
29 | 31 |
30 const char TranslateScript::kScriptURL[] = | 32 const char TranslateScript::kScriptURL[] = |
31 "https://translate.google.com/translate_a/element.js"; | 33 "https://translate.google.com/translate_a/element.js"; |
32 const char TranslateScript::kRequestHeader[] = | 34 const char TranslateScript::kRequestHeader[] = |
33 "Google-Translate-Element-Mode: library"; | 35 "Google-Translate-Element-Mode: library"; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 expiration_delay_); | 149 expiration_delay_); |
148 } | 150 } |
149 | 151 |
150 for (RequestCallbackList::iterator it = callback_list_.begin(); | 152 for (RequestCallbackList::iterator it = callback_list_.begin(); |
151 it != callback_list_.end(); | 153 it != callback_list_.end(); |
152 ++it) { | 154 ++it) { |
153 it->Run(success, data); | 155 it->Run(success, data); |
154 } | 156 } |
155 callback_list_.clear(); | 157 callback_list_.clear(); |
156 } | 158 } |
| 159 |
| 160 } // namespace translate |
OLD | NEW |