11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file. 41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/browser/ui/views/location_bar/translate_icon_view.h" 61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "base/strings/utf_string_conversions.h" 81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/app/chrome_command_ids.h" 91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/browser/ui/browser_commands.h" 101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/browser/ui/view_ids.h" 111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "chrome/browser/ui/views/translate/translate_bubble_view.h" 121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "chrome/grit/generated_resources.h" 131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "grit/theme_resources.h" 141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/base/l10n/l10n_util.h" 151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/base/resource/resource_bundle.h" 161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)TranslateIconView::TranslateIconView(CommandUpdater* command_updater) 181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) : BubbleIconView(command_updater, IDC_TRANSLATE_PAGE) { 191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) set_id(VIEW_ID_TRANSLATE_BUTTON); 201e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_TRANSLATE)); 21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) SetToggled(false); 221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)TranslateIconView::~TranslateIconView() { 251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)void TranslateIconView::SetToggled(bool on) { 28f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 29f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) on ? IDR_TRANSLATE_ACTIVE : IDR_TRANSLATE)); 30f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)} 31f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)bool TranslateIconView::IsBubbleShowing() const { 331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) return TranslateBubbleView::IsShowing(); 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)void TranslateIconView::OnExecuting( 371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) BubbleIconView::ExecuteSource execute_source) { 381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)} 39