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 "chrome/browser/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 void ComponentLoader::AddDefaultComponentExtensions( | 368 void ComponentLoader::AddDefaultComponentExtensions( |
369 bool skip_session_components) { | 369 bool skip_session_components) { |
370 // Do not add component extensions that have background pages here -- add them | 370 // Do not add component extensions that have background pages here -- add them |
371 // to AddDefaultComponentExtensionsWithBackgroundPages. | 371 // to AddDefaultComponentExtensionsWithBackgroundPages. |
372 #if defined(OS_CHROMEOS) | 372 #if defined(OS_CHROMEOS) |
373 Add(IDR_MOBILE_MANIFEST, | 373 Add(IDR_MOBILE_MANIFEST, |
374 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); | 374 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); |
375 | 375 |
376 #if defined(GOOGLE_CHROME_BUILD) | 376 #if defined(GOOGLE_CHROME_BUILD) |
377 { | |
378 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
379 if (!command_line->HasSwitch(chromeos::switches::kDisableGeniusApp)) { | |
380 AddWithName(IDR_GENIUS_APP_MANIFEST, | |
381 base::FilePath(FILE_PATH_LITERAL( | |
382 "/usr/share/chromeos-assets/genius_app")), | |
383 l10n_util::GetStringUTF8(IDS_GENIUS_APP_NAME)); | |
384 } | |
385 } | |
386 if (browser_defaults::enable_help_app) { | 377 if (browser_defaults::enable_help_app) { |
387 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( | 378 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( |
388 "/usr/share/chromeos-assets/helpapp"))); | 379 "/usr/share/chromeos-assets/helpapp"))); |
389 } | 380 } |
390 #endif | 381 #endif |
391 | 382 |
392 // Skip all other extensions that require user session presence. | 383 // Skip all other extensions that require user session presence. |
393 if (!skip_session_components) { | 384 if (!skip_session_components) { |
394 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 385 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
395 if (!command_line->HasSwitch(chromeos::switches::kGuestSession)) | 386 if (!command_line->HasSwitch(chromeos::switches::kGuestSession)) |
(...skipping 26 matching lines...) Expand all Loading... |
422 | 413 |
423 // Component extensions with background pages are not enabled during tests | 414 // Component extensions with background pages are not enabled during tests |
424 // because they generate a lot of background behavior that can interfere. | 415 // because they generate a lot of background behavior that can interfere. |
425 if (!enable_background_extensions_during_testing && | 416 if (!enable_background_extensions_during_testing && |
426 (command_line->HasSwitch(switches::kTestType) || | 417 (command_line->HasSwitch(switches::kTestType) || |
427 command_line->HasSwitch( | 418 command_line->HasSwitch( |
428 switches::kDisableComponentExtensionsWithBackgroundPages))) { | 419 switches::kDisableComponentExtensionsWithBackgroundPages))) { |
429 return; | 420 return; |
430 } | 421 } |
431 | 422 |
| 423 #if defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD) |
| 424 // Since this is a v2 app it has a background page. |
| 425 if (!command_line->HasSwitch(chromeos::switches::kDisableGeniusApp)) { |
| 426 AddWithName(IDR_GENIUS_APP_MANIFEST, |
| 427 base::FilePath(FILE_PATH_LITERAL( |
| 428 "/usr/share/chromeos-assets/genius_app")), |
| 429 l10n_util::GetStringUTF8(IDS_GENIUS_APP_NAME)); |
| 430 } |
| 431 #endif |
| 432 |
432 if (!skip_session_components) { | 433 if (!skip_session_components) { |
433 // Apps Debugger | 434 // Apps Debugger |
434 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsDevtool) && | 435 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsDevtool) && |
435 profile_prefs_->GetBoolean(prefs::kExtensionsUIDeveloperMode)) { | 436 profile_prefs_->GetBoolean(prefs::kExtensionsUIDeveloperMode)) { |
436 Add(IDR_APPS_DEBUGGER_MANIFEST, | 437 Add(IDR_APPS_DEBUGGER_MANIFEST, |
437 base::FilePath(FILE_PATH_LITERAL("apps_debugger"))); | 438 base::FilePath(FILE_PATH_LITERAL("apps_debugger"))); |
438 } | 439 } |
439 | 440 |
440 | 441 |
441 AddFileManagerExtension(); | 442 AddFileManagerExtension(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 557 |
557 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 558 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
558 delete component->manifest; | 559 delete component->manifest; |
559 if (extension_service_->is_ready()) { | 560 if (extension_service_->is_ready()) { |
560 extension_service_-> | 561 extension_service_-> |
561 RemoveComponentExtension(component->extension_id); | 562 RemoveComponentExtension(component->extension_id); |
562 } | 563 } |
563 } | 564 } |
564 | 565 |
565 } // namespace extensions | 566 } // namespace extensions |
OLD | NEW |