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

Side by Side Diff: chrome/browser/chromeos/arc/arc_support_host.h

Issue 2534883002: Extract ArcTermsOfServiceNegotiator implementation. (Closed)
Patch Set: Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ARC_ARC_SUPPORT_HOST_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_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/macros.h" 12 #include "base/macros.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h" 14 #include "chrome/browser/chromeos/arc/extensions/arc_support_message_host.h"
14 #include "extensions/browser/api/messaging/native_message_host.h" 15 #include "extensions/browser/api/messaging/native_message_host.h"
15 #include "ui/display/display_observer.h" 16 #include "ui/display/display_observer.h"
16 17
17 class Profile; 18 class Profile;
18 19
19 // Native interface to control ARC support chrome App. 20 // Native interface to control ARC support chrome App.
20 // TODO(hidehiko,lhchavez): Move this into extensions/ directory, and put it 21 // TODO(hidehiko,lhchavez): Move this into extensions/ directory, and put it
(...skipping 23 matching lines...) Expand all
44 45
45 // Observer to notify UI event. 46 // Observer to notify UI event.
46 class Observer { 47 class Observer {
47 public: 48 public:
48 virtual ~Observer() = default; 49 virtual ~Observer() = default;
49 50
50 // Called when the ARC support window is closed. 51 // Called when the ARC support window is closed.
51 virtual void OnWindowClosed() {} 52 virtual void OnWindowClosed() {}
52 53
53 // Called when the user press AGREE button on ToS page. 54 // Called when the user press AGREE button on ToS page.
54 // TODO(hidehiko): Currently, due to implementation reason,
55 // this is also called when RETRY on error page is clicked. Fix this.
hidehiko 2016/11/28 12:42:54 This is obsolete. Removed.
56 virtual void OnTermsAgreed(bool is_metrics_enabled, 55 virtual void OnTermsAgreed(bool is_metrics_enabled,
57 bool is_backup_and_restore_enabled, 56 bool is_backup_and_restore_enabled,
58 bool is_location_service_enabled) {} 57 bool is_location_service_enabled) {}
59 58
60 // Called when LSO auth token fetch is successfully completed. 59 // Called when LSO auth token fetch is successfully completed.
61 virtual void OnAuthSucceeded(const std::string& auth_code) {} 60 virtual void OnAuthSucceeded(const std::string& auth_code) {}
62 61
63 // Called when "RETRY" button on the error page is clicked. 62 // Called when "RETRY" button on the error page is clicked.
64 virtual void OnRetryClicked() {} 63 virtual void OnRetryClicked() {}
65 64
66 // Called when send feedback button on error page is clicked. 65 // Called when send feedback button on error page is clicked.
67 virtual void OnSendFeedbackClicked() {} 66 virtual void OnSendFeedbackClicked() {}
68 }; 67 };
69 68
70 static const char kHostAppId[]; 69 static const char kHostAppId[];
71 static const char kStorageId[]; 70 static const char kStorageId[];
72 71
72 using RequestOpenAppCallback = base::Callback<void(Profile* profile)>;
73
73 explicit ArcSupportHost(Profile* profile); 74 explicit ArcSupportHost(Profile* profile);
74 ~ArcSupportHost() override; 75 ~ArcSupportHost() override;
75 76
76 void AddObserver(Observer* observer); 77 void AddObserver(Observer* observer);
77 void RemoveObserver(Observer* observer); 78 void RemoveObserver(Observer* observer);
78 bool HasObserver(Observer* observer); 79 bool HasObserver(Observer* observer);
79 80
80 // Called when the communication to arc_support Chrome App is ready. 81 // Called when the communication to arc_support Chrome App is ready.
81 void SetMessageHost(arc::ArcSupportMessageHost* message_host); 82 void SetMessageHost(arc::ArcSupportMessageHost* message_host);
82 83
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void OnDisplayAdded(const display::Display& new_display) override; 118 void OnDisplayAdded(const display::Display& new_display) override;
118 void OnDisplayRemoved(const display::Display& old_display) override; 119 void OnDisplayRemoved(const display::Display& old_display) override;
119 void OnDisplayMetricsChanged(const display::Display& display, 120 void OnDisplayMetricsChanged(const display::Display& display,
120 uint32_t changed_metrics) override; 121 uint32_t changed_metrics) override;
121 122
122 // Returns current page that has to be shown in OptIn UI. 123 // Returns current page that has to be shown in OptIn UI.
123 // Note that this can be inconsistent from the actually shown page. 124 // Note that this can be inconsistent from the actually shown page.
124 // TODO(hidehiko): Remove this exposure. 125 // TODO(hidehiko): Remove this exposure.
125 UIPage ui_page() const { return ui_page_; } 126 UIPage ui_page() const { return ui_page_; }
126 127
128 void SetRequestOpenAppCallbackForTest(const RequestOpenAppCallback& callback);
Luis Héctor Chávez 2016/11/29 00:15:28 nit: ...ForTesting
hidehiko 2016/11/29 17:43:28 Done.
129
127 private: 130 private:
128 struct PreferenceCheckboxData { 131 struct PreferenceCheckboxData {
129 PreferenceCheckboxData() : PreferenceCheckboxData(false, false) {} 132 PreferenceCheckboxData() : PreferenceCheckboxData(false, false) {}
130 PreferenceCheckboxData(bool is_enabled, bool is_managed) 133 PreferenceCheckboxData(bool is_enabled, bool is_managed)
131 : is_enabled(is_enabled), is_managed(is_managed) {} 134 : is_enabled(is_enabled), is_managed(is_managed) {}
132 135
133 bool is_enabled; 136 bool is_enabled;
134 bool is_managed; 137 bool is_managed;
135 }; 138 };
136 139
(...skipping 11 matching lines...) Expand all
148 // 'action': action_name, 151 // 'action': action_name,
149 // 'enabled': is_enabled, 152 // 'enabled': is_enabled,
150 // 'managed': is_managed 153 // 'managed': is_managed
151 // } 154 // }
152 void SendPreferenceCheckboxUpdate(const std::string& action_name, 155 void SendPreferenceCheckboxUpdate(const std::string& action_name,
153 const PreferenceCheckboxData& data); 156 const PreferenceCheckboxData& data);
154 157
155 void DisconnectMessageHost(); 158 void DisconnectMessageHost();
156 159
157 Profile* const profile_; 160 Profile* const profile_;
161 RequestOpenAppCallback request_open_app_callback_;
158 162
159 base::ObserverList<Observer> observer_list_; 163 base::ObserverList<Observer> observer_list_;
160 164
161 // True, if ARC support app is requested to start, but the connection is not 165 // True, if ARC support app is requested to start, but the connection is not
162 // yet established. Reset to false, when the app is started and the 166 // yet established. Reset to false, when the app is started and the
163 // connection to the app is established. 167 // connection to the app is established.
164 bool app_start_pending_ = false; 168 bool app_start_pending_ = false;
165 169
166 // The instance is created and managed by Chrome. 170 // The instance is created and managed by Chrome.
167 arc::ArcSupportMessageHost* message_host_ = nullptr; 171 arc::ArcSupportMessageHost* message_host_ = nullptr;
(...skipping 10 matching lines...) Expand all
178 bool is_arc_managed_ = false; 182 bool is_arc_managed_ = false;
179 183
180 PreferenceCheckboxData metrics_checkbox_; 184 PreferenceCheckboxData metrics_checkbox_;
181 PreferenceCheckboxData backup_and_restore_checkbox_; 185 PreferenceCheckboxData backup_and_restore_checkbox_;
182 PreferenceCheckboxData location_services_checkbox_; 186 PreferenceCheckboxData location_services_checkbox_;
183 187
184 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost); 188 DISALLOW_COPY_AND_ASSIGN(ArcSupportHost);
185 }; 189 };
186 190
187 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_ 191 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SUPPORT_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698