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

Side by Side Diff: ios/chrome/browser/ui/ntp/notification_promo_whats_new.mm

Issue 2805443007: Remove unnecessary promo_type_ field from notification_promo.h/.cc. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 #import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" 5 #import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 InjectFakePromo("4", "IDS_IOS_MOVE_TO_DOCK_TIP", "url", "", 88 InjectFakePromo("4", "IDS_IOS_MOVE_TO_DOCK_TIP", "url", "",
89 "https://support.google.com/chrome/?p=iphone_dock", 89 "https://support.google.com/chrome/?p=iphone_dock",
90 "MoveToDockTipPromo", "logoWithRoundedRectangle"); 90 "MoveToDockTipPromo", "logoWithRoundedRectangle");
91 break; 91 break;
92 default: 92 default:
93 NOTREACHED(); 93 NOTREACHED();
94 break; 94 break;
95 } 95 }
96 } 96 }
97 97
98 notification_promo_.InitFromPrefs( 98 notification_promo_.InitFromPrefs();
99 ios::NotificationPromo::MOBILE_NTP_WHATS_NEW_PROMO);
100 return InitFromNotificationPromo(); 99 return InitFromNotificationPromo();
101 } 100 }
102 101
103 bool NotificationPromoWhatsNew::ClearAndInitFromJson( 102 bool NotificationPromoWhatsNew::ClearAndInitFromJson(
104 const base::DictionaryValue& json) { 103 const base::DictionaryValue& json) {
105 // This clears away old promos. 104 // This clears away old promos.
106 notification_promo_.MigrateUserPrefs(local_state_); 105 notification_promo_.MigrateUserPrefs(local_state_);
107 106
108 notification_promo_.InitFromJson( 107 notification_promo_.InitFromJson(json);
109 json, ios::NotificationPromo::MOBILE_NTP_WHATS_NEW_PROMO);
110 return InitFromNotificationPromo(); 108 return InitFromNotificationPromo();
111 } 109 }
112 110
113 bool NotificationPromoWhatsNew::CanShow() const { 111 bool NotificationPromoWhatsNew::CanShow() const {
114 if (!valid_ || !notification_promo_.CanShow()) { 112 if (!valid_ || !notification_promo_.CanShow()) {
115 return false; 113 return false;
116 } 114 }
117 115
118 // Check optional restrictions. 116 // Check optional restrictions.
119 117
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 " \"max_seconds\":259200," 267 " \"max_seconds\":259200,"
270 " \"promo_id\":$7" 268 " \"promo_id\":$7"
271 "}"; 269 "}";
272 std::string promo_json_filled_in = 270 std::string promo_json_filled_in =
273 base::ReplaceStringPlaceholders(promo_json, replacements, NULL); 271 base::ReplaceStringPlaceholders(promo_json, replacements, NULL);
274 272
275 std::unique_ptr<base::Value> value( 273 std::unique_ptr<base::Value> value(
276 base::JSONReader::Read(promo_json_filled_in)); 274 base::JSONReader::Read(promo_json_filled_in));
277 base::DictionaryValue* dict = NULL; 275 base::DictionaryValue* dict = NULL;
278 if (value->GetAsDictionary(&dict)) { 276 if (value->GetAsDictionary(&dict)) {
279 notification_promo_.InitFromJson( 277 notification_promo_.InitFromJson(*dict);
280 *dict, ios::NotificationPromo::MOBILE_NTP_WHATS_NEW_PROMO);
281 } 278 }
282 } 279 }
OLDNEW
« ios/chrome/browser/notification_promo.cc ('K') | « ios/chrome/browser/notification_promo_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698