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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, | 445 void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id, |
446 bool allow) { | 446 bool allow) { |
447 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, | 447 UpdateExtensionPref(extension_id, kPrefAllowFileAccess, |
448 Value::CreateBooleanValue(allow)); | 448 Value::CreateBooleanValue(allow)); |
449 SavePrefsAndNotify(); | 449 SavePrefsAndNotify(); |
450 } | 450 } |
451 | 451 |
452 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( | 452 ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType( |
453 const std::string& extension_id) { | 453 const std::string& extension_id) { |
454 int value; | 454 int value; |
455 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && ( | 455 if (ReadExtensionPrefInteger(extension_id, kPrefLaunchType, &value) && |
456 value == LAUNCH_PINNED || | 456 (value == LAUNCH_PINNED || |
457 value == LAUNCH_REGULAR || | 457 value == LAUNCH_REGULAR || |
458 value == LAUNCH_FULLSCREEN)) { | 458 value == LAUNCH_FULLSCREEN || |
459 value == LAUNCH_WINDOW)) { | |
460 | |
461 #if defined(OS_MACOSX) | |
462 // App windows are not yet supported on mac. Pref sync could make | |
463 // the launch type LAUNCH_WINDOW, even if there is no UI to set it | |
464 // on mac. | |
465 if (value == LAUNCH_WINDOW) | |
466 return LAUNCH_REGULAR; | |
Aaron Boodman
2010/11/18 07:49:03
Nice catch.
| |
467 #endif | |
459 return static_cast<LaunchType>(value); | 468 return static_cast<LaunchType>(value); |
460 } | 469 } |
470 | |
461 return LAUNCH_REGULAR; | 471 return LAUNCH_REGULAR; |
462 } | 472 } |
463 | 473 |
464 void ExtensionPrefs::SetLaunchType(const std::string& extension_id, | 474 void ExtensionPrefs::SetLaunchType(const std::string& extension_id, |
465 LaunchType launch_type) { | 475 LaunchType launch_type) { |
466 UpdateExtensionPref(extension_id, kPrefLaunchType, | 476 UpdateExtensionPref(extension_id, kPrefLaunchType, |
467 Value::CreateIntegerValue(static_cast<int>(launch_type))); | 477 Value::CreateIntegerValue(static_cast<int>(launch_type))); |
468 SavePrefsAndNotify(); | 478 SavePrefsAndNotify(); |
469 } | 479 } |
470 | 480 |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { | 934 void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) { |
925 prefs->RegisterDictionaryPref(kExtensionsPref); | 935 prefs->RegisterDictionaryPref(kExtensionsPref); |
926 prefs->RegisterListPref(kExtensionToolbar); | 936 prefs->RegisterListPref(kExtensionToolbar); |
927 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); | 937 prefs->RegisterIntegerPref(prefs::kExtensionToolbarSize, -1); |
928 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); | 938 prefs->RegisterDictionaryPref(kExtensionsBlacklistUpdate); |
929 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); | 939 prefs->RegisterListPref(prefs::kExtensionInstallAllowList); |
930 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); | 940 prefs->RegisterListPref(prefs::kExtensionInstallDenyList); |
931 prefs->RegisterListPref(prefs::kExtensionInstallForceList); | 941 prefs->RegisterListPref(prefs::kExtensionInstallForceList); |
932 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); | 942 prefs->RegisterStringPref(kWebStoreLogin, std::string() /* default_value */); |
933 } | 943 } |
OLD | NEW |