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

Side by Side Diff: chrome/browser/supervised_user/legacy/permission_request_creator_sync.cc

Issue 1033253002: Supervised users: Don't URLEscape extension update requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | 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 "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h" 5 #include "chrome/browser/supervised_user/legacy/permission_request_creator_sync. h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h" 9 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h"
10 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" 10 #include "chrome/browser/supervised_user/supervised_user_settings_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // We allow requesting access if Sync is working or has a transient error. 45 // We allow requesting access if Sync is working or has a transient error.
46 return (state == GoogleServiceAuthError::NONE || 46 return (state == GoogleServiceAuthError::NONE ||
47 state == GoogleServiceAuthError::CONNECTION_FAILED || 47 state == GoogleServiceAuthError::CONNECTION_FAILED ||
48 state == GoogleServiceAuthError::SERVICE_UNAVAILABLE); 48 state == GoogleServiceAuthError::SERVICE_UNAVAILABLE);
49 } 49 }
50 50
51 void PermissionRequestCreatorSync::CreateURLAccessRequest( 51 void PermissionRequestCreatorSync::CreateURLAccessRequest(
52 const GURL& url_requested, 52 const GURL& url_requested,
53 const SuccessCallback& callback) { 53 const SuccessCallback& callback) {
54 CreateRequest(kSupervisedUserAccessRequestKeyPrefix, 54 CreateRequest(kSupervisedUserAccessRequestKeyPrefix,
55 url_requested.spec(), 55 net::EscapeQueryParamValue(url_requested.spec(), true),
56 callback); 56 callback);
57 } 57 }
58 58
59 void PermissionRequestCreatorSync::CreateExtensionUpdateRequest( 59 void PermissionRequestCreatorSync::CreateExtensionUpdateRequest(
60 const std::string& id, 60 const std::string& id,
61 const SuccessCallback& callback) { 61 const SuccessCallback& callback) {
62 CreateRequest(kSupervisedUserUpdateRequestKeyPrefix, id, callback); 62 CreateRequest(kSupervisedUserUpdateRequestKeyPrefix, id, callback);
63 } 63 }
64 64
65 void PermissionRequestCreatorSync::CreateRequest( 65 void PermissionRequestCreatorSync::CreateRequest(
66 const std::string& prefix, 66 const std::string& prefix,
67 const std::string& data, 67 const std::string& data,
68 const SuccessCallback& callback) { 68 const SuccessCallback& callback) {
69 // Escape the data string and add the prefix. 69 // Add the prefix.
Pam (message me for reviews) 2015/03/27 12:13:54 Please add a note to the corresponding .h file men
Marc Treib 2015/03/27 12:19:16 This is a private method. CreateURLAccessRequest a
70 std::string key = SupervisedUserSettingsService::MakeSplitSettingKey( 70 std::string key =
71 prefix, 71 SupervisedUserSettingsService::MakeSplitSettingKey(prefix, data);
72 net::EscapeQueryParamValue(data, true));
73 72
74 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); 73 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
75 // TODO(sergiu): Use sane time here when it's ready. 74 // TODO(sergiu): Use sane time here when it's ready.
76 dict->SetDouble(kSupervisedUserAccessRequestTime, 75 dict->SetDouble(kSupervisedUserAccessRequestTime,
77 base::Time::Now().ToJsTime()); 76 base::Time::Now().ToJsTime());
78 dict->SetString(kSupervisedUserName, name_); 77 dict->SetString(kSupervisedUserName, name_);
79 78
80 // Copy the notification setting of the custodian. 79 // Copy the notification setting of the custodian.
81 const base::Value* value = shared_settings_service_->GetValue( 80 const base::Value* value = shared_settings_service_->GetValue(
82 supervised_user_id_, kNotificationSetting); 81 supervised_user_id_, kNotificationSetting);
83 bool notifications_enabled = false; 82 bool notifications_enabled = false;
84 if (value) { 83 if (value) {
85 bool success = value->GetAsBoolean(&notifications_enabled); 84 bool success = value->GetAsBoolean(&notifications_enabled);
86 DCHECK(success); 85 DCHECK(success);
87 } 86 }
88 dict->SetBoolean(kNotificationSetting, notifications_enabled); 87 dict->SetBoolean(kNotificationSetting, notifications_enabled);
89 88
90 settings_service_->UploadItem(key, dict.Pass()); 89 settings_service_->UploadItem(key, dict.Pass());
91 90
92 callback.Run(true); 91 callback.Run(true);
93 } 92 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698