| 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 "build/build_config.h" | 8 #include "build/build_config.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; | 76 ? static_cast<LaunchType>(value) : LAUNCH_TYPE_INVALID; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void SetLaunchType(content::BrowserContext* context, | 79 void SetLaunchType(content::BrowserContext* context, |
| 80 const std::string& extension_id, | 80 const std::string& extension_id, |
| 81 LaunchType launch_type) { | 81 LaunchType launch_type) { |
| 82 DCHECK(launch_type >= LAUNCH_TYPE_FIRST && launch_type < NUM_LAUNCH_TYPES); | 82 DCHECK(launch_type >= LAUNCH_TYPE_FIRST && launch_type < NUM_LAUNCH_TYPES); |
| 83 | 83 |
| 84 ExtensionPrefs::Get(context)->UpdateExtensionPref( | 84 ExtensionPrefs::Get(context)->UpdateExtensionPref( |
| 85 extension_id, kPrefLaunchType, | 85 extension_id, kPrefLaunchType, |
| 86 new base::FundamentalValue(static_cast<int>(launch_type))); | 86 new base::Value(static_cast<int>(launch_type))); |
| 87 | 87 |
| 88 // Sync the launch type. | 88 // Sync the launch type. |
| 89 const Extension* extension = | 89 const Extension* extension = |
| 90 ExtensionRegistry::Get(context) | 90 ExtensionRegistry::Get(context) |
| 91 ->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); | 91 ->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); |
| 92 if (extension) | 92 if (extension) |
| 93 ExtensionSyncService::Get(context)->SyncExtensionChangeIfNeeded(*extension); | 93 ExtensionSyncService::Get(context)->SyncExtensionChangeIfNeeded(*extension); |
| 94 } | 94 } |
| 95 | 95 |
| 96 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, | 96 LaunchContainer GetLaunchContainer(const ExtensionPrefs* prefs, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); | 154 prefs->ReadPrefAsInteger(extension->id(), kPrefLaunchType, &value); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool LaunchesInWindow(content::BrowserContext* context, | 157 bool LaunchesInWindow(content::BrowserContext* context, |
| 158 const Extension* extension) { | 158 const Extension* extension) { |
| 159 return GetLaunchType(ExtensionPrefs::Get(context), extension) == | 159 return GetLaunchType(ExtensionPrefs::Get(context), extension) == |
| 160 LAUNCH_TYPE_WINDOW; | 160 LAUNCH_TYPE_WINDOW; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace extensions | 163 } // namespace extensions |
| OLD | NEW |