OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SYNC_SYNC_SETUP_FLOW_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 static SyncSetupFlow* Run(ProfileSyncService* service, | 40 static SyncSetupFlow* Run(ProfileSyncService* service, |
41 SyncSetupFlowContainer* container, | 41 SyncSetupFlowContainer* container, |
42 SyncSetupWizard::State start, | 42 SyncSetupWizard::State start, |
43 SyncSetupWizard::State end); | 43 SyncSetupWizard::State end); |
44 | 44 |
45 // Fills |args| with "user" and "error" arguments by querying |service|. | 45 // Fills |args| with "user" and "error" arguments by querying |service|. |
46 static void GetArgsForGaiaLogin( | 46 static void GetArgsForGaiaLogin( |
47 const ProfileSyncService* service, | 47 const ProfileSyncService* service, |
48 DictionaryValue* args); | 48 DictionaryValue* args); |
49 | 49 |
| 50 // Fills |args| with "user" and "error" arguments by querying |service|. |
| 51 static void GetArgsForChooseDataTypes( |
| 52 ProfileSyncService* service, |
| 53 DictionaryValue* args); |
| 54 |
50 // Triggers a state machine transition to advance_state. | 55 // Triggers a state machine transition to advance_state. |
51 void Advance(SyncSetupWizard::State advance_state); | 56 void Advance(SyncSetupWizard::State advance_state); |
52 | 57 |
53 // Focuses the dialog. This is useful in cases where the dialog has been | 58 // Focuses the dialog. This is useful in cases where the dialog has been |
54 // obscured by a browser window. | 59 // obscured by a browser window. |
55 void Focus(); | 60 void Focus(); |
56 | 61 |
57 // HtmlDialogUIDelegate implementation. | 62 // HtmlDialogUIDelegate implementation. |
58 // Get the HTML file path for the content to load in the dialog. | 63 // Get the HTML file path for the content to load in the dialog. |
59 virtual GURL GetDialogContentURL() const { | 64 virtual GURL GetDialogContentURL() const { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 #endif | 125 #endif |
121 } | 126 } |
122 | 127 |
123 | 128 |
124 void OnUserSubmittedAuth(const std::string& username, | 129 void OnUserSubmittedAuth(const std::string& username, |
125 const std::string& password, | 130 const std::string& password, |
126 const std::string& captcha) { | 131 const std::string& captcha) { |
127 service_->OnUserSubmittedAuth(username, password, captcha); | 132 service_->OnUserSubmittedAuth(username, password, captcha); |
128 } | 133 } |
129 | 134 |
| 135 void OnUserChoseDataTypes(bool sync_everything, |
| 136 syncable::ModelTypeSet& chosen_types) { |
| 137 service_->OnUserChoseDatatypes(sync_everything, chosen_types); |
| 138 } |
| 139 |
130 private: | 140 private: |
131 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); | 141 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin); |
| 142 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, ChooseDataTypesSetsPrefs); |
132 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepMergeAndSync); | 143 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepMergeAndSync); |
133 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); | 144 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DialogCancelled); |
134 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); | 145 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InvalidTransitions); |
135 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, FullSuccessfulRunSetsPref); | 146 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, FullSuccessfulRunSetsPref); |
136 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRun); | 147 FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, DiscreteRun); |
137 | 148 |
138 // Use static Run method to get an instance. | 149 // Use static Run method to get an instance. |
139 SyncSetupFlow(SyncSetupWizard::State start_state, | 150 SyncSetupFlow(SyncSetupWizard::State start_state, |
140 SyncSetupWizard::State end_state, | 151 SyncSetupWizard::State end_state, |
141 const std::string& args, SyncSetupFlowContainer* container, | 152 const std::string& args, SyncSetupFlowContainer* container, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 virtual ~FlowHandler() {} | 208 virtual ~FlowHandler() {} |
198 | 209 |
199 // DOMMessageHandler implementation. | 210 // DOMMessageHandler implementation. |
200 virtual void RegisterMessages(); | 211 virtual void RegisterMessages(); |
201 | 212 |
202 // Callbacks from the page. | 213 // Callbacks from the page. |
203 void HandleUserClickedCustomize(const Value* value); | 214 void HandleUserClickedCustomize(const Value* value); |
204 void ClickCustomizeOk(const Value* value); | 215 void ClickCustomizeOk(const Value* value); |
205 void ClickCustomizeCancel(const Value* value); | 216 void ClickCustomizeCancel(const Value* value); |
206 void HandleSubmitAuth(const Value* value); | 217 void HandleSubmitAuth(const Value* value); |
| 218 void HandleChooseDataTypes(const Value* value); |
207 void HandleSubmitMergeAndSync(const Value* value); | 219 void HandleSubmitMergeAndSync(const Value* value); |
208 | 220 |
209 // These functions control which part of the HTML is visible. | 221 // These functions control which part of the HTML is visible. |
210 void ShowGaiaLogin(const DictionaryValue& args); | 222 void ShowGaiaLogin(const DictionaryValue& args); |
211 void ShowGaiaSuccessAndClose(); | 223 void ShowGaiaSuccessAndClose(); |
212 void ShowGaiaSuccessAndSettingUp(); | 224 void ShowGaiaSuccessAndSettingUp(); |
| 225 void ShowChooseDataTypes(const DictionaryValue& args); |
213 void ShowSetupDone(const std::wstring& user); | 226 void ShowSetupDone(const std::wstring& user); |
214 void ShowFirstTimeDone(const std::wstring& user); | 227 void ShowFirstTimeDone(const std::wstring& user); |
215 | 228 |
216 void set_flow(SyncSetupFlow* flow) { | 229 void set_flow(SyncSetupFlow* flow) { |
217 flow_ = flow; | 230 flow_ = flow; |
218 } | 231 } |
219 | 232 |
220 private: | 233 private: |
221 void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, | 234 void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath, |
222 const std::wstring& js); | 235 const std::wstring& js); |
223 SyncSetupFlow* flow_; | 236 SyncSetupFlow* flow_; |
224 DISALLOW_COPY_AND_ASSIGN(FlowHandler); | 237 DISALLOW_COPY_AND_ASSIGN(FlowHandler); |
225 }; | 238 }; |
226 | 239 |
227 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ | 240 #endif // CHROME_BROWSER_SYNC_SYNC_SETUP_FLOW_H_ |
OLD | NEW |