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

Side by Side Diff: chrome/browser/extensions/api/permissions/permissions_api.cc

Issue 957753002: Install default apps if sync is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check if sync is enabled locally. Created 5 years, 9 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
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/extensions/api/permissions/permissions_api.h" 5 #include "chrome/browser/extensions/api/permissions/permissions_api.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" 9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
10 #include "chrome/browser/extensions/extension_management.h" 10 #include "chrome/browser/extensions/extension_management.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 perms_updater.AddPermissions(extension(), requested_permissions_.get()); 201 perms_updater.AddPermissions(extension(), requested_permissions_.get());
202 results_ = Request::Results::Create(true); 202 results_ = Request::Results::Create(true);
203 SendResponse(true); 203 SendResponse(true);
204 return true; 204 return true;
205 } 205 }
206 206
207 // Filter out the granted permissions so we only prompt for new ones. 207 // Filter out the granted permissions so we only prompt for new ones.
208 requested_permissions_ = PermissionSet::CreateDifference( 208 requested_permissions_ = PermissionSet::CreateDifference(
209 requested_permissions_.get(), granted.get()); 209 requested_permissions_.get(), granted.get());
210 210
211 // Filter out the active permissions.
212 requested_permissions_ = PermissionSet::CreateDifference(
213 requested_permissions_.get(),
214 extension()->permissions_data()->active_permissions().get());
215
211 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort(). 216 AddRef(); // Balanced in InstallUIProceed() / InstallUIAbort().
212 217
213 // We don't need to show the prompt if there are no new warnings, or if 218 // We don't need to show the prompt if there are no new warnings, or if
214 // we're skipping the confirmation UI. All extension types but INTERNAL 219 // we're skipping the confirmation UI. All extension types but INTERNAL
215 // are allowed to silently increase their permission level. 220 // are allowed to silently increase their permission level.
216 bool has_no_warnings = PermissionMessageProvider::Get() 221 bool has_no_warnings = PermissionMessageProvider::Get()
217 ->GetWarningMessages(requested_permissions_.get(), 222 ->GetWarningMessages(requested_permissions_.get(),
218 extension()->GetType()) 223 extension()->GetType())
219 .empty(); 224 .empty();
220 if (auto_confirm_for_tests == PROCEED || has_no_warnings || 225 if (auto_confirm_for_tests == PROCEED || has_no_warnings ||
221 extension_->location() == Manifest::COMPONENT) { 226 extension_->location() == Manifest::COMPONENT) {
222 InstallUIProceed(); 227 InstallUIProceed();
223 } else if (auto_confirm_for_tests == ABORT) { 228 } else if (auto_confirm_for_tests == ABORT) {
224 // Pretend the user clicked cancel. 229 // Pretend the user clicked cancel.
225 InstallUIAbort(true); 230 InstallUIAbort(true);
226 } else { 231 } else {
227 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); 232 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests);
228 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); 233 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents()));
229 install_ui_->ConfirmPermissions( 234 install_ui_->ConfirmPermissions(
230 this, extension(), requested_permissions_.get()); 235 this, extension(), requested_permissions_.get());
231 } 236 }
232 237
233 return true; 238 return true;
234 } 239 }
235 240
236 } // namespace extensions 241 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/external_pref_loader.h » ('j') | chrome/browser/extensions/external_pref_loader.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698