| 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 16 matching lines...) Expand all Loading... |
| 27 // A preference set by the the NTP to persist the desired launch container type | 27 // A preference set by the the NTP to persist the desired launch container type |
| 28 // used for apps. | 28 // used for apps. |
| 29 const char kPrefLaunchType[] = "launchType"; | 29 const char kPrefLaunchType[] = "launchType"; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 namespace launch_util { | 33 namespace launch_util { |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 36 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 37 registry->RegisterIntegerPref( | 37 registry->RegisterIntegerPref(pref_names::kBookmarkAppCreationLaunchType, |
| 38 pref_names::kBookmarkAppCreationLaunchType, | 38 LAUNCH_TYPE_REGULAR); |
| 39 LAUNCH_TYPE_REGULAR, | |
| 40 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
| 41 } | 39 } |
| 42 | 40 |
| 43 } // namespace launch_util | 41 } // namespace launch_util |
| 44 | 42 |
| 45 LaunchType GetLaunchType(const ExtensionPrefs* prefs, | 43 LaunchType GetLaunchType(const ExtensionPrefs* prefs, |
| 46 const Extension* extension) { | 44 const Extension* extension) { |
| 47 LaunchType result = LAUNCH_TYPE_DEFAULT; | 45 LaunchType result = LAUNCH_TYPE_DEFAULT; |
| 48 | 46 |
| 49 int value = GetLaunchTypePrefValue(prefs, extension->id()); | 47 int value = GetLaunchTypePrefValue(prefs, extension->id()); |
| 50 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) | 48 if (value >= LAUNCH_TYPE_FIRST && value < NUM_LAUNCH_TYPES) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, | 138 bool HasPreferredLaunchContainer(const ExtensionPrefs* prefs, |
| 141 const Extension* extension) { | 139 const Extension* extension) { |
| 142 int value = -1; | 140 int value = -1; |
| 143 LaunchContainer manifest_launch_container = | 141 LaunchContainer manifest_launch_container = |
| 144 AppLaunchInfo::GetLaunchContainer(extension); | 142 AppLaunchInfo::GetLaunchContainer(extension); |
| 145 return manifest_launch_container == LAUNCH_CONTAINER_TAB && | 143 return manifest_launch_container == LAUNCH_CONTAINER_TAB && |
| 146 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); | 144 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); |
| 147 } | 145 } |
| 148 | 146 |
| 149 } // namespace extensions | 147 } // namespace extensions |
| OLD | NEW |