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

Side by Side Diff: extensions/common/permissions/settings_override_permission.cc

Issue 1774103002: Cleanup: remove evil hack to suppress permission warnings for searchProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/common/permissions/settings_override_permission.h" 5 #include "extensions/common/permissions/settings_override_permission.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "extensions/common/permissions/api_permission_set.h" 8 #include "extensions/common/permissions/api_permission_set.h"
9 #include "grit/extensions_strings.h" 9 #include "grit/extensions_strings.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 30 matching lines...) Expand all
41 bool SettingsOverrideAPIPermission::Equal(const APIPermission* rhs) const { 41 bool SettingsOverrideAPIPermission::Equal(const APIPermission* rhs) const {
42 if (this != rhs) 42 if (this != rhs)
43 CHECK_EQ(info(), rhs->info()); 43 CHECK_EQ(info(), rhs->info());
44 return true; 44 return true;
45 } 45 }
46 46
47 bool SettingsOverrideAPIPermission::FromValue( 47 bool SettingsOverrideAPIPermission::FromValue(
48 const base::Value* value, 48 const base::Value* value,
49 std::string* /*error*/, 49 std::string* /*error*/,
50 std::vector<std::string>* unhandled_permissions) { 50 std::vector<std::string>* unhandled_permissions) {
51 // Ugly hack: |value| being null should be an error. But before M46 beta, we 51 return value && value->GetAsString(&setting_value_);
52 // didn't store the parameter for settings override permissions in prefs.
53 // See crbug.com/533086.
54 // TODO(treib,devlin): Remove this for M48, when hopefully all users will have
55 // updated prefs.
56 // This should read:
57 // return value && value->GetAsString(&setting_value_);
58 return !value || value->GetAsString(&setting_value_);
59 } 52 }
60 53
61 scoped_ptr<base::Value> SettingsOverrideAPIPermission::ToValue() const { 54 scoped_ptr<base::Value> SettingsOverrideAPIPermission::ToValue() const {
62 return make_scoped_ptr(new base::StringValue(setting_value_)); 55 return make_scoped_ptr(new base::StringValue(setting_value_));
63 } 56 }
64 57
65 APIPermission* SettingsOverrideAPIPermission::Clone() const { 58 APIPermission* SettingsOverrideAPIPermission::Clone() const {
66 return new SettingsOverrideAPIPermission(info(), setting_value_); 59 return new SettingsOverrideAPIPermission(info(), setting_value_);
67 } 60 }
68 61
(...skipping 20 matching lines...) Expand all
89 bool SettingsOverrideAPIPermission::Read(const base::Pickle* m, 82 bool SettingsOverrideAPIPermission::Read(const base::Pickle* m,
90 base::PickleIterator* iter) { 83 base::PickleIterator* iter) {
91 return true; 84 return true;
92 } 85 }
93 86
94 void SettingsOverrideAPIPermission::Log(std::string* log) const { 87 void SettingsOverrideAPIPermission::Log(std::string* log) const {
95 *log = setting_value_; 88 *log = setting_value_;
96 } 89 }
97 90
98 } // namespace extensions 91 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/permissions/chrome_permission_message_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698