Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/web_resource/notification_promo_mobile_ntp.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/values.h" | |
| 9 #include "chrome/browser/web_resource/notification_promo.h" | |
| 10 | |
| 11 NotificationPromoMobileNtp::NotificationPromoMobileNtp( | |
| 12 const NotificationPromo& promo) | |
| 13 : valid_(false), | |
| 14 requires_mobile_only_sync_(true), | |
| 15 requires_sync_(true), | |
| 16 show_on_most_visited_(false), | |
| 17 show_on_open_tabs_(true), | |
| 18 show_as_virtual_computer_(true), | |
| 19 action_args_(NULL), | |
| 20 payload_(NULL) { | |
| 21 payload_ = promo.promo_payload(); | |
| 22 if (!payload_) | |
| 23 return; | |
| 24 if (!payload_->GetString("promo_message_short", &text_)) | |
|
Dan Beam
2012/08/21 03:53:49
you could probably combine these together, i.e.
aruslan
2012/08/21 15:57:55
Done.
| |
| 25 return; | |
| 26 if (!payload_->GetString("promo_message_long", &text_long_)) | |
| 27 return; | |
| 28 if (!payload_->GetString("promo_action_type", &action_type_)) | |
| 29 return; | |
| 30 if (!payload_->GetList("promo_action_args", &action_args_)) | |
| 31 return; | |
| 32 if (!action_args_) | |
| 33 return; | |
| 34 // All the fields above are required. | |
| 35 // All the fields below are optional and used to override the defaults. | |
| 36 valid_ = true; | |
|
Dan Beam
2012/08/21 03:53:49
nit: you're allowed to use \n's you know, ;)
aruslan
2012/08/21 15:57:55
Done.
| |
| 37 payload_->GetBoolean("promo_requires_mobile_only_sync", | |
| 38 &requires_mobile_only_sync_); | |
| 39 payload_->GetBoolean("promo_requires_sync", &requires_sync_); | |
| 40 payload_->GetBoolean("promo_show_on_most_visited", &show_on_most_visited_); | |
| 41 payload_->GetBoolean("promo_show_on_open_tabs", &show_on_open_tabs_); | |
| 42 payload_->GetBoolean("promo_show_as_virtual_computer", | |
| 43 &show_as_virtual_computer_); | |
| 44 payload_->GetString("promo_virtual_computer_title", &virtual_computer_title_); | |
| 45 payload_->GetString("promo_virtual_computer_lastsync", | |
| 46 &virtual_computer_lastsync_); | |
| 47 } | |
| 48 | |
| 49 NotificationPromoMobileNtp::~NotificationPromoMobileNtp() {} | |
| 50 | |
| OLD | NEW |