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

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

Issue 3168009: Added classes to enable session sync functionality.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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 | Annotate | Revision Log
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(L"syncExtensions", &sync_extensions)) 104 if (!result->GetBoolean(L"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(L"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(L"syncTypedUrls", &sync_typed_urls)) 116 if (!result->GetBoolean(L"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 return true; 121 return true;
116 } 122 }
117 123
118 void FlowHandler::HandleSubmitAuth(const Value* value) { 124 void FlowHandler::HandleSubmitAuth(const Value* value) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); 181 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();");
176 } 182 }
177 183
178 void FlowHandler::ShowGaiaSuccessAndSettingUp() { 184 void FlowHandler::ShowGaiaSuccessAndSettingUp() {
179 ExecuteJavascriptInIFrame(kLoginIFrameXPath, 185 ExecuteJavascriptInIFrame(kLoginIFrameXPath,
180 L"showGaiaSuccessAndSettingUp();"); 186 L"showGaiaSuccessAndSettingUp();");
181 } 187 }
182 188
183 // Called by SyncSetupFlow::Advance. 189 // Called by SyncSetupFlow::Advance.
184 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) { 190 void FlowHandler::ShowChooseDataTypes(const DictionaryValue& args) {
185
186 // If you're starting the wizard at the Choose Data Types screen (i.e. from 191 // If you're starting the wizard at the Choose Data Types screen (i.e. from
187 // "Customize Sync"), this will be redundant. However, if you're coming from 192 // "Customize Sync"), this will be redundant. However, if you're coming from
188 // another wizard state, this will make sure Choose Data Types is on top. 193 // another wizard state, this will make sure Choose Data Types is on top.
189 if (dom_ui_) 194 if (dom_ui_)
190 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes"); 195 dom_ui_->CallJavascriptFunction(L"showChooseDataTypes");
191 196
192 std::string json; 197 std::string json;
193 base::JSONWriter::Write(&args, false, &json); 198 base::JSONWriter::Write(&args, false, &json);
194 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") + 199 std::wstring javascript = std::wstring(L"setCheckboxesAndErrors") +
195 L"(" + UTF8ToWide(json) + L");"; 200 L"(" + UTF8ToWide(json) + L");";
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 syncable::ModelTypeSet registered_types; 351 syncable::ModelTypeSet registered_types;
347 service->GetRegisteredDataTypes(&registered_types); 352 service->GetRegisteredDataTypes(&registered_types);
348 args->SetBoolean(L"passwordsRegistered", 353 args->SetBoolean(L"passwordsRegistered",
349 registered_types.count(syncable::PASSWORDS) > 0); 354 registered_types.count(syncable::PASSWORDS) > 0);
350 args->SetBoolean(L"autofillRegistered", 355 args->SetBoolean(L"autofillRegistered",
351 registered_types.count(syncable::AUTOFILL) > 0); 356 registered_types.count(syncable::AUTOFILL) > 0);
352 args->SetBoolean(L"extensionsRegistered", 357 args->SetBoolean(L"extensionsRegistered",
353 registered_types.count(syncable::EXTENSIONS) > 0); 358 registered_types.count(syncable::EXTENSIONS) > 0);
354 args->SetBoolean(L"typedUrlsRegistered", 359 args->SetBoolean(L"typedUrlsRegistered",
355 registered_types.count(syncable::TYPED_URLS) > 0); 360 registered_types.count(syncable::TYPED_URLS) > 0);
361 args->SetBoolean(L"sessionsRegistered",
362 registered_types.count(syncable::SESSIONS) > 0);
356 363
357 args->SetBoolean(L"syncBookmarks", 364 args->SetBoolean(L"syncBookmarks",
358 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); 365 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks));
359 args->SetBoolean(L"syncPreferences", 366 args->SetBoolean(L"syncPreferences",
360 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences)); 367 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPreferences));
361 args->SetBoolean(L"syncThemes", 368 args->SetBoolean(L"syncThemes",
362 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes)); 369 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncThemes));
363 args->SetBoolean(L"syncPasswords", 370 args->SetBoolean(L"syncPasswords",
364 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords)); 371 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncPasswords));
365 args->SetBoolean(L"syncAutofill", 372 args->SetBoolean(L"syncAutofill",
366 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill)); 373 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAutofill));
367 args->SetBoolean(L"syncExtensions", 374 args->SetBoolean(L"syncExtensions",
368 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions)); 375 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncExtensions));
376 args->SetBoolean(L"syncSessions",
377 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncSessions));
369 args->SetBoolean(L"syncTypedUrls", 378 args->SetBoolean(L"syncTypedUrls",
370 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); 379 service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls));
371 } 380 }
372 381
373 void SyncSetupFlow::GetDOMMessageHandlers( 382 void SyncSetupFlow::GetDOMMessageHandlers(
374 std::vector<DOMMessageHandler*>* handlers) const { 383 std::vector<DOMMessageHandler*>* handlers) const {
375 handlers->push_back(flow_handler_); 384 handlers->push_back(flow_handler_);
376 // We don't own flow_handler_ anymore, but it sticks around until at least 385 // We don't own flow_handler_ anymore, but it sticks around until at least
377 // right after OnDialogClosed() is called (and this object is destroyed). 386 // right after OnDialogClosed() is called (and this object is destroyed).
378 owns_flow_handler_ = false; 387 owns_flow_handler_ = false;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Browser* b = BrowserList::GetLastActive(); 505 Browser* b = BrowserList::GetLastActive();
497 if (b) { 506 if (b) {
498 b->BrowserShowHtmlDialog(flow, parent_window); 507 b->BrowserShowHtmlDialog(flow, parent_window);
499 } else { 508 } else {
500 delete flow; 509 delete flow;
501 return NULL; 510 return NULL;
502 } 511 }
503 #endif // defined(OS_MACOSX) 512 #endif // defined(OS_MACOSX)
504 return flow; 513 return flow;
505 } 514 }
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