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

Side by Side Diff: chrome/browser/extensions/settings_api_bubble_controller.cc

Issue 1125403006: [Extensions] Adjust strings in the extension message bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 5 years, 7 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
« no previous file with comments | « chrome/browser/extensions/proxy_overridden_bubble_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/settings_api_bubble_controller.h" 5 #include "chrome/browser/extensions/settings_api_bubble_controller.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/settings_api_helpers.h" 10 #include "chrome/browser/extensions/settings_api_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/startup/startup_browser_creator.h" 12 #include "chrome/browser/ui/startup/startup_browser_creator.h"
12 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h" 13 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler. h"
13 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
14 #include "chrome/grit/chromium_strings.h" 15 #include "chrome/grit/chromium_strings.h"
15 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
16 #include "extensions/browser/extension_prefs.h" 17 #include "extensions/browser/extension_prefs.h"
17 #include "extensions/browser/extension_registry.h" 18 #include "extensions/browser/extension_registry.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 extension ? SettingsOverrides::Get(extension) : NULL; 157 extension ? SettingsOverrides::Get(extension) : NULL;
157 if (!extension || !settings) { 158 if (!extension || !settings) {
158 NOTREACHED(); 159 NOTREACHED();
159 return base::string16(); 160 return base::string16();
160 } 161 }
161 162
162 bool home_change = settings->homepage != NULL; 163 bool home_change = settings->homepage != NULL;
163 bool startup_change = !settings->startup_pages.empty(); 164 bool startup_change = !settings->startup_pages.empty();
164 bool search_change = settings->search_engine != NULL; 165 bool search_change = settings->search_engine != NULL;
165 166
167 int first_line_id = 0;
168 int second_line_id = 0;
169
166 base::string16 body; 170 base::string16 body;
167 switch (type_) { 171 switch (type_) {
168 case BUBBLE_TYPE_HOME_PAGE: 172 case BUBBLE_TYPE_HOME_PAGE:
169 body = l10n_util::GetStringUTF16( 173 first_line_id = anchored_to_browser_action ?
170 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_HOME_PAGE); 174 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_HOME_PAGE_SPECIFIC :
175 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_HOME_PAGE;
171 if (startup_change && search_change) { 176 if (startup_change && search_change) {
172 body += l10n_util::GetStringUTF16( 177 second_line_id =
173 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_SEARCH); 178 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_SEARCH;
174 } else if (startup_change) { 179 } else if (startup_change) {
175 body += l10n_util::GetStringUTF16( 180 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES;
176 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES);
177 } else if (search_change) { 181 } else if (search_change) {
178 body += l10n_util::GetStringUTF16( 182 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE;
179 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE);
180 } 183 }
181 break; 184 break;
182 case BUBBLE_TYPE_STARTUP_PAGES: 185 case BUBBLE_TYPE_STARTUP_PAGES:
183 body = l10n_util::GetStringUTF16( 186 first_line_id = anchored_to_browser_action ?
184 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_START_PAGES); 187 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_START_PAGES_SPECIFIC :
188 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_START_PAGES;
185 if (home_change && search_change) { 189 if (home_change && search_change) {
186 body += l10n_util::GetStringUTF16( 190 second_line_id =
187 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_AND_SEARCH); 191 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_AND_SEARCH;
188 } else if (home_change) { 192 } else if (home_change) {
189 body += l10n_util::GetStringUTF16( 193 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE;
190 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE);
191 } else if (search_change) { 194 } else if (search_change) {
192 body += l10n_util::GetStringUTF16( 195 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE;
193 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE);
194 } 196 }
195 break; 197 break;
196 case BUBBLE_TYPE_SEARCH_ENGINE: 198 case BUBBLE_TYPE_SEARCH_ENGINE:
197 body = l10n_util::GetStringUTF16( 199 first_line_id = anchored_to_browser_action ?
198 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_SEARCH_ENGINE); 200 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_SEARCH_ENGINE_SPECIFIC :
199 if (startup_change && home_change) { 201 IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_SEARCH_ENGINE;
200 body += l10n_util::GetStringUTF16( 202 if (startup_change && home_change)
201 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_HOME); 203 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_HOME;
202 } else if (startup_change) { 204 else if (startup_change)
203 body += l10n_util::GetStringUTF16( 205 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES;
204 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES); 206 else if (home_change)
205 } else if (home_change) { 207 second_line_id = IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE;
206 body += l10n_util::GetStringUTF16(
207 IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE);
208 }
209 break; 208 break;
210 } 209 }
211 if (!body.empty()) 210 DCHECK_NE(0, first_line_id);
212 body += l10n_util::GetStringUTF16( 211 body = anchored_to_browser_action ?
213 IDS_EXTENSIONS_SETTINGS_API_THIRD_LINE_CONFIRMATION); 212 l10n_util::GetStringUTF16(first_line_id) :
213 l10n_util::GetStringFUTF16(first_line_id,
214 base::UTF8ToUTF16(extension->name()));
215 if (second_line_id)
216 body += l10n_util::GetStringUTF16(second_line_id);
217
218 body += l10n_util::GetStringUTF16(
219 IDS_EXTENSIONS_SETTINGS_API_THIRD_LINE_CONFIRMATION);
220
214 return body; 221 return body;
215 } 222 }
216 223
217 base::string16 SettingsApiBubbleDelegate::GetOverflowText( 224 base::string16 SettingsApiBubbleDelegate::GetOverflowText(
218 const base::string16& overflow_count) const { 225 const base::string16& overflow_count) const {
219 // Does not have more than one extension in the list at a time. 226 // Does not have more than one extension in the list at a time.
220 NOTREACHED(); 227 NOTREACHED();
221 return base::string16(); 228 return base::string16();
222 } 229 }
223 230
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return true; 325 return true;
319 } 326 }
320 327
321 bool SettingsApiBubbleController::CloseOnDeactivate() { 328 bool SettingsApiBubbleController::CloseOnDeactivate() {
322 // Startup bubbles tend to get lost in the focus storm that happens on 329 // Startup bubbles tend to get lost in the focus storm that happens on
323 // startup. Other types should dismiss on focus loss. 330 // startup. Other types should dismiss on focus loss.
324 return type_ != BUBBLE_TYPE_STARTUP_PAGES; 331 return type_ != BUBBLE_TYPE_STARTUP_PAGES;
325 } 332 }
326 333
327 } // namespace extensions 334 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/proxy_overridden_bubble_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698