Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Side by Side Diff: chrome/browser/translate/translate_infobar_delegate.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/translate_infobar_delegate.h" 5 #include "chrome/browser/translate/translate_infobar_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/string_compare.h" 9 #include "base/i18n/string_compare.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/infobars/infobar_service.h" 12 #include "chrome/browser/infobars/infobar_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/translate/translate_manager.h" 14 #include "chrome/browser/translate/translate_manager.h"
15 #include "chrome/browser/translate/translate_tab_helper.h" 15 #include "chrome/browser/translate/translate_tab_helper.h"
16 #include "content/public/browser/navigation_details.h" 16 #include "content/public/browser/navigation_details.h"
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
21 #include "third_party/icu/public/i18n/unicode/coll.h" 21 #include "third_party/icu/public/i18n/unicode/coll.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "ui/base/resource/resource_bundle.h"
24 23
25 using content::NavigationEntry; 24 using content::NavigationEntry;
26 25
27 // static 26 // static
28 const size_t TranslateInfoBarDelegate::kNoIndex = static_cast<size_t>(-1); 27 const size_t TranslateInfoBarDelegate::kNoIndex = static_cast<size_t>(-1);
29 28
30 TranslateInfoBarDelegate::~TranslateInfoBarDelegate() { 29 TranslateInfoBarDelegate::~TranslateInfoBarDelegate() {
31 } 30 }
32 31
33 // static 32 // static
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 361
363 void TranslateInfoBarDelegate::InfoBarDismissed() { 362 void TranslateInfoBarDelegate::InfoBarDismissed() {
364 if (infobar_type_ != BEFORE_TRANSLATE) 363 if (infobar_type_ != BEFORE_TRANSLATE)
365 return; 364 return;
366 365
367 // The user closed the infobar without clicking the translate button. 366 // The user closed the infobar without clicking the translate button.
368 TranslationDeclined(); 367 TranslationDeclined();
369 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1); 368 UMA_HISTOGRAM_COUNTS("Translate.DeclineTranslateCloseInfobar", 1);
370 } 369 }
371 370
372 gfx::Image* TranslateInfoBarDelegate::GetIcon() const { 371 int TranslateInfoBarDelegate::GetIconID() const {
373 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 372 return IDR_INFOBAR_TRANSLATE;
374 IDR_INFOBAR_TRANSLATE);
375 } 373 }
376 374
377 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const { 375 InfoBarDelegate::Type TranslateInfoBarDelegate::GetInfoBarType() const {
378 return PAGE_ACTION_TYPE; 376 return PAGE_ACTION_TYPE;
379 } 377 }
380 378
381 TranslateInfoBarDelegate* 379 TranslateInfoBarDelegate*
382 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() { 380 TranslateInfoBarDelegate::AsTranslateInfoBarDelegate() {
383 return this; 381 return this;
384 } 382 }
385 383
386 std::string TranslateInfoBarDelegate::GetPageHost() { 384 std::string TranslateInfoBarDelegate::GetPageHost() {
387 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry(); 385 NavigationEntry* entry = web_contents()->GetController().GetActiveEntry();
388 return entry ? entry->GetURL().HostNoBrackets() : std::string(); 386 return entry ? entry->GetURL().HostNoBrackets() : std::string();
389 } 387 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_infobar_delegate.h ('k') | chrome/browser/ui/auto_login_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698