| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/launch_util.h" | 5 #include "chrome/browser/extensions/launch_util.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_sync_service.h" | 9 #include "chrome/browser/extensions/extension_sync_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // Launch hosted apps as windows by default for streamlined hosted apps. | 49 // Launch hosted apps as windows by default for streamlined hosted apps. |
| 50 if (util::IsStreamlinedHostedAppsEnabled() && | 50 if (util::IsStreamlinedHostedAppsEnabled() && |
| 51 extension->id() != extension_misc::kChromeAppId) { | 51 extension->id() != extension_misc::kChromeAppId) { |
| 52 result = LAUNCH_TYPE_WINDOW; | 52 result = LAUNCH_TYPE_WINDOW; |
| 53 } | 53 } |
| 54 | 54 |
| 55 int value = GetLaunchTypePrefValue(prefs, extension->id()); | 55 int value = GetLaunchTypePrefValue(prefs, extension->id()); |
| 56 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) | 56 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) |
| 57 result = static_cast<LaunchType>(value); | 57 result = static_cast<LaunchType>(value); |
| 58 | 58 |
| 59 #if defined(OS_MACOSX) | |
| 60 // App windows are not yet supported on mac. Pref sync could make | |
| 61 // the launch type LAUNCH_TYPE_WINDOW, even if there is no UI to set it | |
| 62 // on mac. | |
| 63 if (!extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW) | |
| 64 result = LAUNCH_TYPE_REGULAR; | |
| 65 #endif | |
| 66 | |
| 67 return result; | 59 return result; |
| 68 } | 60 } |
| 69 | 61 |
| 70 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs, | 62 LaunchType GetLaunchTypePrefValue(const ExtensionPrefs* prefs, |
| 71 const std::string& extension_id) { | 63 const std::string& extension_id) { |
| 72 int value = LAUNCH_TYPE_INVALID; | 64 int value = LAUNCH_TYPE_INVALID; |
| 73 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value) | 65 return prefs->ReadPrefAsInteger(extension_id, kPrefLaunchType, &value) |
| 74 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; | 66 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; |
| 75 } | 67 } |
| 76 | 68 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, | 140 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, |
| 149 const Extension* extension) { | 141 const Extension* extension) { |
| 150 int value = -1; | 142 int value = -1; |
| 151 LaunchContainer manifest_launch_container = | 143 LaunchContainer manifest_launch_container = |
| 152 AppLaunchInfo::GetLaunchContainer(extension); | 144 AppLaunchInfo::GetLaunchContainer(extension); |
| 153 return manifest_launch_container == LAUNCH_CONTAINER_TAB && | 145 return manifest_launch_container == LAUNCH_CONTAINER_TAB && |
| 154 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); | 146 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); |
| 155 } | 147 } |
| 156 | 148 |
| 157 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |