Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/web_resource/notification_promo_mobile_ntp.h

Issue 10860025: Remove promotion-type-specific JSON handling from NotificationPromo (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #ifndef CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_MOBILE_NTP_H_
6 #define CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_MOBILE_NTP_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "chrome/browser/web_resource/notification_promo.h"
12
13 class Profile;
14
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
18 }
19
20 // Helper class for NotificationPromo that deals with mobile_ntp promos.
21 class NotificationPromoMobileNtp {
22 public:
23 explicit NotificationPromoMobileNtp(Profile* profile_);
24 ~NotificationPromoMobileNtp();
Dan Beam 2012/08/22 19:43:27 nit: if this isn't virtual and just calling the de
aruslan 2012/08/23 00:49:59 Done.
25
26 // Initialize from prefs/JSON.
27 // Return true if the mobile NTP promotion is valid.
28 bool InitFromPrefs();
29 bool InitFromJson(const base::DictionaryValue& json);
30
31 // Return true if the promo is valid and can be shown.
32 bool CanShow() const;
33
34 bool valid() const { return valid_; }
35 const std::string& text() const { return text_; }
36 const std::string& text_long() const { return text_long_; }
37 const std::string& action_type() const { return action_type_; }
38 const base::ListValue* action_args() const { return action_args_; }
39 bool requires_mobile_only_sync() const { return requires_mobile_only_sync_; }
40 bool requires_sync() const { return requires_sync_; }
41 bool show_on_most_visited() const { return show_on_most_visited_; }
42 bool show_on_open_tabs() const { return show_on_open_tabs_; }
43 bool show_as_virtual_computer() const { return show_as_virtual_computer_; }
44 const std::string& virtual_computer_title() const {
45 return virtual_computer_title_;
46 }
47 const std::string& virtual_computer_lastsync() const {
48 return virtual_computer_lastsync_;
49 }
50 const base::DictionaryValue* payload() const { return payload_; }
51 const NotificationPromo& notification_promo() const {
52 return notification_promo_;
53 }
54
55 private:
56 bool InitFromNotificationPromo();
57
Dan Beam 2012/08/22 19:43:27 would it be worthwhile to make this a struct (so y
achuithb 2012/08/22 19:51:50 We could have a nested struct to hold all these va
aruslan 2012/08/23 00:49:59 I like the idea; my attempt to implement it result
Dan Beam 2012/08/23 01:35:57 OK, that's fine. C++ isn't a pretty language.
58 bool valid_;
Dan Beam 2012/08/22 19:43:27 it'd seem to be useful to document any of these (t
aruslan 2012/08/23 00:49:59 Done.
59 std::string text_;
60 std::string text_long_;
61 std::string action_type_;
62 std::string virtual_computer_title_;
63 std::string virtual_computer_lastsync_;
64 bool requires_mobile_only_sync_;
65 bool requires_sync_;
66 bool show_on_most_visited_;
67 bool show_on_open_tabs_;
68 bool show_as_virtual_computer_;
69 const base::ListValue* action_args_;
70 const base::DictionaryValue* payload_;
71 NotificationPromo notification_promo_;
72
73 DISALLOW_COPY_AND_ASSIGN(NotificationPromoMobileNtp);
74 };
75
76 #endif // CHROME_BROWSER_WEB_RESOURCE_NOTIFICATION_PROMO_MOBILE_NTP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698