OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/sync/sync_setup_flow.h" | 5 #include "chrome/browser/sync/sync_setup_flow.h" |
6 | 6 |
7 #include "app/gfx/font_util.h" | 7 #include "app/gfx/font_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 return false; | 99 return false; |
100 if (sync_autofill) | 100 if (sync_autofill) |
101 data_types->insert(syncable::AUTOFILL); | 101 data_types->insert(syncable::AUTOFILL); |
102 | 102 |
103 bool sync_extensions; | 103 bool sync_extensions; |
104 if (!result->GetBoolean("syncExtensions", &sync_extensions)) | 104 if (!result->GetBoolean("syncExtensions", &sync_extensions)) |
105 return false; | 105 return false; |
106 if (sync_extensions) | 106 if (sync_extensions) |
107 data_types->insert(syncable::EXTENSIONS); | 107 data_types->insert(syncable::EXTENSIONS); |
108 | 108 |
109 bool sync_sessions; | |
110 if (!result->GetBoolean("syncSessions", &sync_sessions)) | |
111 return false; | |
112 if (sync_sessions) | |
113 data_types->insert(syncable::SESSIONS); | |
114 | |
115 bool sync_typed_urls; | 109 bool sync_typed_urls; |
116 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) | 110 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) |
117 return false; | 111 return false; |
118 if (sync_typed_urls) | 112 if (sync_typed_urls) |
119 data_types->insert(syncable::TYPED_URLS); | 113 data_types->insert(syncable::TYPED_URLS); |
120 | 114 |
121 bool sync_apps; | 115 bool sync_apps; |
122 if (!result->GetBoolean("syncApps", &sync_apps)) | 116 if (!result->GetBoolean("syncApps", &sync_apps)) |
123 return false; | 117 return false; |
124 if (sync_apps) | 118 if (sync_apps) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); | 181 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); |
188 } | 182 } |
189 | 183 |
190 void FlowHandler::ShowGaiaSuccessAndSettingUp() { | 184 void FlowHandler::ShowGaiaSuccessAndSettingUp() { |
191 ExecuteJavascriptInIFrame(kLoginIFrameXPath, | 185 ExecuteJavascriptInIFrame(kLoginIFrameXPath, |
192 L"showGaiaSuccessAndSettingUp();"); | 186 L"showGaiaSuccessAndSettingUp();"); |
193 } | 187 } |
194 | 188 |
195 // Called by SyncSetupFlow::Advance. | 189 // Called by SyncSetupFlow::Advance. |
196 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) { | 190 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) { |
| 191 |
197 // If you're starting the wizard at the Choose Data Types screen (i.e. from | 192 // If you're starting the wizard at the Choose Data Types screen (i.e. from |
198 // "Customize Sync"), this will be redundant. However, if you're coming from | 193 // "Customize Sync"), this will be redundant. However, if you're coming from |
199 // another wizard state, this will make sure Choose Data Types is on top. | 194 // another wizard state, this will make sure Choose Data Types is on top. |
200 if (dom_ui_) | 195 if (dom_ui_) |
201 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes"); | 196 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes"); |
202 | 197 |
203 std::string json; | 198 std::string json; |
204 base::JSONWriter::Write(&args, false, &json); | 199 base::JSONWriter::Write(&args, false, &json); |
205 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") + | 200 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") + |
206 L"(" + UTF8ToWide(json) + L");"; | 201 L"(" + UTF8ToWide(json) + L");"; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 args->SetBoolean("passwordsRegistered", | 354 args->SetBoolean("passwordsRegistered", |
360 registered_types.count(syncable::PASSWORDS) > 0); | 355 registered_types.count(syncable::PASSWORDS) > 0); |
361 args->SetBoolean("autofillRegistered", | 356 args->SetBoolean("autofillRegistered", |
362 registered_types.count(syncable::AUTOFILL) > 0); | 357 registered_types.count(syncable::AUTOFILL) > 0); |
363 args->SetBoolean("extensionsRegistered", | 358 args->SetBoolean("extensionsRegistered", |
364 registered_types.count(syncable::EXTENSIONS) > 0); | 359 registered_types.count(syncable::EXTENSIONS) > 0); |
365 args->SetBoolean("typedUrlsRegistered", | 360 args->SetBoolean("typedUrlsRegistered", |
366 registered_types.count(syncable::TYPED_URLS) > 0); | 361 registered_types.count(syncable::TYPED_URLS) > 0); |
367 args->SetBoolean("appsRegistered", | 362 args->SetBoolean("appsRegistered", |
368 registered_types.count(syncable::APPS) > 0); | 363 registered_types.count(syncable::APPS) > 0); |
369 args->SetBoolean("sessionsRegistered", | 364 |
370 registered_types.count(syncable::SESSIONS) > 0); | |
371 args->SetBoolean("syncBookmarks", | 365 args->SetBoolean("syncBookmarks", |
372 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); | 366 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); |
373 args->SetBoolean("syncPreferences", | 367 args->SetBoolean("syncPreferences", |
374 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences)); | 368 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences)); |
375 args->SetBoolean("syncThemes", | 369 args->SetBoolean("syncThemes", |
376 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes)); | 370 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes)); |
377 args->SetBoolean("syncPasswords", | 371 args->SetBoolean("syncPasswords", |
378 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords)); | 372 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords)); |
379 args->SetBoolean("syncAutofill", | 373 args->SetBoolean("syncAutofill", |
380 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); | 374 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); |
381 args->SetBoolean("syncExtensions", | 375 args->SetBoolean("syncExtensions", |
382 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); | 376 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); |
383 args->SetBoolean("syncSessions", | |
384 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions)); | |
385 args->SetBoolean("syncTypedUrls", | 377 args->SetBoolean("syncTypedUrls", |
386 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); | 378 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); |
387 args->SetBoolean("syncApps", | 379 args->SetBoolean("syncApps", |
388 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); | 380 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); |
389 } | 381 } |
390 | 382 |
391 void SyncSetupFlow::GetDOMMessageHandlers( | 383 void SyncSetupFlow::GetDOMMessageHandlers( |
392 std::vector<DOMMessageHandler*>* handlers) const { | 384 std::vector<DOMMessageHandler*>* handlers) const { |
393 handlers->push_back(flow_handler_); | 385 handlers->push_back(flow_handler_); |
394 // We don't own flow_handler_ anymore, but it sticks around until at least | 386 // We don't own flow_handler_ anymore, but it sticks around until at least |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 Browser* b = BrowserList::GetLastActive(); | 506 Browser* b = BrowserList::GetLastActive(); |
515 if (b) { | 507 if (b) { |
516 b->BrowserShowHtmlDialog(flow, parent_window); | 508 b->BrowserShowHtmlDialog(flow, parent_window); |
517 } else { | 509 } else { |
518 delete flow; | 510 delete flow; |
519 return NULL; | 511 return NULL; |
520 } | 512 } |
521 #endif // defined(OS_MACOSX) | 513 #endif // defined(OS_MACOSX) |
522 return flow; | 514 return flow; |
523 } | 515 } |
OLD | NEW |