summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status/data_promo_notification.h
blob: 5e3c79e31cc3440d7f8cde502009d6d87521d42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// 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.

#ifndef CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_
#define CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_
#pragma once

#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "ui/views/widget/widget.h"

class PrefService;

namespace views {
class View;
}  // namespace views

namespace chromeos {
class MessageBubble;
class MessageBubbleLinkListener;
class NetworkLibrary;

class DataPromoNotification : public views::Widget::Observer {
 public:
  DataPromoNotification();
  virtual ~DataPromoNotification();

  static void RegisterPrefs(PrefService* local_state);

  const std::string& deal_info_url() const { return deal_info_url_; }
  const std::string& deal_topup_url() const { return deal_topup_url_; }

  // Shows 3G promo notification if needed.
  void ShowOptionalMobileDataPromoNotification(
      NetworkLibrary* cros,
      views::View* host,
      MessageBubbleLinkListener* listener);

  // Closes message bubble.
  void CloseNotification();

 private:
  // Overridden from views::Widget::Observer.
  virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;

  // Notification bubble for 3G promo.
  MessageBubble* mobile_data_bubble_;

  // True if check for promo needs to be done,
  // otherwise just ignore it for current session.
  bool check_for_promo_;

  // Current carrier deal info URL.
  std::string deal_info_url_;

  // Current carrier deal top-up URL.
  std::string deal_topup_url_;

  // Factory for delaying showing promo notification.
  base::WeakPtrFactory<DataPromoNotification> weak_ptr_factory_;

  DISALLOW_COPY_AND_ASSIGN(DataPromoNotification);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_STATUS_DATA_PROMO_NOTIFICATION_H_