Chromium Code Reviews| Index: chrome/browser/web_resource/notification_promo_mobile_ntp.cc |
| diff --git a/chrome/browser/web_resource/notification_promo_mobile_ntp.cc b/chrome/browser/web_resource/notification_promo_mobile_ntp.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..17cf0bd63ab602aeb6c87f8edffdb89aee3e47dd |
| --- /dev/null |
| +++ b/chrome/browser/web_resource/notification_promo_mobile_ntp.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/web_resource/notification_promo_mobile_ntp.h" |
| + |
| +#include "base/logging.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/web_resource/notification_promo.h" |
| + |
| +NotificationPromoMobileNtp::NotificationPromoMobileNtp( |
| + const NotificationPromo& promo) |
| + : valid_(false), |
| + requires_mobile_only_sync_(true), |
| + requires_sync_(true), |
| + show_on_most_visited_(false), |
| + show_on_open_tabs_(true), |
| + show_as_virtual_computer_(true), |
| + action_args_(NULL), |
| + payload_(NULL) { |
| + payload_ = promo.promo_payload(); |
| + if (!payload_) |
| + return; |
| + 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.
|
| + return; |
| + if (!payload_->GetString("promo_message_long", &text_long_)) |
| + return; |
| + if (!payload_->GetString("promo_action_type", &action_type_)) |
| + return; |
| + if (!payload_->GetList("promo_action_args", &action_args_)) |
| + return; |
| + if (!action_args_) |
| + return; |
| + // All the fields above are required. |
| + // All the fields below are optional and used to override the defaults. |
| + 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.
|
| + payload_->GetBoolean("promo_requires_mobile_only_sync", |
| + &requires_mobile_only_sync_); |
| + payload_->GetBoolean("promo_requires_sync", &requires_sync_); |
| + payload_->GetBoolean("promo_show_on_most_visited", &show_on_most_visited_); |
| + payload_->GetBoolean("promo_show_on_open_tabs", &show_on_open_tabs_); |
| + payload_->GetBoolean("promo_show_as_virtual_computer", |
| + &show_as_virtual_computer_); |
| + payload_->GetString("promo_virtual_computer_title", &virtual_computer_title_); |
| + payload_->GetString("promo_virtual_computer_lastsync", |
| + &virtual_computer_lastsync_); |
| +} |
| + |
| +NotificationPromoMobileNtp::~NotificationPromoMobileNtp() {} |
| + |