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

Issue 8045012: NotificationPromo (Closed)

Created:
9 years, 3 months ago by achuithb
Modified:
9 years, 2 months ago
CC:
chromium-reviews, Paweł Hajdan Jr.
Visibility:
Public.

Description

NotificationPromo. * Split out NotificationPromo helper class for PromoResourceService to handle promo notification. * Support for views/max_views. * NotificationPromo has data members for all the prefs fields (start, end, build, time_slice, max_group, max_views, group, views, text and closed). * Move notification parsing methods from PromoResourceService to NotificationPromo. * NotificationPromo can be initialized from json when the promo resource is parsed, or from prefs, when CanShowNotificationPromo is called. * NotificationPromo now only writes out prefs upon detecting a new notification. * NotificationPromo has a Delegate class, useful for testing. * Static helper methods introduced for extracting time from DictionaryValue, string and prefs. These may be easily unit-tested in the future. * Number of additional tests to more thoroughly test parsing, CanShow logic, and static helper functions like GetNextQuestionValue and NewGroup. * NewGroup now uses RandInt instead of rand(), so this CL passes lint with no complaints. * Some additional cleanup of PromoResourceService, esp GetChannel and IsBuildTargeted. BUG=96290 TEST=Unit tests pass. Use --promo-server-url='http://achuithz600.mtv.corp.google.com/www/files/promoresource2?hl=' to see the promo. If you exceed 5 views, you have to reset the views count (ntp.promo_views) in your Preferences. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=103646

Patch Set 1 #

Patch Set 2 : Integrate PromoNotification into PromoResourceService #

Patch Set 3 : Few more tests + fixes #

Patch Set 4 : TestTime unit test #

Patch Set 5 : chrome_browser.gypi #

Patch Set 6 : '' #

Patch Set 7 : Support for promoNotificationViewed in new_tab.js and handler #

Patch Set 8 : rebase #

Total comments: 15

Patch Set 9 : fix spacing nit #

Total comments: 14

Patch Set 10 : Fixes based on mirandac feedback #

Patch Set 11 : minor #

Total comments: 10

Patch Set 12 : Fixes from jstritar feedback #

Patch Set 13 : Rename PromoNotification->NotificationPromo and promo_notification->notification_promo #

Patch Set 14 : Rename files to notification_promo.[h|cc] #

Unified diffs Side-by-side diffs Delta from patch set Stats (+845 lines, -383 lines) Patch
M chrome/browser/resources/ntp4/new_tab.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/ntp/new_tab_page_handler.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +8 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/ntp/new_tab_page_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +25 lines, -9 lines 0 comments Download
A chrome/browser/web_resource/notification_promo.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +117 lines, -0 lines 0 comments Download
A chrome/browser/web_resource/notification_promo.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +309 lines, -0 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 8 chunks +31 lines, -63 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 8 chunks +25 lines, -250 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +318 lines, -58 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/pref_names.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/pref_names.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
achuithb
Please review. I apologize for the size of the CL.
9 years, 2 months ago (2011-09-26 23:46:30 UTC) #1
Dan Beam
By the way, you might consider changing the hostname to the production one before committing ...
9 years, 2 months ago (2011-09-27 03:27:55 UTC) #2
achuithb
On 2011/09/27 03:27:55, Dan Beam wrote: > By the way, you might consider changing the ...
9 years, 2 months ago (2011-09-27 08:02:17 UTC) #3
achuithb
Thanks for the notes, Dan. http://codereview.chromium.org/8045012/diff/8002/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc File chrome/browser/ui/webui/ntp/new_tab_page_handler.cc (right): http://codereview.chromium.org/8045012/diff/8002/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc#newcode57 chrome/browser/ui/webui/ntp/new_tab_page_handler.cc:57: } The same notification ...
9 years, 2 months ago (2011-09-27 08:03:19 UTC) #4
Miranda Callahan
Thanks, Achuith! http://codereview.chromium.org/8045012/diff/8002/chrome/browser/web_resource/promo_notification.h File chrome/browser/web_resource/promo_notification.h (right): http://codereview.chromium.org/8045012/diff/8002/chrome/browser/web_resource/promo_notification.h#newcode57 chrome/browser/web_resource/promo_notification.h:57: static const int kMaxViews = 1000; Can ...
9 years, 2 months ago (2011-09-27 09:18:40 UTC) #5
achuithb
Thanks for the feedback, Miranda! PTAL. http://codereview.chromium.org/8045012/diff/13001/chrome/browser/web_resource/promo_notification.cc File chrome/browser/web_resource/promo_notification.cc (right): http://codereview.chromium.org/8045012/diff/13001/chrome/browser/web_resource/promo_notification.cc#newcode64 chrome/browser/web_resource/promo_notification.cc:64: bool PromoNotification::OutOfBounds(int var, ...
9 years, 2 months ago (2011-09-28 01:40:13 UTC) #6
Miranda Callahan
thanks -- LGTM! On 2011/09/28 01:40:13, achuith.bhandarkar wrote: > Thanks for the feedback, Miranda! PTAL. ...
9 years, 2 months ago (2011-09-28 07:07:04 UTC) #7
achuithb
Thanks Miranda! Jon - ping?
9 years, 2 months ago (2011-09-28 07:38:13 UTC) #8
jstritar
http://codereview.chromium.org/8045012/diff/13007/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc File chrome/browser/ui/webui/ntp/new_tab_page_handler.cc (right): http://codereview.chromium.org/8045012/diff/13007/chrome/browser/ui/webui/ntp/new_tab_page_handler.cc#newcode50 chrome/browser/ui/webui/ntp/new_tab_page_handler.cc:50: const int max_views = prefs->GetInteger(prefs::kNTPPromoViewsMax); You're accessing PromoNotification's encapsulated ...
9 years, 2 months ago (2011-09-28 15:28:20 UTC) #9
achuithb
Thanks for your feedback Jon! Patchset 12 contains the bulk of the fixes from Jon's ...
9 years, 2 months ago (2011-09-29 02:00:50 UTC) #10
jstritar
LGTM http://codereview.chromium.org/8045012/diff/13007/chrome/browser/web_resource/promo_notification.h File chrome/browser/web_resource/promo_notification.h (right): http://codereview.chromium.org/8045012/diff/13007/chrome/browser/web_resource/promo_notification.h#newcode41 chrome/browser/web_resource/promo_notification.h:41: static void RegisterUserPrefs(PrefService* prefs); On 2011/09/29 02:00:50, achuith.bhandarkar ...
9 years, 2 months ago (2011-09-30 19:57:57 UTC) #11
Dan Beam
rubber stamp, btw, don't let me hold you back from landing this
9 years, 2 months ago (2011-09-30 22:49:04 UTC) #12
achuithb
9 years, 2 months ago (2011-10-01 21:09:06 UTC) #13
Thanks for the reviews Miranda, Jon and Dan. This has landed in T-O-T

Powered by Google App Engine
This is Rietveld 408576698