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 base::string16 SearchGeolocationDisclosureInfoBarDelegate::GetMessageText() |
| 19 const { |
| 20 return l10n_util::GetStringUTF16( |
| 21 IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_TEXT); |
| 22 }; |
| 23 |
| 24 // static |
| 25 void SearchGeolocationDisclosureInfoBarDelegate::Create( |
| 26 content::WebContents* web_contents) { |
| 27 InfoBarService* infobar_service = |
| 28 InfoBarService::FromWebContents(web_contents); |
| 29 // Add the new delegate. |
| 30 std::unique_ptr<infobars::InfoBar> infobar( |
| 31 new SearchGeolocationDisclosureInfoBar( |
| 32 base::WrapUnique(new SearchGeolocationDisclosureInfoBarDelegate()))); |
| 33 infobar_service->AddInfoBar(std::move(infobar)); |
| 34 } |
| 35 |
| 36 SearchGeolocationDisclosureInfoBarDelegate:: |
| 37 SearchGeolocationDisclosureInfoBarDelegate() |
| 38 : infobars::InfoBarDelegate() {} |
| 39 |
| 40 infobars::InfoBarDelegate::Type |
| 41 SearchGeolocationDisclosureInfoBarDelegate::GetInfoBarType() const { |
| 42 return PAGE_ACTION_TYPE; |
| 43 } |
| 44 |
| 45 infobars::InfoBarDelegate::InfoBarIdentifier |
| 46 SearchGeolocationDisclosureInfoBarDelegate::GetIdentifier() const { |
| 47 return SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE; |
| 48 } |
| 49 |
| 50 int SearchGeolocationDisclosureInfoBarDelegate::GetIconId() const { |
| 51 return IDR_ANDROID_INFOBAR_GEOLOCATION; |
| 52 } |
| 53 |
| 54 SearchGeolocationDisclosureInfoBarDelegate* |
| 55 SearchGeolocationDisclosureInfoBarDelegate:: |
| 56 AsSearchGeolocationDisclosureInfoBarDelegate() { |
| 57 return this; |
| 58 } |
OLD | NEW |