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

Side by Side Diff: chrome/browser/geolocation/geolocation_infobar_delegate_android.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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/geolocation/geolocation_infobar_delegate_android.h" 5 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/android/google_location_settings_helper.h" 8 #include "chrome/browser/android/google_location_settings_helper.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "grit/locale_settings.h" 10 #include "grit/locale_settings.h"
11 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 13
14 GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid( 14 GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid(
15 InfoBarService* infobar_service,
16 PermissionQueueController* controller, 15 PermissionQueueController* controller,
17 const PermissionRequestID& id, 16 const PermissionRequestID& id,
18 const GURL& requesting_frame_url, 17 const GURL& requesting_frame_url,
19 int contents_unique_id, 18 int contents_unique_id,
20 const std::string& display_languages) 19 const std::string& display_languages)
21 : GeolocationInfoBarDelegate(infobar_service, controller, id, 20 : GeolocationInfoBarDelegate(controller, id, requesting_frame_url,
22 requesting_frame_url, contents_unique_id, 21 contents_unique_id, display_languages),
23 display_languages),
24 google_location_settings_helper_( 22 google_location_settings_helper_(
25 GoogleLocationSettingsHelper::Create()) { 23 GoogleLocationSettingsHelper::Create()) {
26 } 24 }
27 25
28 GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() { 26 GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {
29 } 27 }
30 28
31 bool GeolocationInfoBarDelegateAndroid::Accept() { 29 bool GeolocationInfoBarDelegateAndroid::Accept() {
32 // Accept button text could be either 'Allow' or 'Google Location Settings'. 30 // Accept button text could be either 'Allow' or 'Google Location Settings'.
33 // If 'Allow' we follow the regular flow. 31 // If 'Allow' we follow the regular flow.
34 if (google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled()) 32 if (google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled())
35 return GeolocationInfoBarDelegate::Accept(); 33 return GeolocationInfoBarDelegate::Accept();
36 34
37 // If 'Google Location Settings', we need to open the system Google Location 35 // If 'Google Location Settings', we need to open the system Google Location
38 // Settings activity. 36 // Settings activity.
39 google_location_settings_helper_->ShowGoogleLocationSettings(); 37 google_location_settings_helper_->ShowGoogleLocationSettings();
40 SetPermission(false, false); 38 SetPermission(false, false);
41 return true; 39 return true;
42 } 40 }
43 41
44 string16 GeolocationInfoBarDelegateAndroid::GetButtonLabel( 42 string16 GeolocationInfoBarDelegateAndroid::GetButtonLabel(
45 InfoBarButton button) const { 43 InfoBarButton button) const {
46 return (button == BUTTON_OK) ? 44 return (button == BUTTON_OK) ?
47 UTF8ToUTF16(google_location_settings_helper_->GetAcceptButtonLabel()) : 45 UTF8ToUTF16(google_location_settings_helper_->GetAcceptButtonLabel()) :
48 l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON); 46 l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON);
49 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698