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

Side by Side Diff: chrome/browser/android/search_geolocation_disclosure_infobar_delegate.cc

Issue 2598443002: Update text in Search Geolocation Disclosure. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/android/search_geolocation_disclosure_infobar_delegate. h" 5 #include "chrome/browser/android/search_geolocation_disclosure_infobar_delegate. h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "chrome/browser/android/android_theme_resources.h" 9 #include "chrome/browser/android/android_theme_resources.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/android/infobars/search_geolocation_disclosure_infob ar.h" 12 #include "chrome/browser/ui/android/infobars/search_geolocation_disclosure_infob ar.h"
13 #include "chrome/common/chrome_features.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
15 #include "components/prefs/pref_service.h" 16 #include "components/prefs/pref_service.h"
17 #include "components/variations/variations_associated_data.h"
16 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
17 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
18 20
21 namespace {
22
23 const char kUseControlTextVariation[] = "UseControlText";
24
25 int ShouldUseControlText() {
26 std::string variation = variations::GetVariationParamValueByFeature(
27 features::kConsistentOmniboxGeolocation, kUseControlTextVariation);
28 return !variation.empty();
29 }
30
31 } // namespace
32
19 // This enum is used in histograms, and is thus append only. Do not remove or 33 // This enum is used in histograms, and is thus append only. Do not remove or
20 // re-order items. 34 // re-order items.
21 enum class SearchGeolocationDisclosureInfoBarDelegate::DisclosureResult { 35 enum class SearchGeolocationDisclosureInfoBarDelegate::DisclosureResult {
22 IGNORED = 0, 36 IGNORED = 0,
23 SETTINGS_CLICKED, 37 SETTINGS_CLICKED,
24 DISMISSED, 38 DISMISSED,
25 COUNT, 39 COUNT,
26 }; 40 };
27 41
28 SearchGeolocationDisclosureInfoBarDelegate:: 42 SearchGeolocationDisclosureInfoBarDelegate::
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 : infobars::InfoBarDelegate(), 92 : infobars::InfoBarDelegate(),
79 search_url_(search_url), 93 search_url_(search_url),
80 result_(DisclosureResult::IGNORED), 94 result_(DisclosureResult::IGNORED),
81 creation_time_(base::Time::Now()) { 95 creation_time_(base::Time::Now()) {
82 pref_service_ = Profile::FromBrowserContext(web_contents->GetBrowserContext()) 96 pref_service_ = Profile::FromBrowserContext(web_contents->GetBrowserContext())
83 ->GetPrefs(); 97 ->GetPrefs();
84 base::string16 link = l10n_util::GetStringUTF16( 98 base::string16 link = l10n_util::GetStringUTF16(
85 IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_SETTINGS_LINK_TEXT); 99 IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_SETTINGS_LINK_TEXT);
86 size_t offset; 100 size_t offset;
87 message_text_ = l10n_util::GetStringFUTF16( 101 message_text_ = l10n_util::GetStringFUTF16(
88 IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_TEXT, link, &offset); 102 ShouldUseControlText()
103 ? IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_CONTROL_TEXT
104 : IDS_SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_TEXT,
105 link, &offset);
89 inline_link_range_ = gfx::Range(offset, offset + link.length()); 106 inline_link_range_ = gfx::Range(offset, offset + link.length());
90 } 107 }
91 108
92 void SearchGeolocationDisclosureInfoBarDelegate::InfoBarDismissed() { 109 void SearchGeolocationDisclosureInfoBarDelegate::InfoBarDismissed() {
93 result_ = DisclosureResult::DISMISSED; 110 result_ = DisclosureResult::DISMISSED;
94 pref_service_->SetBoolean(prefs::kSearchGeolocationDisclosureDismissed, true); 111 pref_service_->SetBoolean(prefs::kSearchGeolocationDisclosureDismissed, true);
95 } 112 }
96 113
97 infobars::InfoBarDelegate::Type 114 infobars::InfoBarDelegate::Type
98 SearchGeolocationDisclosureInfoBarDelegate::GetInfoBarType() const { 115 SearchGeolocationDisclosureInfoBarDelegate::GetInfoBarType() const {
99 return PAGE_ACTION_TYPE; 116 return PAGE_ACTION_TYPE;
100 } 117 }
101 118
102 infobars::InfoBarDelegate::InfoBarIdentifier 119 infobars::InfoBarDelegate::InfoBarIdentifier
103 SearchGeolocationDisclosureInfoBarDelegate::GetIdentifier() const { 120 SearchGeolocationDisclosureInfoBarDelegate::GetIdentifier() const {
104 return SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE; 121 return SEARCH_GEOLOCATION_DISCLOSURE_INFOBAR_DELEGATE;
105 } 122 }
106 123
107 int SearchGeolocationDisclosureInfoBarDelegate::GetIconId() const { 124 int SearchGeolocationDisclosureInfoBarDelegate::GetIconId() const {
108 return IDR_ANDROID_INFOBAR_GEOLOCATION; 125 return IDR_ANDROID_INFOBAR_GEOLOCATION;
109 } 126 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698