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_sync_service.h" | 8 #include "chrome/browser/extensions/extension_sync_service.h" |
9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 LaunchType GetLaunchType(const ExtensionPrefs* prefs, | 43 LaunchType GetLaunchType(const ExtensionPrefs* prefs, |
44 const Extension* extension) { | 44 const Extension* extension) { |
45 LaunchType result = LAUNCH_TYPE_DEFAULT; | 45 LaunchType result = LAUNCH_TYPE_DEFAULT; |
46 | 46 |
47 int value = GetLaunchTypePrefValue(prefs, extension->id()); | 47 int value = GetLaunchTypePrefValue(prefs, extension->id()); |
48 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) | 48 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) |
49 result = static_cast<LaunchType>(value); | 49 result = static_cast<LaunchType>(value); |
50 | 50 |
51 #if defined(OS_MACOSX) | 51 #if defined(OS_MACOSX) |
52 // On Mac, opening in a window is currently disabled for non platform apps. | 52 // Disable opening as window on Mac if: |
53 if (!extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW) | 53 // 1. the extension isn't a platform app, AND |
| 54 // 2. the intended result is open as window, AND |
| 55 // 3. CanHostedAppsOpenInWindows() is false |
| 56 if (!extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW && |
| 57 !extensions::util::CanHostedAppsOpenInWindows()) { |
54 result = LAUNCH_TYPE_REGULAR; | 58 result = LAUNCH_TYPE_REGULAR; |
| 59 } |
55 #else | 60 #else |
56 if (extensions::util::IsNewBookmarkAppsEnabled()) { | 61 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
57 if (result == LAUNCH_TYPE_PINNED) | 62 if (result == LAUNCH_TYPE_PINNED) |
58 result = LAUNCH_TYPE_REGULAR; | 63 result = LAUNCH_TYPE_REGULAR; |
59 if (result == LAUNCH_TYPE_FULLSCREEN) | 64 if (result == LAUNCH_TYPE_FULLSCREEN) |
60 result = LAUNCH_TYPE_WINDOW; | 65 result = LAUNCH_TYPE_WINDOW; |
61 } | 66 } |
62 #endif | 67 #endif |
63 | 68 |
64 return result; | 69 return result; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); | 155 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); |
151 } | 156 } |
152 | 157 |
153 bool LaunchesInWindow(content::BrowserContext* context, | 158 bool LaunchesInWindow(content::BrowserContext* context, |
154 const Extension* extension) { | 159 const Extension* extension) { |
155 return GetLaunchType(ExtensionPrefs::Get(context), extension) == | 160 return GetLaunchType(ExtensionPrefs::Get(context), extension) == |
156 LAUNCH_TYPE_WINDOW; | 161 LAUNCH_TYPE_WINDOW; |
157 } | 162 } |
158 | 163 |
159 } // namespace extensions | 164 } // namespace extensions |
OLD | NEW |