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/permissions_updater.h" | 5 #include "chrome/browser/extensions/permissions_updater.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 bounded_active = active_permissions = | 177 bounded_active = active_permissions = |
178 extension->permissions_data()->active_permissions(); | 178 extension->permissions_data()->active_permissions(); |
179 } else { | 179 } else { |
180 active_permissions = ExtensionPrefs::Get(browser_context_) | 180 active_permissions = ExtensionPrefs::Get(browser_context_) |
181 ->GetActivePermissions(extension->id()); | 181 ->GetActivePermissions(extension->id()); |
182 bounded_active = GetBoundedActivePermissions(extension, active_permissions); | 182 bounded_active = GetBoundedActivePermissions(extension, active_permissions); |
183 } | 183 } |
184 | 184 |
185 // Determine whether or not to withhold host permissions. | 185 // Determine whether or not to withhold host permissions. |
186 bool should_withhold_permissions = false; | 186 bool should_withhold_permissions = false; |
187 if (util::ScriptsMayRequireActionForExtension(extension, | 187 if (PermissionsData::ScriptsMayRequireActionForExtension( |
188 bounded_active.get())) { | 188 extension, bounded_active.get())) { |
189 should_withhold_permissions = | 189 should_withhold_permissions = |
190 init_flag_ & INIT_FLAG_TRANSIENT ? | 190 init_flag_ & INIT_FLAG_TRANSIENT ? |
191 !util::DefaultAllowedScriptingOnAllUrls() : | 191 !util::DefaultAllowedScriptingOnAllUrls() : |
192 !util::AllowedScriptingOnAllUrls(extension->id(), browser_context_); | 192 !util::AllowedScriptingOnAllUrls(extension->id(), browser_context_); |
193 } | 193 } |
194 | 194 |
195 URLPatternSet granted_explicit_hosts; | 195 URLPatternSet granted_explicit_hosts; |
196 URLPatternSet withheld_explicit_hosts; | 196 URLPatternSet withheld_explicit_hosts; |
197 SegregateUrlPermissions(bounded_active->explicit_hosts(), | 197 SegregateUrlPermissions(bounded_active->explicit_hosts(), |
198 should_withhold_permissions, | 198 should_withhold_permissions, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 Profile::FromBrowserContext(host->GetBrowserContext()))) { | 369 Profile::FromBrowserContext(host->GetBrowserContext()))) { |
370 host->Send(new ExtensionMsg_UpdatePermissions(params)); | 370 host->Send(new ExtensionMsg_UpdatePermissions(params)); |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
374 // Trigger the onAdded and onRemoved events in the extension. | 374 // Trigger the onAdded and onRemoved events in the extension. |
375 DispatchEvent(extension->id(), event_name, changed); | 375 DispatchEvent(extension->id(), event_name, changed); |
376 } | 376 } |
377 | 377 |
378 } // namespace extensions | 378 } // namespace extensions |
OLD | NEW |