OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/content_settings/content_settings_api.h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // always allowed to clear its own settings. | 80 // always allowed to clear its own settings. |
81 } else { | 81 } else { |
82 // Incognito profiles can't access regular mode ever, they only exist in | 82 // Incognito profiles can't access regular mode ever, they only exist in |
83 // split mode. | 83 // split mode. |
84 if (GetProfile()->IsOffTheRecord()) { | 84 if (GetProfile()->IsOffTheRecord()) { |
85 error_ = keys::kIncognitoContextError; | 85 error_ = keys::kIncognitoContextError; |
86 return false; | 86 return false; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 ContentSettingsStore* store = | 90 scoped_refptr<ContentSettingsStore> store = |
dcheng
2014/08/26 00:50:20
Note: this variable type was rewritten instead of
Jeffrey Yasskin
2014/08/26 01:14:16
The change that introduced the scoped_refptr retur
| |
91 ContentSettingsService::Get(GetProfile())->content_settings_store(); | 91 ContentSettingsService::Get(GetProfile())->content_settings_store(); |
92 store->ClearContentSettingsForExtension(extension_id(), scope); | 92 store->ClearContentSettingsForExtension(extension_id(), scope); |
93 | 93 |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 bool ContentSettingsContentSettingGetFunction::RunSync() { | 97 bool ContentSettingsContentSettingGetFunction::RunSync() { |
98 ContentSettingsType content_type; | 98 ContentSettingsType content_type; |
99 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); | 99 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); |
100 | 100 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 return false; | 231 return false; |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 if (scope == kExtensionPrefsScopeIncognitoSessionOnly && | 235 if (scope == kExtensionPrefsScopeIncognitoSessionOnly && |
236 !GetProfile()->HasOffTheRecordProfile()) { | 236 !GetProfile()->HasOffTheRecordProfile()) { |
237 error_ = pref_keys::kIncognitoSessionOnlyErrorMessage; | 237 error_ = pref_keys::kIncognitoSessionOnlyErrorMessage; |
238 return false; | 238 return false; |
239 } | 239 } |
240 | 240 |
241 ContentSettingsStore* store = | 241 scoped_refptr<ContentSettingsStore> store = |
dcheng
2014/08/26 00:50:20
Note: this variable type was rewritten instead of
| |
242 ContentSettingsService::Get(GetProfile())->content_settings_store(); | 242 ContentSettingsService::Get(GetProfile())->content_settings_store(); |
243 store->SetExtensionContentSetting(extension_id(), primary_pattern, | 243 store->SetExtensionContentSetting(extension_id(), primary_pattern, |
244 secondary_pattern, content_type, | 244 secondary_pattern, content_type, |
245 resource_identifier, setting, scope); | 245 resource_identifier, setting, scope); |
246 return true; | 246 return true; |
247 } | 247 } |
248 | 248 |
249 bool ContentSettingsContentSettingGetResourceIdentifiersFunction::RunAsync() { | 249 bool ContentSettingsContentSettingGetResourceIdentifiersFunction::RunAsync() { |
250 ContentSettingsType content_type; | 250 ContentSettingsType content_type; |
251 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); | 251 EXTENSION_FUNCTION_VALIDATE(RemoveContentType(args_.get(), &content_type)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 SetResult(list); | 283 SetResult(list); |
284 BrowserThread::PostTask( | 284 BrowserThread::PostTask( |
285 BrowserThread::UI, FROM_HERE, base::Bind( | 285 BrowserThread::UI, FROM_HERE, base::Bind( |
286 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: | 286 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: |
287 SendResponse, | 287 SendResponse, |
288 this, | 288 this, |
289 true)); | 289 true)); |
290 } | 290 } |
291 | 291 |
292 } // namespace extensions | 292 } // namespace extensions |
OLD | NEW |