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

Side by Side Diff: chrome/browser/chromeos/net/tether_notification_presenter.h

Issue 2805393002: TetherNotificationPresenter: Connect to a network when the 'Connect' button is pressed. (Closed)
Patch Set: Remove extra constructor. Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/tether_notification_presenter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_
6 #define CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_ 6 #define CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "chromeos/components/tether/notification_presenter.h" 15 #include "chromeos/components/tether/notification_presenter.h"
16 #include "chromeos/network/network_connect.h"
16 #include "components/cryptauth/remote_device.h" 17 #include "components/cryptauth/remote_device.h"
17 #include "ui/message_center/message_center_observer.h" 18 #include "ui/message_center/message_center_observer.h"
18 #include "ui/message_center/notification.h" 19 #include "ui/message_center/notification.h"
19 20
20 namespace message_center { 21 namespace message_center {
21 class MessageCenter; 22 class MessageCenter;
22 class Notification; 23 class Notification;
23 } // namespace message_center 24 } // namespace message_center
24 25
25 namespace chromeos { 26 namespace chromeos {
26 27
27 namespace tether { 28 namespace tether {
28 29
29 // Produces notifications associated with CrOS tether network events and alerts 30 // Produces notifications associated with CrOS tether network events and alerts
30 // observers about interactions with those notifications. 31 // observers about interactions with those notifications.
31 class TetherNotificationPresenter 32 class TetherNotificationPresenter
32 : public NotificationPresenter, 33 : public NotificationPresenter,
33 public message_center::MessageCenterObserver { 34 public message_center::MessageCenterObserver {
34 public: 35 public:
35 TetherNotificationPresenter(); 36 // Caller must ensure that |message_center| amd |network_connect| outlive
37 // this instance.
38 TetherNotificationPresenter(message_center::MessageCenter* message_center,
39 NetworkConnect* network_connect);
36 ~TetherNotificationPresenter() override; 40 ~TetherNotificationPresenter() override;
37 41
38 // NotificationPresenter: 42 // NotificationPresenter:
39 void NotifyPotentialHotspotNearby( 43 void NotifyPotentialHotspotNearby(
40 const cryptauth::RemoteDevice& remote_device) override; 44 const cryptauth::RemoteDevice& remote_device) override;
41 void NotifyMultiplePotentialHotspotsNearby() override; 45 void NotifyMultiplePotentialHotspotsNearby() override;
42 void RemovePotentialHotspotNotification() override; 46 void RemovePotentialHotspotNotification() override;
43 void NotifyConnectionToHostFailed() override; 47 void NotifyConnectionToHostFailed() override;
44 void RemoveConnectionToHostFailedNotification() override; 48 void RemoveConnectionToHostFailedNotification() override;
45 49
46 // message_center::MessageCenterObserver: 50 // message_center::MessageCenterObserver:
47 void OnNotificationClicked(const std::string& notification_id) override; 51 void OnNotificationClicked(const std::string& notification_id) override;
48 void OnNotificationButtonClicked(const std::string& notification_id, 52 void OnNotificationButtonClicked(const std::string& notification_id,
49 int button_index) override; 53 int button_index) override;
50 54
51 protected:
52 explicit TetherNotificationPresenter(
53 message_center::MessageCenter* message_center);
54
55 private: 55 private:
56 friend class TetherNotificationPresenterTest; 56 friend class TetherNotificationPresenterTest;
57 57
58 static const char kTetherNotifierId[]; 58 static const char kTetherNotifierId[];
59 static const char kPotentialHotspotNotificationId[]; 59 static const char kPotentialHotspotNotificationId[];
60 static const char kActiveHostNotificationId[]; 60 static const char kActiveHostNotificationId[];
61 61
62 static std::unique_ptr<message_center::Notification> CreateNotification( 62 static std::unique_ptr<message_center::Notification> CreateNotification(
63 const std::string& id, 63 const std::string& id,
64 const base::string16& title, 64 const base::string16& title,
65 const base::string16& message); 65 const base::string16& message);
66 static std::unique_ptr<message_center::Notification> CreateNotification( 66 static std::unique_ptr<message_center::Notification> CreateNotification(
67 const std::string& id, 67 const std::string& id,
68 const base::string16& title, 68 const base::string16& title,
69 const base::string16& message, 69 const base::string16& message,
70 const message_center::RichNotificationData rich_notification_data); 70 const message_center::RichNotificationData rich_notification_data);
71 71
72 void ShowNotification( 72 void ShowNotification(
73 std::unique_ptr<message_center::Notification> notification); 73 std::unique_ptr<message_center::Notification> notification);
74 74
75 message_center::MessageCenter* message_center_; 75 message_center::MessageCenter* message_center_;
76 NetworkConnect* network_connect_;
76 77
77 cryptauth::RemoteDevice hotspot_nearby_device_; 78 cryptauth::RemoteDevice hotspot_nearby_device_;
78 base::WeakPtrFactory<TetherNotificationPresenter> weak_ptr_factory_; 79 base::WeakPtrFactory<TetherNotificationPresenter> weak_ptr_factory_;
79 80
80 DISALLOW_COPY_AND_ASSIGN(TetherNotificationPresenter); 81 DISALLOW_COPY_AND_ASSIGN(TetherNotificationPresenter);
81 }; 82 };
82 83
83 } // namespace tether 84 } // namespace tether
84 85
85 } // namespace chromeos 86 } // namespace chromeos
86 87
87 #endif // CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_ 88 #endif // CHROME_BROWSER_CHROMEOS_NET_TETHER_NOTIFICATION_PRESENTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/net/tether_notification_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698