blob: 93678fd2d3d8a8b768729671f16219ac1b19b7c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/user/login_status.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "grit/ash_strings.h"
#include "ui/base/resource/resource_bundle.h"
namespace ash {
namespace user {
base::string16 GetLocalizedSignOutStringForStatus(LoginStatus status,
bool multiline) {
int message_id;
switch (status) {
case LOGGED_IN_GUEST:
message_id = IDS_ASH_STATUS_TRAY_EXIT_GUEST;
break;
case LOGGED_IN_RETAIL_MODE:
message_id = IDS_ASH_STATUS_TRAY_EXIT_KIOSK;
break;
case LOGGED_IN_PUBLIC:
message_id = IDS_ASH_STATUS_TRAY_EXIT_PUBLIC;
break;
default:
if (ash::Shell::GetInstance()->session_state_delegate()->
NumberOfLoggedInUsers() > 1) {
message_id = IDS_ASH_STATUS_TRAY_SIGN_OUT_ALL;
} else {
message_id = IDS_ASH_STATUS_TRAY_SIGN_OUT;
}
break;
}
base::string16 message =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
// Desirable line breaking points are marked using \n. As the resource
// framework does not evaluate escape sequences, the \n need to be explicitly
// handled. Depending on the value of |multiline|, actual line breaks or
// spaces are substituted.
base::string16 newline = multiline ? ASCIIToUTF16("\n") : ASCIIToUTF16(" ");
ReplaceSubstringsAfterOffset(&message, 0, ASCIIToUTF16("\\n"), newline);
return message;
}
} // namespace user
} // namespace ash
|