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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 102103005: Move c/c/e/extension_set to top-level extensions/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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
OLDNEW
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/ui/webui/options/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/extensions/extension_special_storage_policy.h" 24 #include "chrome/browser/extensions/extension_special_storage_policy.h"
25 #include "chrome/browser/google/google_util.h" 25 #include "chrome/browser/google/google_util.h"
26 #include "chrome/browser/notifications/desktop_notification_service.h" 26 #include "chrome/browser/notifications/desktop_notification_service.h"
27 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 27 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/content_settings.h" 31 #include "chrome/common/content_settings.h"
32 #include "chrome/common/content_settings_pattern.h" 32 #include "chrome/common/content_settings_pattern.h"
33 #include "chrome/common/extensions/extension_set.h"
34 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
35 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
36 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
37 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/notification_source.h" 37 #include "content/public/browser/notification_source.h"
39 #include "content/public/browser/notification_types.h" 38 #include "content/public/browser/notification_types.h"
40 #include "content/public/browser/user_metrics.h" 39 #include "content/public/browser/user_metrics.h"
41 #include "content/public/browser/web_ui.h" 40 #include "content/public/browser/web_ui.h"
42 #include "content/public/common/content_switches.h" 41 #include "content/public/common/content_switches.h"
42 #include "extensions/common/extension_set.h"
43 #include "extensions/common/permissions/api_permission.h" 43 #include "extensions/common/permissions/api_permission.h"
44 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
45 #include "grit/locale_settings.h" 45 #include "grit/locale_settings.h"
46 #include "ui/base/l10n/l10n_util.h" 46 #include "ui/base/l10n/l10n_util.h"
47 47
48 #if defined(OS_CHROMEOS) 48 #if defined(OS_CHROMEOS)
49 #include "chrome/browser/chromeos/login/user_manager.h" 49 #include "chrome/browser/chromeos/login/user_manager.h"
50 #endif 50 #endif
51 51
52 using content::UserMetricsAction; 52 using content::UserMetricsAction;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 exceptions->Append(exception); 219 exceptions->Append(exception);
220 } 220 }
221 221
222 // Asks the |profile| for hosted apps which have the |permission| set, and 222 // Asks the |profile| for hosted apps which have the |permission| set, and
223 // adds their web extent and launch URL to the |exceptions| list. 223 // adds their web extent and launch URL to the |exceptions| list.
224 void AddExceptionsGrantedByHostedApps( 224 void AddExceptionsGrantedByHostedApps(
225 Profile* profile, AppFilter app_filter, ListValue* exceptions) { 225 Profile* profile, AppFilter app_filter, ListValue* exceptions) {
226 const ExtensionService* extension_service = profile->GetExtensionService(); 226 const ExtensionService* extension_service = profile->GetExtensionService();
227 // After ExtensionSystem::Init has been called at the browser's start, 227 // After ExtensionSystem::Init has been called at the browser's start,
228 // GetExtensionService() should not return NULL, so this is safe: 228 // GetExtensionService() should not return NULL, so this is safe:
229 const ExtensionSet* extensions = extension_service->extensions(); 229 const extensions::ExtensionSet* extensions = extension_service->extensions();
230 230
231 for (ExtensionSet::const_iterator extension = extensions->begin(); 231 for (extensions::ExtensionSet::const_iterator extension = extensions->begin();
232 extension != extensions->end(); ++extension) { 232 extension != extensions->end(); ++extension) {
233 if (!app_filter(*extension->get(), profile)) 233 if (!app_filter(*extension->get(), profile))
234 continue; 234 continue;
235 235
236 extensions::URLPatternSet web_extent = (*extension)->web_extent(); 236 extensions::URLPatternSet web_extent = (*extension)->web_extent();
237 // Add patterns from web extent. 237 // Add patterns from web extent.
238 for (extensions::URLPatternSet::const_iterator pattern = web_extent.begin(); 238 for (extensions::URLPatternSet::const_iterator pattern = web_extent.begin();
239 pattern != web_extent.end(); ++pattern) { 239 pattern != web_extent.end(); ++pattern) {
240 std::string url_pattern = pattern->GetAsString(); 240 std::string url_pattern = pattern->GetAsString();
241 AddExceptionForHostedApp(url_pattern, *extension->get(), exceptions); 241 AddExceptionForHostedApp(url_pattern, *extension->get(), exceptions);
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1464 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1465 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1465 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
1466 // Exceptions apply only when the feature is enabled. 1466 // Exceptions apply only when the feature is enabled.
1467 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1467 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1468 web_ui()->CallJavascriptFunction( 1468 web_ui()->CallJavascriptFunction(
1469 "ContentSettings.enableProtectedContentExceptions", 1469 "ContentSettings.enableProtectedContentExceptions",
1470 base::FundamentalValue(enable_exceptions)); 1470 base::FundamentalValue(enable_exceptions));
1471 } 1471 }
1472 1472
1473 } // namespace options 1473 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.cc ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698