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/ui/browser_content_translate_driver_observer.h" | 5 #include "chrome/browser/ui/browser_content_translate_driver_observer.h" |
6 | 6 |
7 #include "chrome/browser/translate/chrome_translate_client.h" | 7 #include "chrome/browser/translate/chrome_translate_client.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
11 #include "components/translate/core/browser/language_state.h" | 11 #include "components/translate/core/browser/language_state.h" |
12 | 12 |
13 BrowserContentTranslateDriverObserver::BrowserContentTranslateDriverObserver( | 13 BrowserContentTranslateDriverObserver::BrowserContentTranslateDriverObserver( |
14 Browser* browser) : browser_(browser) { | 14 Browser* browser) : browser_(browser) { |
15 } | 15 } |
16 | 16 |
17 BrowserContentTranslateDriverObserver:: | 17 BrowserContentTranslateDriverObserver:: |
18 ~BrowserContentTranslateDriverObserver() { | 18 ~BrowserContentTranslateDriverObserver() { |
19 } | 19 } |
20 | 20 |
21 void BrowserContentTranslateDriverObserver::OnIsPageTranslatedChanged( | 21 void BrowserContentTranslateDriverObserver::OnIsPageTranslatedChanged( |
22 content::WebContents* source) { | 22 content::WebContents* source) { |
23 if (source == browser_->tab_strip_model()->GetActiveWebContents()) { | 23 if (source == browser_->tab_strip_model()->GetActiveWebContents()) { |
24 ChromeTranslateClient* chrome_translate_client = | 24 ChromeTranslateClient* chrome_translate_client = |
25 ChromeTranslateClient::FromWebContents(source); | 25 ChromeTranslateClient::FromWebContents(source); |
26 LanguageState& language_state = chrome_translate_client->GetLanguageState(); | 26 translate::LanguageState& language_state = |
| 27 chrome_translate_client->GetLanguageState(); |
27 browser_->window()->SetTranslateIconToggled( | 28 browser_->window()->SetTranslateIconToggled( |
28 language_state.IsPageTranslated()); | 29 language_state.IsPageTranslated()); |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 void BrowserContentTranslateDriverObserver::OnTranslateEnabledChanged( | 33 void BrowserContentTranslateDriverObserver::OnTranslateEnabledChanged( |
33 content::WebContents* source) { | 34 content::WebContents* source) { |
34 if (source == browser_->tab_strip_model()->GetActiveWebContents()) | 35 if (source == browser_->tab_strip_model()->GetActiveWebContents()) |
35 browser_->window()->UpdateToolbar(source); | 36 browser_->window()->UpdateToolbar(source); |
36 } | 37 } |
OLD | NEW |