| 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_(false), |
| 15 requires_sync_(false), |
| 16 show_on_most_visited_(false), |
| 17 show_on_open_tabs_(false), |
| 18 show_as_virtual_computer_(false), |
| 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_)) |
| 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 payload_->GetBoolean("promo_requires_mobile_only_sync", |
| 35 &requires_mobile_only_sync_); |
| 36 payload_->GetBoolean("promo_requires_sync", &requires_sync_); |
| 37 payload_->GetBoolean("promo_show_on_most_visited", &show_on_most_visited_); |
| 38 payload_->GetBoolean("promo_show_on_open_tabs", &show_on_open_tabs_); |
| 39 payload_->GetBoolean("promo_show_as_virtual_computer", |
| 40 &show_as_virtual_computer_); |
| 41 payload_->GetString("promo_virtual_computer_title", &virtual_computer_title_); |
| 42 payload_->GetString("promo_virtual_computer_lastsync", |
| 43 &virtual_computer_lastsync_); |
| 44 valid_ = true; |
| 45 } |
| 46 |
| 47 NotificationPromoMobileNtp::~NotificationPromoMobileNtp() {} |
| 48 |
| OLD | NEW |