OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/common/shell_content_client.h" | 5 #include "content/shell/common/shell_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "blink/public/resources/grit/blink_image_resources.h" | 10 #include "blink/public/resources/grit/blink_image_resources.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 ShellContentClient::~ShellContentClient() { | 31 ShellContentClient::~ShellContentClient() { |
32 } | 32 } |
33 | 33 |
34 std::string ShellContentClient::GetUserAgent() const { | 34 std::string ShellContentClient::GetUserAgent() const { |
35 return GetShellUserAgent(); | 35 return GetShellUserAgent(); |
36 } | 36 } |
37 | 37 |
38 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { | 38 base::string16 ShellContentClient::GetLocalizedString(int message_id) const { |
39 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 39 if (switches::IsRunLayoutTestSwitchPresent()) { |
40 switches::kRunLayoutTest)) { | |
41 switch (message_id) { | 40 switch (message_id) { |
42 case IDS_FORM_OTHER_DATE_LABEL: | 41 case IDS_FORM_OTHER_DATE_LABEL: |
43 return base::ASCIIToUTF16("<<OtherDateLabel>>"); | 42 return base::ASCIIToUTF16("<<OtherDateLabel>>"); |
44 case IDS_FORM_OTHER_MONTH_LABEL: | 43 case IDS_FORM_OTHER_MONTH_LABEL: |
45 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); | 44 return base::ASCIIToUTF16("<<OtherMonthLabel>>"); |
46 case IDS_FORM_OTHER_TIME_LABEL: | 45 case IDS_FORM_OTHER_TIME_LABEL: |
47 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); | 46 return base::ASCIIToUTF16("<<OtherTimeLabel>>"); |
48 case IDS_FORM_OTHER_WEEK_LABEL: | 47 case IDS_FORM_OTHER_WEEK_LABEL: |
49 return base::ASCIIToUTF16("<<OtherWeekLabel>>"); | 48 return base::ASCIIToUTF16("<<OtherWeekLabel>>"); |
50 case IDS_FORM_CALENDAR_CLEAR: | 49 case IDS_FORM_CALENDAR_CLEAR: |
51 return base::ASCIIToUTF16("<<CalendarClear>>"); | 50 return base::ASCIIToUTF16("<<CalendarClear>>"); |
52 case IDS_FORM_CALENDAR_TODAY: | 51 case IDS_FORM_CALENDAR_TODAY: |
53 return base::ASCIIToUTF16("<<CalendarToday>>"); | 52 return base::ASCIIToUTF16("<<CalendarToday>>"); |
54 case IDS_FORM_THIS_MONTH_LABEL: | 53 case IDS_FORM_THIS_MONTH_LABEL: |
55 return base::ASCIIToUTF16("<<ThisMonthLabel>>"); | 54 return base::ASCIIToUTF16("<<ThisMonthLabel>>"); |
56 case IDS_FORM_THIS_WEEK_LABEL: | 55 case IDS_FORM_THIS_WEEK_LABEL: |
57 return base::ASCIIToUTF16("<<ThisWeekLabel>>"); | 56 return base::ASCIIToUTF16("<<ThisWeekLabel>>"); |
58 } | 57 } |
59 } | 58 } |
60 return l10n_util::GetStringUTF16(message_id); | 59 return l10n_util::GetStringUTF16(message_id); |
61 } | 60 } |
62 | 61 |
63 base::StringPiece ShellContentClient::GetDataResource( | 62 base::StringPiece ShellContentClient::GetDataResource( |
64 int resource_id, | 63 int resource_id, |
65 ui::ScaleFactor scale_factor) const { | 64 ui::ScaleFactor scale_factor) const { |
66 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 65 if (switches::IsRunLayoutTestSwitchPresent()) { |
67 switches::kRunLayoutTest)) { | |
68 switch (resource_id) { | 66 switch (resource_id) { |
69 case IDR_BROKENIMAGE: | 67 case IDR_BROKENIMAGE: |
70 #if defined(OS_MACOSX) | 68 #if defined(OS_MACOSX) |
71 resource_id = IDR_CONTENT_SHELL_MISSING_IMAGE_PNG; | 69 resource_id = IDR_CONTENT_SHELL_MISSING_IMAGE_PNG; |
72 #else | 70 #else |
73 resource_id = IDR_CONTENT_SHELL_MISSING_IMAGE_GIF; | 71 resource_id = IDR_CONTENT_SHELL_MISSING_IMAGE_GIF; |
74 #endif | 72 #endif |
75 break; | 73 break; |
76 | 74 |
77 case IDR_TEXTAREA_RESIZER: | 75 case IDR_TEXTAREA_RESIZER: |
(...skipping 13 matching lines...) Expand all Loading... |
91 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { | 89 gfx::Image& ShellContentClient::GetNativeImageNamed(int resource_id) const { |
92 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); | 90 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); |
93 } | 91 } |
94 | 92 |
95 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { | 93 bool ShellContentClient::IsSupplementarySiteIsolationModeEnabled() { |
96 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 94 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
97 switches::kIsolateSitesForTesting); | 95 switches::kIsolateSitesForTesting); |
98 } | 96 } |
99 | 97 |
100 } // namespace content | 98 } // namespace content |
OLD | NEW |