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

Side by Side Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 3133022: sync: take two for: "Added classes to enable session sync... (Closed)
Patch Set: Created 10 years, 4 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
OLDNEW
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
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
109 bool sync_typed_urls; 115 bool sync_typed_urls;
110 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls)) 116 if (!result->GetBoolean("syncTypedUrls", &sync_typed_urls))
111 return false; 117 return false;
112 if (sync_typed_urls) 118 if (sync_typed_urls)
113 data_types->insert(syncable::TYPED_URLS); 119 data_types->insert(syncable::TYPED_URLS);
114 120
115 bool sync_apps; 121 bool sync_apps;
116 if (!result->GetBoolean("syncApps", &sync_apps)) 122 if (!result->GetBoolean("syncApps", &sync_apps))
117 return false; 123 return false;
118 if (sync_apps) 124 if (sync_apps)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); 187 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();");
182 } 188 }
183 189
184 void FlowHandler::ShowGaiaSuccessAndSettingUp() { 190 void FlowHandler::ShowGaiaSuccessAndSettingUp() {
185 ExecuteJavascriptInIFrame(kLoginIFrameXPath, 191 ExecuteJavascriptInIFrame(kLoginIFrameXPath,
186 L"showGaiaSuccessAndSettingUp();"); 192 L"showGaiaSuccessAndSettingUp();");
187 } 193 }
188 194
189 // Called by SyncSetupFlow::Advance. 195 // Called by SyncSetupFlow::Advance.
190 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) { 196 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) {
191
192 // If you're starting the wizard at the Choose Data Types screen (i.e. from 197 // If you're starting the wizard at the Choose Data Types screen (i.e. from
193 // "Customize Sync"), this will be redundant. However, if you're coming from 198 // "Customize Sync"), this will be redundant. However, if you're coming from
194 // another wizard state, this will make sure Choose Data Types is on top. 199 // another wizard state, this will make sure Choose Data Types is on top.
195 if (dom_ui_) 200 if (dom_ui_)
196 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes"); 201 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes");
197 202
198 std::string json; 203 std::string json;
199 base::JSONWriter::Write(&args, false, &json); 204 base::JSONWriter::Write(&args, false, &json);
200 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") + 205 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") +
201 L"(" + UTF8ToWide(json) + L");"; 206 L"(" + UTF8ToWide(json) + L");";
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 args->SetBoolean("passwordsRegistered", 359 args->SetBoolean("passwordsRegistered",
355 registered_types.count(syncable::PASSWORDS) > 0); 360 registered_types.count(syncable::PASSWORDS) > 0);
356 args->SetBoolean("autofillRegistered", 361 args->SetBoolean("autofillRegistered",
357 registered_types.count(syncable::AUTOFILL) > 0); 362 registered_types.count(syncable::AUTOFILL) > 0);
358 args->SetBoolean("extensionsRegistered", 363 args->SetBoolean("extensionsRegistered",
359 registered_types.count(syncable::EXTENSIONS) > 0); 364 registered_types.count(syncable::EXTENSIONS) > 0);
360 args->SetBoolean("typedUrlsRegistered", 365 args->SetBoolean("typedUrlsRegistered",
361 registered_types.count(syncable::TYPED_URLS) > 0); 366 registered_types.count(syncable::TYPED_URLS) > 0);
362 args->SetBoolean("appsRegistered", 367 args->SetBoolean("appsRegistered",
363 registered_types.count(syncable::APPS) > 0); 368 registered_types.count(syncable::APPS) > 0);
364 369 args->SetBoolean("sessionsRegistered",
370 registered_types.count(syncable::SESSIONS) > 0);
365 args->SetBoolean("syncBookmarks", 371 args->SetBoolean("syncBookmarks",
366 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); 372 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks));
367 args->SetBoolean("syncPreferences", 373 args->SetBoolean("syncPreferences",
368 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences)); 374 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences));
369 args->SetBoolean("syncThemes", 375 args->SetBoolean("syncThemes",
370 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes)); 376 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes));
371 args->SetBoolean("syncPasswords", 377 args->SetBoolean("syncPasswords",
372 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords)); 378 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords));
373 args->SetBoolean("syncAutofill", 379 args->SetBoolean("syncAutofill",
374 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); 380 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill));
375 args->SetBoolean("syncExtensions", 381 args->SetBoolean("syncExtensions",
376 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); 382 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions));
383 args->SetBoolean("syncSessions",
384 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions));
377 args->SetBoolean("syncTypedUrls", 385 args->SetBoolean("syncTypedUrls",
378 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); 386 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls));
379 args->SetBoolean("syncApps", 387 args->SetBoolean("syncApps",
380 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); 388 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps));
381 } 389 }
382 390
383 void SyncSetupFlow::GetDOMMessageHandlers( 391 void SyncSetupFlow::GetDOMMessageHandlers(
384 std::vector<DOMMessageHandler*>* handlers) const { 392 std::vector<DOMMessageHandler*>* handlers) const {
385 handlers->push_back(flow_handler_); 393 handlers->push_back(flow_handler_);
386 // We don't own flow_handler_ anymore, but it sticks around until at least 394 // 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
506 Browser* b = BrowserList::GetLastActive(); 514 Browser* b = BrowserList::GetLastActive();
507 if (b) { 515 if (b) {
508 b->BrowserShowHtmlDialog(flow, parent_window); 516 b->BrowserShowHtmlDialog(flow, parent_window);
509 } else { 517 } else {
510 delete flow; 518 delete flow;
511 return NULL; 519 return NULL;
512 } 520 }
513 #endif // defined(OS_MACOSX) 521 #endif // defined(OS_MACOSX)
514 return flow; 522 return flow;
515 } 523 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | chrome/browser/sync/sync_setup_wizard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698