Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Side by Side Diff: chrome/browser/extensions/api/settings_private/prefs_util.cc

Issue 2877173002: Add scale to settings-slider (Closed)
Patch Set: Less code in the |scale| comment. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/controls/settings_slider.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/api/settings_private/prefs_util.h" 5 #include "chrome/browser/extensions/api/settings_private/prefs_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/chrome_extension_function.h" 9 #include "chrome/browser/extensions/chrome_extension_function.h"
10 #include "chrome/browser/extensions/settings_api_helpers.h" 10 #include "chrome/browser/extensions/settings_api_helpers.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 PrefService* pref_service = FindServiceForPref(pref_name); 537 PrefService* pref_service = FindServiceForPref(pref_name);
538 538
539 if (!IsPrefUserModifiable(pref_name)) 539 if (!IsPrefUserModifiable(pref_name))
540 return PREF_NOT_MODIFIABLE; 540 return PREF_NOT_MODIFIABLE;
541 541
542 const PrefService::Preference* pref = pref_service->FindPreference(pref_name); 542 const PrefService::Preference* pref = pref_service->FindPreference(pref_name);
543 if (!pref) 543 if (!pref)
544 return PREF_NOT_FOUND; 544 return PREF_NOT_FOUND;
545 545
546 DCHECK_EQ(pref->GetType(), value->GetType());
547
548 switch (pref->GetType()) { 546 switch (pref->GetType()) {
549 case base::Value::Type::BOOLEAN: 547 case base::Value::Type::BOOLEAN:
550 case base::Value::Type::DOUBLE: 548 case base::Value::Type::DOUBLE:
551 case base::Value::Type::LIST: 549 case base::Value::Type::LIST:
552 case base::Value::Type::DICTIONARY: 550 case base::Value::Type::DICTIONARY:
553 pref_service->Set(pref_name, *value); 551 pref_service->Set(pref_name, *value);
554 break; 552 break;
555 case base::Value::Type::INTEGER: { 553 case base::Value::Type::INTEGER: {
556 // In JS all numbers are doubles. 554 // In JS all numbers are doubles.
557 double double_value; 555 double double_value;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_) 769 ExtensionPrefValueMapFactory::GetForBrowserContext(profile_)
772 ->GetExtensionControllingPref(pref_object.key); 770 ->GetExtensionControllingPref(pref_object.key);
773 if (extension_id.empty()) 771 if (extension_id.empty())
774 return nullptr; 772 return nullptr;
775 773
776 return ExtensionRegistry::Get(profile_)->GetExtensionById( 774 return ExtensionRegistry::Get(profile_)->GetExtensionById(
777 extension_id, ExtensionRegistry::ENABLED); 775 extension_id, ExtensionRegistry::ENABLED);
778 } 776 }
779 777
780 } // namespace extensions 778 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/controls/settings_slider.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698