OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/apps_promo.h" | 5 #include "chrome/browser/extensions/apps_promo.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 // static | 114 // static |
115 GURL AppsPromo::GetPromoLink() { | 115 GURL AppsPromo::GetPromoLink() { |
116 return GURL(GetStringPref(prefs::kNTPWebStorePromoLink, | 116 return GURL(GetStringPref(prefs::kNTPWebStorePromoLink, |
117 "https://chrome.google.com/webstore")); | 117 "https://chrome.google.com/webstore")); |
118 } | 118 } |
119 | 119 |
120 // static | 120 // static |
121 GURL AppsPromo::GetPromoLogo() { | 121 GURL AppsPromo::GetPromoLogo() { |
122 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) { | |
123 PrefService* local_state = g_browser_process->local_state(); | |
124 GURL logo_url(local_state->GetString(prefs::kNTPWebStorePromoLogo)); | |
125 return logo_url; | |
126 } | |
127 | |
128 // TODO(estade): rip this out after ntp4 is default. | |
129 PrefService* local_state = g_browser_process->local_state(); | 122 PrefService* local_state = g_browser_process->local_state(); |
130 GURL logo_url(local_state->GetString(prefs::kNTPWebStorePromoLogo)); | 123 GURL logo_url(local_state->GetString(prefs::kNTPWebStorePromoLogo)); |
131 if (logo_url.is_valid() && logo_url.SchemeIs("data")) | 124 if (logo_url.is_valid() && logo_url.SchemeIs("data")) |
132 return logo_url; | 125 return logo_url; |
133 return GURL(kDefaultPromoLogo); | 126 return GURL(kDefaultPromoLogo); |
134 } | 127 } |
135 | 128 |
136 // static | 129 // static |
137 std::string AppsPromo::GetPromoExpireText() { | 130 std::string AppsPromo::GetPromoExpireText() { |
138 return GetStringPref(prefs::kNTPWebStorePromoExpire, "No thanks."); | 131 return GetStringPref(prefs::kNTPWebStorePromoExpire, "No thanks."); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 bool AppsPromo::GetDefaultAppsInstalled() const { | 282 bool AppsPromo::GetDefaultAppsInstalled() const { |
290 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); | 283 return prefs_->GetBoolean(prefs::kDefaultAppsInstalled); |
291 } | 284 } |
292 | 285 |
293 AppsPromo::UserGroup AppsPromo::GetCurrentUserGroup() const { | 286 AppsPromo::UserGroup AppsPromo::GetCurrentUserGroup() const { |
294 const PrefService::Preference* last_promo_id | 287 const PrefService::Preference* last_promo_id |
295 = prefs_->FindPreference(prefs::kNTPWebStorePromoLastId); | 288 = prefs_->FindPreference(prefs::kNTPWebStorePromoLastId); |
296 CHECK(last_promo_id); | 289 CHECK(last_promo_id); |
297 return last_promo_id->IsDefaultValue() ? USERS_NEW : USERS_EXISTING; | 290 return last_promo_id->IsDefaultValue() ? USERS_NEW : USERS_EXISTING; |
298 } | 291 } |
OLD | NEW |