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

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

Issue 314113010: Remove deprecated permissions functions from Extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/notification_source.h" 39 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/notification_types.h" 40 #include "content/public/browser/notification_types.h"
41 #include "content/public/browser/user_metrics.h" 41 #include "content/public/browser/user_metrics.h"
42 #include "content/public/browser/web_ui.h" 42 #include "content/public/browser/web_ui.h"
43 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
44 #include "content/public/common/page_zoom.h" 44 #include "content/public/common/page_zoom.h"
45 #include "extensions/common/extension_set.h" 45 #include "extensions/common/extension_set.h"
46 #include "extensions/common/permissions/api_permission.h" 46 #include "extensions/common/permissions/api_permission.h"
47 #include "extensions/common/permissions/permissions_data.h"
47 #include "grit/generated_resources.h" 48 #include "grit/generated_resources.h"
48 #include "grit/locale_settings.h" 49 #include "grit/locale_settings.h"
49 #include "ui/base/l10n/l10n_util.h" 50 #include "ui/base/l10n/l10n_util.h"
50 51
51 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
52 #include "chrome/browser/chromeos/login/users/user_manager.h" 53 #include "chrome/browser/chromeos/login/users/user_manager.h"
53 #endif 54 #endif
54 55
55 using base::UserMetricsAction; 56 using base::UserMetricsAction;
56 using extensions::APIPermission; 57 using extensions::APIPermission;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 exception->SetString(kOrigin, pattern.ToString()); 204 exception->SetString(kOrigin, pattern.ToString());
204 exception->SetString(kSource, provider_name); 205 exception->SetString(kSource, provider_name);
205 return exception; 206 return exception;
206 } 207 }
207 208
208 // Returns true whenever the |extension| is hosted and has |permission|. 209 // Returns true whenever the |extension| is hosted and has |permission|.
209 // Must have the AppFilter signature. 210 // Must have the AppFilter signature.
210 template <APIPermission::ID permission> 211 template <APIPermission::ID permission>
211 bool HostedAppHasPermission( 212 bool HostedAppHasPermission(
212 const extensions::Extension& extension, Profile* /*profile*/) { 213 const extensions::Extension& extension, Profile* /*profile*/) {
213 return extension.is_hosted_app() && extension.HasAPIPermission(permission); 214 return extension.is_hosted_app() &&
215 extension.permissions_data()->HasAPIPermission(permission);
214 } 216 }
215 217
216 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from 218 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from
217 // the web extent of a hosted |app|. 219 // the web extent of a hosted |app|.
218 void AddExceptionForHostedApp(const std::string& url_pattern, 220 void AddExceptionForHostedApp(const std::string& url_pattern,
219 const extensions::Extension& app, base::ListValue* exceptions) { 221 const extensions::Extension& app, base::ListValue* exceptions) {
220 base::DictionaryValue* exception = new base::DictionaryValue(); 222 base::DictionaryValue* exception = new base::DictionaryValue();
221 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW)); 223 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW));
222 exception->SetString(kOrigin, url_pattern); 224 exception->SetString(kOrigin, url_pattern);
223 exception->SetString(kEmbeddingOrigin, url_pattern); 225 exception->SetString(kEmbeddingOrigin, url_pattern);
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1565 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1564 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1566 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
1565 // Exceptions apply only when the feature is enabled. 1567 // Exceptions apply only when the feature is enabled.
1566 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1568 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1567 web_ui()->CallJavascriptFunction( 1569 web_ui()->CallJavascriptFunction(
1568 "ContentSettings.enableProtectedContentExceptions", 1570 "ContentSettings.enableProtectedContentExceptions",
1569 base::FundamentalValue(enable_exceptions)); 1571 base::FundamentalValue(enable_exceptions));
1570 } 1572 }
1571 1573
1572 } // namespace options 1574 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698