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

Side by Side Diff: chrome/browser/dom_ui/options/personal_options_handler.cc

Issue 6489007: Always use ProfileSyncService::ShowErrorUI to handle error links. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/dom_ui/options/personal_options_handler.h" 5 #include "chrome/browser/dom_ui/options/personal_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 localized_strings->SetString("account", 158 localized_strings->SetString("account",
159 l10n_util::GetStringUTF16(IDS_OPTIONS_PERSONAL_ACCOUNT_GROUP_NAME)); 159 l10n_util::GetStringUTF16(IDS_OPTIONS_PERSONAL_ACCOUNT_GROUP_NAME));
160 localized_strings->SetString("enableScreenlock", 160 localized_strings->SetString("enableScreenlock",
161 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); 161 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX));
162 #endif 162 #endif
163 } 163 }
164 164
165 void PersonalOptionsHandler::RegisterMessages() { 165 void PersonalOptionsHandler::RegisterMessages() {
166 DCHECK(dom_ui_); 166 DCHECK(dom_ui_);
167 dom_ui_->RegisterMessageCallback( 167 dom_ui_->RegisterMessageCallback(
168 "showSyncActionDialog",
169 NewCallback(this, &PersonalOptionsHandler::ShowSyncActionDialog));
170 dom_ui_->RegisterMessageCallback(
168 "showSyncLoginDialog", 171 "showSyncLoginDialog",
169 NewCallback(this, &PersonalOptionsHandler::ShowSyncLoginDialog)); 172 NewCallback(this, &PersonalOptionsHandler::ShowSyncLoginDialog));
170 dom_ui_->RegisterMessageCallback( 173 dom_ui_->RegisterMessageCallback(
171 "showCustomizeSyncDialog", 174 "showCustomizeSyncDialog",
172 NewCallback(this, &PersonalOptionsHandler::ShowCustomizeSyncDialog)); 175 NewCallback(this, &PersonalOptionsHandler::ShowCustomizeSyncDialog));
173 dom_ui_->RegisterMessageCallback( 176 dom_ui_->RegisterMessageCallback(
174 "themesReset", 177 "themesReset",
175 NewCallback(this, &PersonalOptionsHandler::ThemesReset)); 178 NewCallback(this, &PersonalOptionsHandler::ThemesReset));
176 #if defined(TOOLKIT_GTK) 179 #if defined(TOOLKIT_GTK)
177 dom_ui_->RegisterMessageCallback( 180 dom_ui_->RegisterMessageCallback(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DictionaryValue args; 317 DictionaryValue args;
315 SyncSetupFlow::GetArgsForConfigure(sync_service, &args); 318 SyncSetupFlow::GetArgsForConfigure(sync_service, &args);
316 319
317 dom_ui_->CallJavascriptFunction( 320 dom_ui_->CallJavascriptFunction(
318 L"PersonalOptions.setRegisteredDataTypes", args); 321 L"PersonalOptions.setRegisteredDataTypes", args);
319 } else { 322 } else {
320 dom_ui_->CallJavascriptFunction(L"options.PersonalOptions.hideSyncSection"); 323 dom_ui_->CallJavascriptFunction(L"options.PersonalOptions.hideSyncSection");
321 } 324 }
322 } 325 }
323 326
324 void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) { 327 void PersonalOptionsHandler::ShowSyncActionDialog(const ListValue* args) {
325 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService(); 328 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
326 DCHECK(service); 329 DCHECK(service);
327 if (service->HasSyncSetupCompleted()) { 330 service->ShowErrorUI(NULL);
328 service->ShowErrorUI(NULL); 331 }
329 } else { 332
333 void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) {
330 #if defined(OS_CHROMEOS) 334 #if defined(OS_CHROMEOS)
331 std::string email = chromeos::UserManager::Get()->logged_in_user().email(); 335 std::string email = chromeos::UserManager::Get()->logged_in_user().email();
332 string16 message = l10n_util::GetStringFUTF16( 336 string16 message = l10n_util::GetStringFUTF16(
333 IDS_SYNC_LOGIN_INTRODUCTION, 337 IDS_SYNC_LOGIN_INTRODUCTION,
334 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 338 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
335 dom_ui_->GetProfile()->GetBrowserSignin()->RequestSignin( 339 dom_ui_->GetProfile()->GetBrowserSignin()->RequestSignin(
336 dom_ui_->tab_contents(), UTF8ToUTF16(email), message, this); 340 dom_ui_->tab_contents(), UTF8ToUTF16(email), message, this);
337 #else 341 #else
338 service->ShowLoginDialog(NULL); 342 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
339 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); 343 DCHECK(service);
344 service->ShowLoginDialog(NULL);
345 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS);
340 #endif 346 #endif
341 }
342 } 347 }
343 348
344 void PersonalOptionsHandler::ShowCustomizeSyncDialog(const ListValue* args) { 349 void PersonalOptionsHandler::ShowCustomizeSyncDialog(const ListValue* args) {
345 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService(); 350 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
346 DCHECK(service); 351 DCHECK(service);
347 service->ShowConfigure(NULL); 352 service->ShowConfigure(NULL);
348 } 353 }
349 354
350 void PersonalOptionsHandler::ThemesReset(const ListValue* args) { 355 void PersonalOptionsHandler::ThemesReset(const ListValue* args) {
351 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset")); 356 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset"));
(...skipping 20 matching lines...) Expand all
372 const SkBitmap& account_picture = 377 const SkBitmap& account_picture =
373 chromeos::UserManager::Get()->logged_in_user().image(); 378 chromeos::UserManager::Get()->logged_in_user().image();
374 379
375 if (!account_picture.isNull()) { 380 if (!account_picture.isNull()) {
376 StringValue data_url(web_ui_util::GetImageDataUrl(account_picture)); 381 StringValue data_url(web_ui_util::GetImageDataUrl(account_picture));
377 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setAccountPicture", 382 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setAccountPicture",
378 data_url); 383 data_url);
379 } 384 }
380 } 385 }
381 #endif 386 #endif
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/personal_options_handler.h ('k') | chrome/browser/resources/options/personal_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698