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

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

Issue 2071293002: Reinstate evil hack to suppress permission warnings for searchProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comments Created 4 years, 6 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 <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 bool SettingsOverrideAPIPermission::Equal(const APIPermission* rhs) const { 44 bool SettingsOverrideAPIPermission::Equal(const APIPermission* rhs) const {
45 if (this != rhs) 45 if (this != rhs)
46 CHECK_EQ(info(), rhs->info()); 46 CHECK_EQ(info(), rhs->info());
47 return true; 47 return true;
48 } 48 }
49 49
50 bool SettingsOverrideAPIPermission::FromValue( 50 bool SettingsOverrideAPIPermission::FromValue(
51 const base::Value* value, 51 const base::Value* value,
52 std::string* /*error*/, 52 std::string* /*error*/,
53 std::vector<std::string>* unhandled_permissions) { 53 std::vector<std::string>* unhandled_permissions) {
54 return value && value->GetAsString(&setting_value_); 54 // Ugly hack: |value| being null should be an error. But before M46 beta, we
55 // didn't store the parameter for settings override permissions in prefs.
56 // See crbug.com/533086 and crbug.com/619759.
57 // TODO(treib,devlin): Remove this for M56, when hopefully all users will have
58 // updated prefs.
59 // This should read:
60 // return value && value->GetAsString(&setting_value_);
61 return !value || value->GetAsString(&setting_value_);
55 } 62 }
56 63
57 std::unique_ptr<base::Value> SettingsOverrideAPIPermission::ToValue() const { 64 std::unique_ptr<base::Value> SettingsOverrideAPIPermission::ToValue() const {
58 return base::WrapUnique(new base::StringValue(setting_value_)); 65 return base::WrapUnique(new base::StringValue(setting_value_));
59 } 66 }
60 67
61 APIPermission* SettingsOverrideAPIPermission::Clone() const { 68 APIPermission* SettingsOverrideAPIPermission::Clone() const {
62 return new SettingsOverrideAPIPermission(info(), setting_value_); 69 return new SettingsOverrideAPIPermission(info(), setting_value_);
63 } 70 }
64 71
(...skipping 22 matching lines...) Expand all
87 bool SettingsOverrideAPIPermission::Read(const base::Pickle* m, 94 bool SettingsOverrideAPIPermission::Read(const base::Pickle* m,
88 base::PickleIterator* iter) { 95 base::PickleIterator* iter) {
89 return true; 96 return true;
90 } 97 }
91 98
92 void SettingsOverrideAPIPermission::Log(std::string* log) const { 99 void SettingsOverrideAPIPermission::Log(std::string* log) const {
93 *log = setting_value_; 100 *log = setting_value_;
94 } 101 }
95 102
96 } // namespace extensions 103 } // 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