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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 15713003: Supresses app permissions changed dialogs in kiosk mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/usb/usb_service.cc » ('j') | chrome/browser/usb/usb_service.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "base/string_util.h" 21 #include "base/string_util.h"
22 #include "base/stringprintf.h" 22 #include "base/stringprintf.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/threading/sequenced_worker_pool.h" 24 #include "base/threading/sequenced_worker_pool.h"
25 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
26 #include "base/time.h" 26 #include "base/time.h"
27 #include "base/utf_string_conversions.h" 27 #include "base/utf_string_conversions.h"
28 #include "base/values.h" 28 #include "base/values.h"
29 #include "base/version.h" 29 #include "base/version.h"
30 #include "chrome/browser/app_mode/app_mode_utils.h"
30 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
31 #include "chrome/browser/devtools/devtools_window.h" 32 #include "chrome/browser/devtools/devtools_window.h"
32 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h" 33 #include "chrome/browser/extensions/api/app_runtime/app_runtime_api.h"
33 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h" 34 #include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
34 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 35 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
35 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" 36 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h"
36 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" 37 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
37 #include "chrome/browser/extensions/api/runtime/runtime_api.h" 38 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
38 #include "chrome/browser/extensions/api/storage/settings_frontend.h" 39 #include "chrome/browser/extensions/api/storage/settings_frontend.h"
39 #include "chrome/browser/extensions/app_sync_data.h" 40 #include "chrome/browser/extensions/app_sync_data.h"
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 // will record the permissions it recognized, not including "omnibox." 2192 // will record the permissions it recognized, not including "omnibox."
2192 // When upgrading to Chrome 10, "omnibox" will be recognized and Chrome 2193 // When upgrading to Chrome 10, "omnibox" will be recognized and Chrome
2193 // will disable the extension and prompt the user to approve the increase 2194 // will disable the extension and prompt the user to approve the increase
2194 // in privileges. The extension could then release a new version that 2195 // in privileges. The extension could then release a new version that
2195 // removes the "omnibox" permission. When the user upgrades, Chrome will 2196 // removes the "omnibox" permission. When the user upgrades, Chrome will
2196 // still remember that "omnibox" had been granted, so that if the 2197 // still remember that "omnibox" had been granted, so that if the
2197 // extension once again includes "omnibox" in an upgrade, the extension 2198 // extension once again includes "omnibox" in an upgrade, the extension
2198 // can upgrade without requiring this user's approval. 2199 // can upgrade without requiring this user's approval.
2199 int disable_reasons = extension_prefs_->GetDisableReasons(extension->id()); 2200 int disable_reasons = extension_prefs_->GetDisableReasons(extension->id());
2200 2201
2201 bool is_default_app_install = 2202 bool auto_grant_permission =
2202 (!is_extension_upgrade && extension->was_installed_by_default()); 2203 (!is_extension_upgrade && extension->was_installed_by_default()) ||
2204 chrome::IsRunningInForcedAppMode();
2203 // Silently grant all active permissions to default apps only on install. 2205 // Silently grant all active permissions to default apps only on install.
2204 // After install they should behave like other apps. 2206 // After install they should behave like other apps.
2205 if (is_default_app_install) 2207 // Silently grant all active permissions to apps install in kiosk mode on both
2208 // install and update.
2209 if (auto_grant_permission)
2206 GrantPermissions(extension); 2210 GrantPermissions(extension);
2207 2211
2208 bool is_privilege_increase = false; 2212 bool is_privilege_increase = false;
2209 // We only need to compare the granted permissions to the current permissions 2213 // We only need to compare the granted permissions to the current permissions
2210 // if the extension is not allowed to silently increase its permissions. 2214 // if the extension is not allowed to silently increase its permissions.
2211 if (!extensions::PermissionsData::CanSilentlyIncreasePermissions(extension) && 2215 if (!extensions::PermissionsData::CanSilentlyIncreasePermissions(extension) &&
2212 !is_default_app_install) { 2216 !auto_grant_permission) {
2213 // Add all the recognized permissions if the granted permissions list 2217 // Add all the recognized permissions if the granted permissions list
2214 // hasn't been initialized yet. 2218 // hasn't been initialized yet.
2215 scoped_refptr<PermissionSet> granted_permissions = 2219 scoped_refptr<PermissionSet> granted_permissions =
2216 extension_prefs_->GetGrantedPermissions(extension->id()); 2220 extension_prefs_->GetGrantedPermissions(extension->id());
2217 CHECK(granted_permissions.get()); 2221 CHECK(granted_permissions.get());
2218 2222
2219 // Here, we check if an extension's privileges have increased in a manner 2223 // Here, we check if an extension's privileges have increased in a manner
2220 // that requires the user's approval. This could occur because the browser 2224 // that requires the user's approval. This could occur because the browser
2221 // upgraded and recognized additional privileges, or an extension upgrades 2225 // upgraded and recognized additional privileges, or an extension upgrades
2222 // to a version that requires additional privileges. 2226 // to a version that requires additional privileges.
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 } 3116 }
3113 3117
3114 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { 3118 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
3115 update_observers_.AddObserver(observer); 3119 update_observers_.AddObserver(observer);
3116 } 3120 }
3117 3121
3118 void ExtensionService::RemoveUpdateObserver( 3122 void ExtensionService::RemoveUpdateObserver(
3119 extensions::UpdateObserver* observer) { 3123 extensions::UpdateObserver* observer) {
3120 update_observers_.RemoveObserver(observer); 3124 update_observers_.RemoveObserver(observer);
3121 } 3125 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/usb/usb_service.cc » ('j') | chrome/browser/usb/usb_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698