Chromium Code Reviews| 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. one of IsNewBookmarkAppsEnabled() or CanHostedAppsOpenInWindows() are | |
|
benwells
2015/08/19 02:39:21
Why does this depend on IsNewBookmarkAppsEnabled a
dominickn
2015/08/19 03:01:13
I kept it like this because the new bookmark apps
benwells
2015/08/19 03:26:52
I'm not sure, but it shouldn't depend on the curre
dominickn
2015/08/19 05:21:58
Done.
| |
| 56 // false | |
| 57 if (!extension->is_platform_app() && result == LAUNCH_TYPE_WINDOW && | |
| 58 (!extensions::util::IsNewBookmarkAppsEnabled() || | |
| 59 !extensions::util::CanHostedAppsOpenInWindows())) { | |
| 54 result = LAUNCH_TYPE_REGULAR; | 60 result = LAUNCH_TYPE_REGULAR; |
| 61 } | |
| 55 #else | 62 #else |
| 56 if (extensions::util::IsNewBookmarkAppsEnabled()) { | 63 if (extensions::util::IsNewBookmarkAppsEnabled()) { |
| 57 if (result == LAUNCH_TYPE_PINNED) | 64 if (result == LAUNCH_TYPE_PINNED) |
| 58 result = LAUNCH_TYPE_REGULAR; | 65 result = LAUNCH_TYPE_REGULAR; |
| 59 if (result == LAUNCH_TYPE_FULLSCREEN) | 66 if (result == LAUNCH_TYPE_FULLSCREEN) |
| 60 result = LAUNCH_TYPE_WINDOW; | 67 result = LAUNCH_TYPE_WINDOW; |
| 61 } | 68 } |
| 62 #endif | 69 #endif |
| 63 | 70 |
| 64 return result; | 71 return result; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); | 157 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); |
| 151 } | 158 } |
| 152 | 159 |
| 153 bool LaunchesInWindow(content::BrowserContext* context, | 160 bool LaunchesInWindow(content::BrowserContext* context, |
| 154 const Extension* extension) { | 161 const Extension* extension) { |
| 155 return GetLaunchType(ExtensionPrefs::Get(context), extension) == | 162 return GetLaunchType(ExtensionPrefs::Get(context), extension) == |
| 156 LAUNCH_TYPE_WINDOW; | 163 LAUNCH_TYPE_WINDOW; |
| 157 } | 164 } |
| 158 | 165 |
| 159 } // namespace extensions | 166 } // namespace extensions |
| OLD | NEW |