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 "chrome/browser/translate/chrome_translate_client.h" | 5 #include "chrome/browser/translate/chrome_translate_client.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 if (web_contents() != browser->tab_strip_model()->GetActiveWebContents()) | 326 if (web_contents() != browser->tab_strip_model()->GetActiveWebContents()) |
327 return; | 327 return; |
328 | 328 |
329 // This ShowBubble function is also used for upating the existing bubble. | 329 // This ShowBubble function is also used for upating the existing bubble. |
330 // However, with the bubble shown, any browser windows are NOT activated | 330 // However, with the bubble shown, any browser windows are NOT activated |
331 // because the bubble takes the focus from the other widgets including the | 331 // because the bubble takes the focus from the other widgets including the |
332 // browser windows. So it is checked that |browser| is the last activated | 332 // browser windows. So it is checked that |browser| is the last activated |
333 // browser, not is now activated. | 333 // browser, not is now activated. |
334 if (browser != | 334 if (browser != chrome::FindLastActive()) |
335 chrome::FindLastActiveWithHostDesktopType(browser->host_desktop_type())) { | |
336 return; | 335 return; |
337 } | |
338 | 336 |
339 // During auto-translating, the bubble should not be shown. | 337 // During auto-translating, the bubble should not be shown. |
340 if (step == translate::TRANSLATE_STEP_TRANSLATING || | 338 if (step == translate::TRANSLATE_STEP_TRANSLATING || |
341 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) { | 339 step == translate::TRANSLATE_STEP_AFTER_TRANSLATE) { |
342 if (GetLanguageState().InTranslateNavigation()) | 340 if (GetLanguageState().InTranslateNavigation()) |
343 return; | 341 return; |
344 } | 342 } |
345 | 343 |
346 TranslateBubbleFactory::Show( | 344 TranslateBubbleFactory::Show( |
347 browser->window(), web_contents(), step, error_type); | 345 browser->window(), web_contents(), step, error_type); |
348 #else | 346 #else |
349 NOTREACHED(); | 347 NOTREACHED(); |
350 #endif | 348 #endif |
351 } | 349 } |
OLD | NEW |