OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #include "chrome/browser/android/search_geolocation_disclosure_infobar_delegate.
h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/android/android_theme_resources.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/ui/android/infobars/search_geolocation_disclosure_infob
ar.h" |
| 11 #include "chrome/grit/generated_resources.h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 #include "ui/base/l10n/l10n_util.h" |
| 14 |
| 15 SearchGeolocationDisclosureInfoBarDelegate:: |
| 16 ~SearchGeolocationDisclosureInfoBarDelegate() {} |
| 17 |
| 18 // static |
| 19 void SearchGeolocationDisclosureInfoBarDelegate::Create( |
| 20 content::WebContents* web_contents) { |
| 21 InfoBarService* infobar_service = |
| 22 InfoBarService::FromWebContents(web_contents); |
| 23 // Add the new delegate. |
| 24 infobar_service->AddInfoBar( |
| 25 base::MakeUnique<SearchGeolocationDisclosureInfoBar>( |
| 26 base::WrapUnique(new SearchGeolocationDisclosureInfoBarDelegate()))); |
| 27 } |
| 28 |
| 29 base::string16 SearchGeolocationDisclosureInfoBarDelegate::GetMessageText() |
| 30 const { |
| 31 return l10n_util::GetStringUTF16( |
| 32 IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_TEXT); |
| 33 }; |
| 34 |
| 35 SearchGeolocationDisclosureInfoBarDelegate:: |
| 36 SearchGeolocationDisclosureInfoBarDelegate() |
| 37 : infobars::InfoBarDelegate() {} |
| 38 |
| 39 infobars::InfoBarDelegate::Type |
| 40 SearchGeolocationDisclosureInfoBarDelegate::GetInfoBarType() const { |
| 41 return PAGE_ACTION_TYPE; |
| 42 } |
| 43 |
| 44 infobars::InfoBarDelegate::InfoBarIdentifier |
| 45 SearchGeolocationDisclosureInfoBarDelegate::GetIdentifier() const { |
| 46 return SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE; |
| 47 } |
| 48 |
| 49 int SearchGeolocationDisclosureInfoBarDelegate::GetIconId() const { |
| 50 return IDR_ANDROID_INFOBAR_GEOLOCATION; |
| 51 } |
OLD | NEW |