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

Unified Diff: chrome/browser/extensions/extension_prefs.cc

Issue 5273004: Add "create Application Shortcut" to the app menu on NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase for commit. Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/gtk/browser_window_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index b4e706d71179e642dd5501f74c98d398506fe18f..96e497f2e1bc8e913d696b887332ed2f4ae45811 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) {
- int value;
+ const std::string& extension_id,
+ ExtensionPrefs::LaunchType default_pref_value) {
+ int value = -1;
+ LaunchType result = LAUNCH_REGULAR;
+
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,
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/gtk/browser_window_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698