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

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

Issue 10443024: Added chrome switch that lets tests override URL path, moved GAIA auth extension from CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
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 "chrome/browser/extensions/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 FilePath filemgr_extension_path( 231 FilePath filemgr_extension_path(
232 command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath)); 232 command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath));
233 Add(IDR_FILEMANAGER_MANIFEST, filemgr_extension_path); 233 Add(IDR_FILEMANAGER_MANIFEST, filemgr_extension_path);
234 return; 234 return;
235 } 235 }
236 #endif // NDEBUG 236 #endif // NDEBUG
237 Add(IDR_FILEMANAGER_MANIFEST, FilePath(FILE_PATH_LITERAL("file_manager"))); 237 Add(IDR_FILEMANAGER_MANIFEST, FilePath(FILE_PATH_LITERAL("file_manager")));
238 #endif // defined(FILE_MANAGER_EXTENSION) 238 #endif // defined(FILE_MANAGER_EXTENSION)
239 } 239 }
240 240
241 #if defined(OS_CHROMEOS)
242 void ComponentLoader::AddGaiaAuthExtension() {
243 const CommandLine* command_line = CommandLine::ForCurrentProcess();
244 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
245 FilePath auth_extension_path =
246 command_line->GetSwitchValuePath(switches::kAuthExtensionPath);
247 Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path);
248 return;
249 }
250 Add(IDR_GAIA_AUTH_MANIFEST, FilePath(FILE_PATH_LITERAL("gaia_auth")));
251 }
252 #endif // NDEBUG
253
241 void ComponentLoader::AddOrReloadEnterpriseWebStore() { 254 void ComponentLoader::AddOrReloadEnterpriseWebStore() {
242 FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); 255 FilePath path(FILE_PATH_LITERAL("enterprise_web_store"));
243 256
244 // Remove the extension if it was already loaded. 257 // Remove the extension if it was already loaded.
245 Remove(path); 258 Remove(path);
246 259
247 std::string enterprise_webstore_url = 260 std::string enterprise_webstore_url =
248 prefs_->GetString(prefs::kEnterpriseWebStoreURL); 261 prefs_->GetString(prefs::kEnterpriseWebStoreURL);
249 262
250 // Load the extension only if the URL preference is set. 263 // Load the extension only if the URL preference is set.
(...skipping 21 matching lines...) Expand all
272 FilePath(FILE_PATH_LITERAL("bookmark_manager"))); 285 FilePath(FILE_PATH_LITERAL("bookmark_manager")));
273 #else 286 #else
274 Add(IDR_BOOKMARKS_MANIFEST, FilePath(FILE_PATH_LITERAL("bookmark_manager"))); 287 Add(IDR_BOOKMARKS_MANIFEST, FilePath(FILE_PATH_LITERAL("bookmark_manager")));
275 #endif 288 #endif
276 289
277 #if defined(FILE_MANAGER_EXTENSION) 290 #if defined(FILE_MANAGER_EXTENSION)
278 AddFileManagerExtension(); 291 AddFileManagerExtension();
279 #endif 292 #endif
280 293
281 #if defined(OS_CHROMEOS) 294 #if defined(OS_CHROMEOS)
282 Add(IDR_MOBILE_MANIFEST, 295 Add(IDR_MOBILE_MANIFEST,
283 FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); 296 FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile")));
284 297
285 Add(IDR_CROSH_BUILTIN_MANIFEST, FilePath(FILE_PATH_LITERAL( 298 Add(IDR_CROSH_BUILTIN_MANIFEST, FilePath(FILE_PATH_LITERAL(
286 "/usr/share/chromeos-assets/crosh_builtin"))); 299 "/usr/share/chromeos-assets/crosh_builtin")));
287 300
288 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 301 AddGaiaAuthExtension();
289 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
290 FilePath auth_extension_path =
291 command_line->GetSwitchValuePath(switches::kAuthExtensionPath);
292 Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path);
293 } else {
294 Add(IDR_GAIA_AUTH_MANIFEST,
295 FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/gaia_auth")));
296 }
297 302
298 // TODO(gauravsh): Only include echo extension on official builds. 303 // TODO(gauravsh): Only include echo extension on official builds.
299 FilePath echo_extension_path(FILE_PATH_LITERAL( 304 const CommandLine* command_line = CommandLine::ForCurrentProcess();
300 "/usr/share/chromeos-assets/echo")); 305 FilePath echo_extension_path(FILE_PATH_LITERAL(
301 if (command_line->HasSwitch(switches::kEchoExtensionPath)) { 306 "/usr/share/chromeos-assets/echo"));
302 echo_extension_path = 307 if (command_line->HasSwitch(switches::kEchoExtensionPath)) {
303 command_line->GetSwitchValuePath(switches::kEchoExtensionPath); 308 echo_extension_path =
304 } 309 command_line->GetSwitchValuePath(switches::kEchoExtensionPath);
305 Add(IDR_ECHO_MANIFEST, echo_extension_path); 310 }
311 Add(IDR_ECHO_MANIFEST, echo_extension_path);
306 312
307 #if defined(OFFICIAL_BUILD) 313 #if defined(OFFICIAL_BUILD)
308 if (browser_defaults::enable_help_app) { 314 if (browser_defaults::enable_help_app) {
309 Add(IDR_HELP_MANIFEST, 315 Add(IDR_HELP_MANIFEST,
310 FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/helpapp"))); 316 FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/helpapp")));
311 } 317 }
312 #endif 318 #endif
313 #endif // !defined(OS_CHROMEOS) 319 #endif // !defined(OS_CHROMEOS)
314 320
315 Add(IDR_WEBSTORE_MANIFEST, FilePath(FILE_PATH_LITERAL("web_store"))); 321 Add(IDR_WEBSTORE_MANIFEST, FilePath(FILE_PATH_LITERAL("web_store")));
316 322
317 #if !defined(OS_CHROMEOS) 323 #if !defined(OS_CHROMEOS)
318 // Cloud Print component app. Not required on Chrome OS. 324 // Cloud Print component app. Not required on Chrome OS.
319 Add(IDR_CLOUDPRINT_MANIFEST, FilePath(FILE_PATH_LITERAL("cloud_print"))); 325 Add(IDR_CLOUDPRINT_MANIFEST, FilePath(FILE_PATH_LITERAL("cloud_print")));
320 #endif 326 #endif
321 327
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { 361 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) {
356 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, 362 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL,
357 std::string() /* default_value */, 363 std::string() /* default_value */,
358 PrefService::UNSYNCABLE_PREF); 364 PrefService::UNSYNCABLE_PREF);
359 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, 365 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName,
360 std::string() /* default_value */, 366 std::string() /* default_value */,
361 PrefService::UNSYNCABLE_PREF); 367 PrefService::UNSYNCABLE_PREF);
362 } 368 }
363 369
364 } // namespace extensions 370 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698