blob: 780c70cfd61898c6f623b7041fca6b7bb9637cb1 [file] [log] [blame]
estade1ec664102015-10-23 20:24:221// Copyright 2012 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/geolocation/geolocation_infobar_delegate_android.h"
6
7#include "chrome/browser/android/android_theme_resources.h"
8#include "chrome/browser/infobars/infobar_service.h"
9#include "chrome/grit/generated_resources.h"
10#include "components/infobars/core/infobar.h"
estade1ec664102015-10-23 20:24:2211#include "grit/generated_resources.h"
estade1ec664102015-10-23 20:24:2212
13// static
estadeb5c6c412015-10-26 19:16:5614infobars::InfoBar* GeolocationInfoBarDelegateAndroid::Create(
estade1ec664102015-10-23 20:24:2215 InfoBarService* infobar_service,
16 const GURL& requesting_frame,
stefanocsa91f52a2016-07-28 03:52:0717 bool user_gesture,
stefanocsa5fb0e42016-07-21 04:24:1618 Profile* profile,
estade1ec664102015-10-23 20:24:2219 const PermissionSetCallback& callback) {
estadeb5c6c412015-10-26 19:16:5620 return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
dcheng4af48582016-04-19 00:29:3521 std::unique_ptr<ConfirmInfoBarDelegate>(
stefanocsa91f52a2016-07-28 03:52:0722 new GeolocationInfoBarDelegateAndroid(requesting_frame, user_gesture,
23 profile, callback))));
estade1ec664102015-10-23 20:24:2224}
25
estadeb5c6c412015-10-26 19:16:5626GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid(
27 const GURL& requesting_frame,
stefanocsa91f52a2016-07-28 03:52:0728 bool user_gesture,
stefanocsa5fb0e42016-07-21 04:24:1629 Profile* profile,
estadeb5c6c412015-10-26 19:16:5630 const PermissionSetCallback& callback)
estade1ec664102015-10-23 20:24:2231 : PermissionInfobarDelegate(requesting_frame,
lshang2a0b8cb2015-12-09 04:59:4932 content::PermissionType::GEOLOCATION,
estade1ec664102015-10-23 20:24:2233 CONTENT_SETTINGS_TYPE_GEOLOCATION,
stefanocsa91f52a2016-07-28 03:52:0734 user_gesture,
stefanocsa5fb0e42016-07-21 04:24:1635 profile,
estade1ec664102015-10-23 20:24:2236 callback),
jshin1fb76462016-04-05 22:13:0337 requesting_frame_(requesting_frame) {}
estade1ec664102015-10-23 20:24:2238
estadeb5c6c412015-10-26 19:16:5639GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {}
estade1ec664102015-10-23 20:24:2240
dfalcantaraac4d93b2015-12-30 20:07:2441infobars::InfoBarDelegate::InfoBarIdentifier
42GeolocationInfoBarDelegateAndroid::GetIdentifier() const {
43 return GEOLOCATION_INFOBAR_DELEGATE_ANDROID;
44}
45
estadeb5c6c412015-10-26 19:16:5646int GeolocationInfoBarDelegateAndroid::GetIconId() const {
estade1ec664102015-10-23 20:24:2247 return IDR_ANDROID_INFOBAR_GEOLOCATION;
48}
49
benwells2337b8102016-04-20 01:53:5350int GeolocationInfoBarDelegateAndroid::GetMessageResourceId() const {
51 return IDS_GEOLOCATION_INFOBAR_QUESTION;
estade1ec664102015-10-23 20:24:2252}