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

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

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 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
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/extensions/api/permissions/permissions_api_helpers.h" 8 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/permissions_updater.h" 10 #include "chrome/browser/extensions/permissions_updater.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 auto_confirm_for_tests = should_proceed ? PROCEED : ABORT; 110 auto_confirm_for_tests = should_proceed ? PROCEED : ABORT;
111 } 111 }
112 112
113 // static 113 // static
114 void RequestPermissionsFunction::SetIgnoreUserGestureForTests( 114 void RequestPermissionsFunction::SetIgnoreUserGestureForTests(
115 bool ignore) { 115 bool ignore) {
116 ignore_user_gesture_for_tests = ignore; 116 ignore_user_gesture_for_tests = ignore;
117 } 117 }
118 118
119 RequestPermissionsFunction::RequestPermissionsFunction() {} 119 RequestPermissionsFunction::RequestPermissionsFunction() {}
120
121 void RequestPermissionsFunction::InstallUIProceed() {
122 PermissionsUpdater perms_updater(profile());
123 perms_updater.AddPermissions(GetExtension(), requested_permissions_.get());
124
125 result_.reset(Request::Result::Create(true));
126 SendResponse(true);
127
128 Release(); // Balanced in RunImpl().
129 }
130
131 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) {
132 result_.reset(Request::Result::Create(false));
133 SendResponse(true);
134
135 Release(); // Balanced in RunImpl().
136 }
137
120 RequestPermissionsFunction::~RequestPermissionsFunction() {} 138 RequestPermissionsFunction::~RequestPermissionsFunction() {}
121 139
122 bool RequestPermissionsFunction::RunImpl() { 140 bool RequestPermissionsFunction::RunImpl() {
123 if (!user_gesture() && !ignore_user_gesture_for_tests) { 141 if (!user_gesture() && !ignore_user_gesture_for_tests) {
124 error_ = kUserGestureRequiredError; 142 error_ = kUserGestureRequiredError;
125 return false; 143 return false;
126 } 144 }
127 145
128 scoped_ptr<Request::Params> params(Request::Params::Create(*args_)); 146 scoped_ptr<Request::Params> params(Request::Params::Create(*args_));
129 EXTENSION_FUNCTION_VALIDATE(params.get()); 147 EXTENSION_FUNCTION_VALIDATE(params.get());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 InstallUIAbort(true); 203 InstallUIAbort(true);
186 } else { 204 } else {
187 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); 205 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests);
188 install_ui_.reset(new ExtensionInstallUI(profile())); 206 install_ui_.reset(new ExtensionInstallUI(profile()));
189 install_ui_->ConfirmPermissions( 207 install_ui_->ConfirmPermissions(
190 this, GetExtension(), requested_permissions_.get()); 208 this, GetExtension(), requested_permissions_.get());
191 } 209 }
192 210
193 return true; 211 return true;
194 } 212 }
195
196 void RequestPermissionsFunction::InstallUIProceed() {
197 PermissionsUpdater perms_updater(profile());
198 perms_updater.AddPermissions(GetExtension(), requested_permissions_.get());
199
200 result_.reset(Request::Result::Create(true));
201 SendResponse(true);
202
203 Release(); // Balanced in RunImpl().
204 }
205
206 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) {
207 result_.reset(Request::Result::Create(false));
208 SendResponse(true);
209
210 Release(); // Balanced in RunImpl().
211 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/permissions/permissions_api.h ('k') | chrome/browser/extensions/api/serial/serial_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698