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