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