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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.cc

Issue 10496008: Purge legacy notification promo code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/web_resource/notification_promo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/ntp/new_tab_page_handler.h" 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 base::Unretained(this))); 68 base::Unretained(this)));
69 web_ui()->RegisterMessageCallback("introMessageDismissed", 69 web_ui()->RegisterMessageCallback("introMessageDismissed",
70 base::Bind(&NewTabPageHandler::HandleIntroMessageDismissed, 70 base::Bind(&NewTabPageHandler::HandleIntroMessageDismissed,
71 base::Unretained(this))); 71 base::Unretained(this)));
72 web_ui()->RegisterMessageCallback("introMessageSeen", 72 web_ui()->RegisterMessageCallback("introMessageSeen",
73 base::Bind(&NewTabPageHandler::HandleIntroMessageSeen, 73 base::Bind(&NewTabPageHandler::HandleIntroMessageSeen,
74 base::Unretained(this))); 74 base::Unretained(this)));
75 } 75 }
76 76
77 void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) { 77 void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) {
78 scoped_refptr<NotificationPromo> notification_promo = 78 NotificationPromo notification_promo(Profile::FromWebUI(web_ui()));
79 NotificationPromo::Create(Profile::FromWebUI(web_ui()), NULL); 79 notification_promo.HandleClosed();
80 notification_promo->HandleClosed();
81 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 80 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
82 } 81 }
83 82
84 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) { 83 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) {
85 scoped_refptr<NotificationPromo> notification_promo = 84 NotificationPromo notification_promo(Profile::FromWebUI(web_ui()));
86 NotificationPromo::Create(Profile::FromWebUI(web_ui()), NULL); 85 if (notification_promo.HandleViewed())
87 if (notification_promo->HandleViewed())
88 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 86 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
89 } 87 }
90 88
91 void NewTabPageHandler::HandlePageSelected(const ListValue* args) { 89 void NewTabPageHandler::HandlePageSelected(const ListValue* args) {
92 page_switch_count_++; 90 page_switch_count_++;
93 91
94 double page_id_double; 92 double page_id_double;
95 CHECK(args->GetDouble(0, &page_id_double)); 93 CHECK(args->GetDouble(0, &page_id_double));
96 int page_id = static_cast<int>(page_id_double); 94 int page_id = static_cast<int>(page_id_double);
97 95
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // is only called during startup before the ntp resource cache is constructed. 186 // is only called during startup before the ntp resource cache is constructed.
189 } 187 }
190 188
191 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 189 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
192 content::NotificationService* service = 190 content::NotificationService* service =
193 content::NotificationService::current(); 191 content::NotificationService::current();
194 service->Notify(notification_type, 192 service->Notify(notification_type,
195 content::Source<NewTabPageHandler>(this), 193 content::Source<NewTabPageHandler>(this),
196 content::NotificationService::NoDetails()); 194 content::NotificationService::NoDetails());
197 } 195 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/web_resource/notification_promo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698