Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 string16 start_stop_button_label; | 195 string16 start_stop_button_label; |
| 196 bool is_start_stop_button_visible = false; | 196 bool is_start_stop_button_visible = false; |
| 197 bool is_start_stop_button_enabled = false; | 197 bool is_start_stop_button_enabled = false; |
| 198 if (sync_setup_completed) { | 198 if (sync_setup_completed) { |
| 199 start_stop_button_label = | 199 start_stop_button_label = |
| 200 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); | 200 l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL); |
| 201 #if defined(OS_CHROMEOS) | 201 #if defined(OS_CHROMEOS) |
| 202 is_start_stop_button_visible = false; | 202 is_start_stop_button_visible = false; |
| 203 #else | 203 #else |
| 204 is_start_stop_button_visible = true; | 204 is_start_stop_button_visible = true; |
| 205 #endif | 205 #endif // defined(OS_CHROMEOS) |
| 206 is_start_stop_button_enabled = !managed; | 206 is_start_stop_button_enabled = !managed; |
| 207 } else if (service->SetupInProgress()) { | 207 } else if (service->SetupInProgress()) { |
| 208 start_stop_button_label = | 208 start_stop_button_label = |
| 209 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS); | 209 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS); |
| 210 is_start_stop_button_visible = true; | 210 is_start_stop_button_visible = true; |
| 211 is_start_stop_button_enabled = false; | 211 is_start_stop_button_enabled = false; |
| 212 } else { | 212 } else { |
| 213 start_stop_button_label = | 213 start_stop_button_label = |
| 214 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); | 214 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); |
| 215 is_start_stop_button_visible = true; | 215 is_start_stop_button_visible = true; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 239 *label); | 239 *label); |
| 240 | 240 |
| 241 #if !defined(OS_CHROMEOS) | 241 #if !defined(OS_CHROMEOS) |
| 242 label.reset(Value::CreateStringValue(link_label)); | 242 label.reset(Value::CreateStringValue(link_label)); |
| 243 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setSyncActionLinkLabel", | 243 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setSyncActionLinkLabel", |
| 244 *label); | 244 *label); |
| 245 | 245 |
| 246 enabled.reset(Value::CreateBooleanValue(!managed)); | 246 enabled.reset(Value::CreateBooleanValue(!managed)); |
| 247 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setSyncActionLinkEnabled", | 247 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setSyncActionLinkEnabled", |
| 248 *enabled); | 248 *enabled); |
| 249 #endif | 249 #else |
| 250 label.reset(Value::CreateStringValue(string16())); | |
| 251 dom_ui_->CallJavascriptFunction(L"PersonalOptions.setSyncActionLinkLabel", | |
| 252 *label); | |
| 253 #endif // !defined(OS_CHROMEOS) | |
| 250 | 254 |
| 251 visible.reset(Value::CreateBooleanValue(status_has_error)); | 255 visible.reset(Value::CreateBooleanValue(status_has_error)); |
| 252 dom_ui_->CallJavascriptFunction( | 256 dom_ui_->CallJavascriptFunction( |
| 253 L"PersonalOptions.setSyncStatusErrorVisible", *visible); | 257 L"PersonalOptions.setSyncStatusErrorVisible", *visible); |
| 254 #if !defined(OS_CHROMEOS) | 258 #if !defined(OS_CHROMEOS) |
| 255 dom_ui_->CallJavascriptFunction( | 259 dom_ui_->CallJavascriptFunction( |
| 256 L"PersonalOptions.setSyncActionLinkErrorVisible", *visible); | 260 L"PersonalOptions.setSyncActionLinkErrorVisible", *visible); |
| 257 #endif | 261 #else |
| 262 visible.reset(Value::CreateBooleanValue(false)); | |
|
csilv
2011/01/25 20:00:49
suggestion: put the visible.reset() line in an #if
James Hawkins
2011/01/25 20:05:08
Done.
| |
| 263 dom_ui_->CallJavascriptFunction( | |
| 264 L"PersonalOptions.setSyncActionLinkErrorVisible", *visible); | |
| 265 #endif // !defined(OS_CHROMEOS) | |
| 258 } | 266 } |
| 259 | 267 |
| 260 void PersonalOptionsHandler::OnLoginSuccess() { | 268 void PersonalOptionsHandler::OnLoginSuccess() { |
| 261 OnStateChanged(); | 269 OnStateChanged(); |
| 262 } | 270 } |
| 263 | 271 |
| 264 void PersonalOptionsHandler::OnLoginFailure( | 272 void PersonalOptionsHandler::OnLoginFailure( |
| 265 const GoogleServiceAuthError& error) { | 273 const GoogleServiceAuthError& error) { |
| 266 OnStateChanged(); | 274 OnStateChanged(); |
| 267 } | 275 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 } | 355 } |
| 348 #endif | 356 #endif |
| 349 | 357 |
| 350 void PersonalOptionsHandler::OnPreferredDataTypesUpdated( | 358 void PersonalOptionsHandler::OnPreferredDataTypesUpdated( |
| 351 const ListValue* args) { | 359 const ListValue* args) { |
| 352 NotificationService::current()->Notify( | 360 NotificationService::current()->Notify( |
| 353 NotificationType::SYNC_DATA_TYPES_UPDATED, | 361 NotificationType::SYNC_DATA_TYPES_UPDATED, |
| 354 Source<Profile>(dom_ui_->GetProfile()), | 362 Source<Profile>(dom_ui_->GetProfile()), |
| 355 NotificationService::NoDetails()); | 363 NotificationService::NoDetails()); |
| 356 } | 364 } |
| OLD | NEW |