OLD | NEW |
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/android/promo_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/android/promo_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 base::Unretained(this))); | 114 base::Unretained(this))); |
115 web_ui()->RegisterMessageCallback("promoActionTriggered", | 115 web_ui()->RegisterMessageCallback("promoActionTriggered", |
116 base::Bind(&PromoHandler::HandlePromoActionTriggered, | 116 base::Bind(&PromoHandler::HandlePromoActionTriggered, |
117 base::Unretained(this))); | 117 base::Unretained(this))); |
118 web_ui()->RegisterMessageCallback("promoDisabled", | 118 web_ui()->RegisterMessageCallback("promoDisabled", |
119 base::Bind(&PromoHandler::HandlePromoDisabled, | 119 base::Bind(&PromoHandler::HandlePromoDisabled, |
120 base::Unretained(this))); | 120 base::Unretained(this))); |
121 } | 121 } |
122 | 122 |
123 // static | 123 // static |
124 void PromoHandler::RegisterUserPrefs(PrefService* prefs) { | 124 void PromoHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
125 prefs->RegisterBooleanPref(prefs::kNtpPromoDesktopSessionFound, | 125 prefs->RegisterBooleanPref(prefs::kNtpPromoDesktopSessionFound, |
126 false, | 126 false, |
127 PrefService::UNSYNCABLE_PREF); | 127 PrefServiceSyncable::UNSYNCABLE_PREF); |
128 } | 128 } |
129 | 129 |
130 void PromoHandler::Observe(int type, | 130 void PromoHandler::Observe(int type, |
131 const content::NotificationSource& source, | 131 const content::NotificationSource& source, |
132 const content::NotificationDetails& details) { | 132 const content::NotificationDetails& details) { |
133 if (chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type || | 133 if (chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type || |
134 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE == type || | 134 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE == type || |
135 chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED == type) { | 135 chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED == type) { |
136 // A change occurred to one of the preferences we care about | 136 // A change occurred to one of the preferences we care about |
137 CheckDesktopSessions(); | 137 CheckDesktopSessions(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 sessions[i]->device_type; | 330 sessions[i]->device_type; |
331 if (device_type == browser_sync::SyncedSession::TYPE_WIN || | 331 if (device_type == browser_sync::SyncedSession::TYPE_WIN || |
332 device_type == browser_sync::SyncedSession::TYPE_MACOSX || | 332 device_type == browser_sync::SyncedSession::TYPE_MACOSX || |
333 device_type == browser_sync::SyncedSession::TYPE_LINUX) { | 333 device_type == browser_sync::SyncedSession::TYPE_LINUX) { |
334 // Found a desktop session: write out the pref. | 334 // Found a desktop session: write out the pref. |
335 prefs->SetBoolean(prefs::kNtpPromoDesktopSessionFound, true); | 335 prefs->SetBoolean(prefs::kNtpPromoDesktopSessionFound, true); |
336 return; | 336 return; |
337 } | 337 } |
338 } | 338 } |
339 } | 339 } |
OLD | NEW |