Index: chrome/browser/extensions/extension_prefs.cc |
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc |
index ec6ada019a5acfe228341f20382aa34b2a1198b0..a8c8f0a8057f4fc323b43b12fc53ae4b9e825e69 100644 |
--- a/chrome/browser/extensions/extension_prefs.cc |
+++ b/chrome/browser/extensions/extension_prefs.cc |
@@ -564,25 +564,46 @@ void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
} |
ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( |
- const std::string& extension_id) { |
+ const std::string& extension_id, |
+ ExtensionPrefs::LaunchType default_pref_value) { |
int value; |
+ LaunchType result; |
Aaron Boodman
2010/11/30 00:29:28
Nit: Always initialize primitives.
Sam Kerner (Chrome)
2010/11/30 01:21:04
Done.
|
+ |
if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && |
(value == LAUNCH_PINNED || |
value == LAUNCH_REGULAR || |
value == LAUNCH_FULLSCREEN || |
value == LAUNCH_WINDOW)) { |
- |
-#if defined(OS_MACOSX) |
+ result = static_cast<LaunchType>(value); |
+ } else { |
+ result = default_pref_value; |
+ } |
+ #if defined(OS_MACOSX) |
// App windows are not yet supported on mac. Pref sync could make |
// the launch type LAUNCH_WINDOW, even if there is no UI to set it |
// on mac. |
- if (value == LAUNCH_WINDOW) |
- return LAUNCH_REGULAR; |
-#endif |
- return static_cast<LaunchType>(value); |
- } |
+ if (result == LAUNCH_WINDOW) |
+ result = LAUNCH_REGULAR; |
+ #endif |
+ |
+ return result; |
+} |
+ |
+extension_misc::LaunchContainer ExtensionPrefs::GetLaunchContainer( |
+ const Extension* extension, |
+ ExtensionPrefs::LaunchType default_pref_value) { |
+ extension_misc::LaunchContainer launch_container = |
+ extension->launch_container(); |
+ |
+ ExtensionPrefs::LaunchType prefs_launch_type = |
+ GetLaunchType(extension->id(), default_pref_value); |
+ |
+ // If the user chose to open in a window, then launch in one. |
+ if (prefs_launch_type == ExtensionPrefs::LAUNCH_WINDOW) |
+ return extension_misc::LAUNCH_WINDOW; |
- return LAUNCH_REGULAR; |
+ // Otherwise, use the container the extension chose. |
+ return launch_container; |
} |
void ExtensionPrefs::SetLaunchType(const std::string& extension_id, |