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/sync/sync_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
6 | 6 |
7 #include "base/command_line.h" | |
8 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
9 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
14 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" | 14 #include "chrome/browser/sync/protocol/proto_enum_conversions.h" |
15 #include "chrome/browser/sync/sessions/session_state.h" | 15 #include "chrome/browser/sync/sessions/session_state.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/net/gaia/google_service_auth_error.h" | 19 #include "chrome/common/net/gaia/google_service_auth_error.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
21 #include "grit/browser_resources.h" | 21 #include "grit/browser_resources.h" |
22 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // Returns the message that should be displayed when the user is authenticated | 70 // Returns the message that should be displayed when the user is authenticated |
71 // and can connect to the sync server. If the user hasn't yet authenticated, an | 71 // and can connect to the sync server. If the user hasn't yet authenticated, an |
72 // empty string is returned. | 72 // empty string is returned. |
73 string16 GetSyncedStateStatusLabel(ProfileSyncService* service) { | 73 string16 GetSyncedStateStatusLabel(ProfileSyncService* service) { |
74 string16 label; | 74 string16 label; |
75 string16 user_name(service->GetAuthenticatedUsername()); | 75 string16 user_name(service->GetAuthenticatedUsername()); |
76 if (user_name.empty()) | 76 if (user_name.empty()) |
77 return label; | 77 return label; |
78 | 78 |
79 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | |
80 return l10n_util::GetStringFUTF16( | 79 return l10n_util::GetStringFUTF16( |
81 browser_command_line.HasSwitch(switches::kMultiProfiles) ? | 80 ProfileManager::IsMultipleProfilesEnabled() ? |
82 IDS_PROFILES_SYNCED_TO_USER_WITH_TIME : | 81 IDS_PROFILES_SYNCED_TO_USER_WITH_TIME : |
83 IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, | 82 IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, |
84 user_name, | 83 user_name, |
85 service->GetLastSyncedTimeString()); | 84 service->GetLastSyncedTimeString()); |
86 } | 85 } |
87 | 86 |
88 // TODO(akalin): Write unit tests for these three functions below. | 87 // TODO(akalin): Write unit tests for these three functions below. |
89 | 88 |
90 // status_label and link_label must either be both NULL or both non-NULL. | 89 // status_label and link_label must either be both NULL or both non-NULL. |
91 MessageType GetStatusInfo(ProfileSyncService* service, | 90 MessageType GetStatusInfo(ProfileSyncService* service, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 DictionaryValue* val = new DictionaryValue; | 470 DictionaryValue* val = new DictionaryValue; |
472 val->SetString("model_type", ModelTypeToString(it->first)); | 471 val->SetString("model_type", ModelTypeToString(it->first)); |
473 val->SetString("group", ModelSafeGroupToString(it->second)); | 472 val->SetString("group", ModelSafeGroupToString(it->second)); |
474 routing_info->Append(val); | 473 routing_info->Append(val); |
475 } | 474 } |
476 } | 475 } |
477 } | 476 } |
478 } | 477 } |
479 | 478 |
480 } // namespace sync_ui_util | 479 } // namespace sync_ui_util |
OLD | NEW |