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 <stddef.h> | 5 #include <stddef.h> |
6 #include <algorithm> | 6 #include <algorithm> |
7 #include <set> | 7 #include <set> |
| 8 #include <tuple> |
8 #include <utility> | 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SimulateOnPageTranslated( | 254 SimulateOnPageTranslated( |
254 0, source_lang, target_lang, translate::TranslateErrors::NONE); | 255 0, source_lang, target_lang, translate::TranslateErrors::NONE); |
255 } | 256 } |
256 | 257 |
257 bool GetTranslateMessage(std::string* original_lang, | 258 bool GetTranslateMessage(std::string* original_lang, |
258 std::string* target_lang) { | 259 std::string* target_lang) { |
259 const IPC::Message* message = process()->sink().GetFirstMessageMatching( | 260 const IPC::Message* message = process()->sink().GetFirstMessageMatching( |
260 ChromeFrameMsg_TranslatePage::ID); | 261 ChromeFrameMsg_TranslatePage::ID); |
261 if (!message) | 262 if (!message) |
262 return false; | 263 return false; |
263 base::Tuple<int, std::string, std::string, std::string> translate_param; | 264 std::tuple<int, std::string, std::string, std::string> translate_param; |
264 ChromeFrameMsg_TranslatePage::Read(message, &translate_param); | 265 ChromeFrameMsg_TranslatePage::Read(message, &translate_param); |
265 // Ignore get<0>(translate_param) which is the page seq no. | 266 // Ignore get<0>(translate_param) which is the page seq no. |
266 // Ignore get<1>(translate_param) which is the script injected in the page. | 267 // Ignore get<1>(translate_param) which is the script injected in the page. |
267 if (original_lang) | 268 if (original_lang) |
268 *original_lang = base::get<2>(translate_param); | 269 *original_lang = std::get<2>(translate_param); |
269 if (target_lang) | 270 if (target_lang) |
270 *target_lang = base::get<3>(translate_param); | 271 *target_lang = std::get<3>(translate_param); |
271 return true; | 272 return true; |
272 } | 273 } |
273 | 274 |
274 InfoBarService* infobar_service() { | 275 InfoBarService* infobar_service() { |
275 return InfoBarService::FromWebContents(web_contents()); | 276 return InfoBarService::FromWebContents(web_contents()); |
276 } | 277 } |
277 | 278 |
278 #if !defined(USE_AURA) | 279 #if !defined(USE_AURA) |
279 // Returns the translate infobar if there is 1 infobar and it is a translate | 280 // Returns the translate infobar if there is 1 infobar and it is a translate |
280 // infobar. | 281 // infobar. |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 | 1756 |
1756 // Check the bubble exists instead of the infobar. | 1757 // Check the bubble exists instead of the infobar. |
1757 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1758 translate::TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
1758 ASSERT_TRUE(infobar == NULL); | 1759 ASSERT_TRUE(infobar == NULL); |
1759 TranslateBubbleModel* bubble = factory->model(); | 1760 TranslateBubbleModel* bubble = factory->model(); |
1760 ASSERT_TRUE(bubble != NULL); | 1761 ASSERT_TRUE(bubble != NULL); |
1761 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1762 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
1762 bubble->GetViewState()); | 1763 bubble->GetViewState()); |
1763 } | 1764 } |
1764 #endif // defined(USE_AURA) | 1765 #endif // defined(USE_AURA) |
OLD | NEW |