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

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

Issue 8520009: Only show G+ promo for users logged into G+ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
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/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/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 base::Unretained(this))); 59 base::Unretained(this)));
60 web_ui()->RegisterMessageCallback("introMessageDismissed", 60 web_ui()->RegisterMessageCallback("introMessageDismissed",
61 base::Bind(&NewTabPageHandler::HandleIntroMessageDismissed, 61 base::Bind(&NewTabPageHandler::HandleIntroMessageDismissed,
62 base::Unretained(this))); 62 base::Unretained(this)));
63 web_ui()->RegisterMessageCallback("introMessageSeen", 63 web_ui()->RegisterMessageCallback("introMessageSeen",
64 base::Bind(&NewTabPageHandler::HandleIntroMessageSeen, 64 base::Bind(&NewTabPageHandler::HandleIntroMessageSeen,
65 base::Unretained(this))); 65 base::Unretained(this)));
66 } 66 }
67 67
68 void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) { 68 void NewTabPageHandler::HandleCloseNotificationPromo(const ListValue* args) {
69 NotificationPromo notification_promo( 69 NotificationPromo* notification_promo = NotificationPromo::Factory(
achuithb 2011/11/27 07:48:26 This is a leak. Could you please use scoped_refptr
Cait (Slow) 2011/11/28 19:06:25 Done.
70 Profile::FromWebUI(web_ui())->GetPrefs(), NULL); 70 Profile::FromWebUI(web_ui()), NULL);
71 notification_promo.HandleClosed(); 71 notification_promo->HandleClosed();
72 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 72 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
73 } 73 }
74 74
75 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) { 75 void NewTabPageHandler::HandleNotificationPromoViewed(const ListValue* args) {
76 NotificationPromo notification_promo( 76 NotificationPromo* notification_promo = NotificationPromo::Factory(
achuithb 2011/11/27 07:48:26 scoped_refptr
Cait (Slow) 2011/11/28 19:06:25 Done.
77 Profile::FromWebUI(web_ui_)->GetPrefs(), NULL); 77 Profile::FromWebUI(web_ui_), NULL);
78 if (notification_promo.HandleViewed()) 78 if (notification_promo->HandleViewed())
79 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED); 79 Notify(chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED);
80 } 80 }
81 81
82 void NewTabPageHandler::HandlePageSelected(const ListValue* args) { 82 void NewTabPageHandler::HandlePageSelected(const ListValue* args) {
83 double page_id_double; 83 double page_id_double;
84 CHECK(args->GetDouble(0, &page_id_double)); 84 CHECK(args->GetDouble(0, &page_id_double));
85 int page_id = static_cast<int>(page_id_double); 85 int page_id = static_cast<int>(page_id_double);
86 86
87 double index_double; 87 double index_double;
88 CHECK(args->GetDouble(1, &index_double)); 88 CHECK(args->GetDouble(1, &index_double));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // is only called during startup before the ntp resource cache is constructed. 173 // is only called during startup before the ntp resource cache is constructed.
174 } 174 }
175 175
176 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) { 176 void NewTabPageHandler::Notify(chrome::NotificationType notification_type) {
177 content::NotificationService* service = 177 content::NotificationService* service =
178 content::NotificationService::current(); 178 content::NotificationService::current();
179 service->Notify(notification_type, 179 service->Notify(notification_type,
180 content::Source<NewTabPageHandler>(this), 180 content::Source<NewTabPageHandler>(this),
181 content::NotificationService::NoDetails()); 181 content::NotificationService::NoDetails());
182 } 182 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/web_resource/notification_promo.h » ('j') | chrome/browser/web_resource/notification_promo.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698