| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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.h" | 7 #include "app/gfx/font.h" |
| 8 #include "app/gfx/font_util.h" | 8 #include "app/gfx/font_util.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void FlowHandler::ShowGaiaSuccessAndClose() { | 107 void FlowHandler::ShowGaiaSuccessAndClose() { |
| 108 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); | 108 ExecuteJavascriptInIFrame(kLoginIFrameXPath, L"showGaiaSuccessAndClose();"); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void FlowHandler::ShowGaiaSuccessAndSettingUp() { | 111 void FlowHandler::ShowGaiaSuccessAndSettingUp() { |
| 112 ExecuteJavascriptInIFrame(kLoginIFrameXPath, | 112 ExecuteJavascriptInIFrame(kLoginIFrameXPath, |
| 113 L"showGaiaSuccessAndSettingUp();"); | 113 L"showGaiaSuccessAndSettingUp();"); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void FlowHandler::ShowMergeAndSync() { | 116 void FlowHandler::ShowMergeAndSync() { |
| 117 if (dom_ui_) // NULL during testing. | 117 if (dom_ui_) { // NULL during testing. |
| 118 dom_ui_->CallJavascriptFunction(L"showMergeAndSync"); | 118 dom_ui_->CallJavascriptFunction(L"showMergeAndSync"); |
| 119 } |
| 120 ExecuteJavascriptInIFrame(kMergeIFrameXPath, |
| 121 L"onPageShown();"); |
| 119 } | 122 } |
| 120 | 123 |
| 121 void FlowHandler::ShowSetupDone(const std::wstring& user) { | 124 void FlowHandler::ShowSetupDone(const std::wstring& user) { |
| 122 StringValue synced_to_string(WideToUTF8(l10n_util::GetStringF( | 125 StringValue synced_to_string(WideToUTF8(l10n_util::GetStringF( |
| 123 IDS_SYNC_NTP_SYNCED_TO, user))); | 126 IDS_SYNC_NTP_SYNCED_TO, user))); |
| 124 std::string json; | 127 std::string json; |
| 125 base::JSONWriter::Write(&synced_to_string, false, &json); | 128 base::JSONWriter::Write(&synced_to_string, false, &json); |
| 126 std::wstring javascript = std::wstring(L"setSyncedToUser") + | 129 std::wstring javascript = std::wstring(L"setSyncedToUser") + |
| 127 L"(" + UTF8ToWide(json) + L");"; | 130 L"(" + UTF8ToWide(json) + L");"; |
| 128 ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript); | 131 ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript); |
| 129 | 132 |
| 130 if (dom_ui_) | 133 if (dom_ui_) |
| 131 dom_ui_->CallJavascriptFunction(L"showSetupDone", synced_to_string); | 134 dom_ui_->CallJavascriptFunction(L"showSetupDone", synced_to_string); |
| 135 |
| 136 ExecuteJavascriptInIFrame(kDoneIframeXPath, |
| 137 L"onPageShown();"); |
| 132 } | 138 } |
| 133 | 139 |
| 134 void FlowHandler::ShowFirstTimeDone(const std::wstring& user) { | 140 void FlowHandler::ShowFirstTimeDone(const std::wstring& user) { |
| 135 ExecuteJavascriptInIFrame(kDoneIframeXPath, | 141 ExecuteJavascriptInIFrame(kDoneIframeXPath, |
| 136 L"setShowFirstTimeSetupSummary();"); | 142 L"setShowFirstTimeSetupSummary();"); |
| 137 ShowSetupDone(user); | 143 ShowSetupDone(user); |
| 138 } | 144 } |
| 139 | 145 |
| 140 void FlowHandler::ShowMergeAndSyncError() { | 146 void FlowHandler::ShowMergeAndSyncError() { |
| 141 ExecuteJavascriptInIFrame(kMergeIFrameXPath, L"showMergeAndSyncError();"); | 147 ExecuteJavascriptInIFrame(kMergeIFrameXPath, L"showMergeAndSyncError();"); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // being able to intercept ShowHtmlDialog() calls. | 346 // being able to intercept ShowHtmlDialog() calls. |
| 341 #if defined(OS_MACOSX) | 347 #if defined(OS_MACOSX) |
| 342 html_dialog_window_controller::ShowHtmlDialog(flow, service->profile()); | 348 html_dialog_window_controller::ShowHtmlDialog(flow, service->profile()); |
| 343 #else | 349 #else |
| 344 delete flow; | 350 delete flow; |
| 345 return NULL; | 351 return NULL; |
| 346 #endif | 352 #endif |
| 347 } | 353 } |
| 348 return flow; | 354 return flow; |
| 349 } | 355 } |
| OLD | NEW |