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..099935ab1631020e3818243c42211ef59a808518 |
| --- /dev/null |
| +++ b/chrome/browser/web_resource/notification_promo_mobile_ntp.cc |
| @@ -0,0 +1,48 @@ |
| +// 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_(false), |
| + requires_sync_(false), |
| + show_on_most_visited_(false), |
| + show_on_open_tabs_(false), |
| + show_as_virtual_computer_(false), |
| + action_args_(NULL), |
| + payload_(NULL) { |
| + payload_ = promo.promo_payload(); |
| + if (!payload_) |
| + return; |
| + if (!payload_->GetString("promo_message_short", &text_)) |
| + return; |
|
achuithb
2012/08/17 22:55:12
Is this right? Are all the fields required? What h
aruslan
2012/08/20 15:36:53
Currently all fields are required: if we bail out
achuithb
2012/08/20 19:17:48
Please file a bug, add a TODO with comments and a
aruslan
2012/08/20 22:38:17
I moved valid_ = true earlier and changed the defa
|
| + 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; |
| + 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_); |
| + valid_ = true; |
| +} |
| + |
| +NotificationPromoMobileNtp::~NotificationPromoMobileNtp() {} |
| + |