NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / browser_content_translate_driver_observer.cc
blobf1bdaa2482e83b4c3399df49fc58f92fb48604c0
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/browser_content_translate_driver_observer.h"
7 #include "chrome/browser/translate/translate_tab_helper.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "components/translate/core/browser/language_state.h"
13 BrowserContentTranslateDriverObserver::BrowserContentTranslateDriverObserver(
14 Browser* browser) : browser_(browser) {
17 BrowserContentTranslateDriverObserver::
18 ~BrowserContentTranslateDriverObserver() {
21 void BrowserContentTranslateDriverObserver::OnIsPageTranslatedChanged(
22 content::WebContents* source) {
23 if (source == browser_->tab_strip_model()->GetActiveWebContents()) {
24 TranslateTabHelper* translate_tab_helper =
25 TranslateTabHelper::FromWebContents(source);
26 LanguageState& language_state = translate_tab_helper->GetLanguageState();
27 browser_->window()->SetTranslateIconToggled(
28 language_state.IsPageTranslated());
32 void BrowserContentTranslateDriverObserver::OnTranslateEnabledChanged(
33 content::WebContents* source) {
34 if (source == browser_->tab_strip_model()->GetActiveWebContents())
35 browser_->window()->UpdateToolbar(source);