| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_prefs.h" | 5 #include "chrome/browser/extensions/extension_prefs.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 449 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
| 450 bool allow) { | 450 bool allow) { |
| 451 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 451 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
| 452 Value::CreateBooleanValue(allow)); | 452 Value::CreateBooleanValue(allow)); |
| 453 SavePrefsAndNotify(); | 453 SavePrefsAndNotify(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( | 456 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( |
| 457 const std::string& extension_id) { | 457 const std::string& extension_id) { |
| 458 int value; | 458 int value; |
| 459 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && ( | 459 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && |
| 460 value == LAUNCH_PINNED || | 460 (value == LAUNCH_PINNED || |
| 461 value == LAUNCH_REGULAR || | 461 value == LAUNCH_REGULAR || |
| 462 value == LAUNCH_FULLSCREEN)) { | 462 value == LAUNCH_FULLSCREEN || |
| 463 value == LAUNCH_WINDOW)) { |
| 464 |
| 465 #if defined(OS_MACOSX) |
| 466 // App windows are not yet supported on mac. Pref sync could make |
| 467 // the launch type LAUNCH_WINDOW, even if there is no UI to set it |
| 468 // on mac. |
| 469 if (value == LAUNCH_WINDOW) |
| 470 return LAUNCH_REGULAR; |
| 471 #endif |
| 463 return static_cast<LaunchType>(value); | 472 return static_cast<LaunchType>(value); |
| 464 } | 473 } |
| 474 |
| 465 return LAUNCH_REGULAR; | 475 return LAUNCH_REGULAR; |
| 466 } | 476 } |
| 467 | 477 |
| 468 void ExtensionPrefs::SetLaunchType(const std::string& extension_id, | 478 void ExtensionPrefs::SetLaunchType(const std::string& extension_id, |
| 469 LaunchType launch_type) { | 479 LaunchType launch_type) { |
| 470 UpdateExtensionPref(extension_id, kPrefLaunchType, | 480 UpdateExtensionPref(extension_id, kPrefLaunchType, |
| 471 Value::CreateIntegerValue(static_cast<int>(launch_type))); | 481 Value::CreateIntegerValue(static_cast<int>(launch_type))); |
| 472 SavePrefsAndNotify(); | 482 SavePrefsAndNotify(); |
| 473 } | 483 } |
| 474 | 484 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 962 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
| 953 prefs->RegisterDictionaryPref(kExtensionsPref); | 963 prefs->RegisterDictionaryPref(kExtensionsPref); |
| 954 prefs->RegisterListPref(kExtensionToolbar); | 964 prefs->RegisterListPref(kExtensionToolbar); |
| 955 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 965 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
| 956 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 966 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
| 957 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 967 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
| 958 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 968 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
| 959 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 969 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
| 960 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 970 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
| 961 } | 971 } |
| OLD | NEW |