OLD | NEW |
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/permissions_updater.h" | 10 #include "chrome/browser/extensions/permissions_updater.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 PermissionsRequestFunction::PermissionsRequestFunction() {} | 125 PermissionsRequestFunction::PermissionsRequestFunction() {} |
126 | 126 |
127 void PermissionsRequestFunction::InstallUIProceed() { | 127 void PermissionsRequestFunction::InstallUIProceed() { |
128 PermissionsUpdater perms_updater(GetProfile()); | 128 PermissionsUpdater perms_updater(GetProfile()); |
129 perms_updater.AddPermissions(GetExtension(), requested_permissions_.get()); | 129 perms_updater.AddPermissions(GetExtension(), requested_permissions_.get()); |
130 | 130 |
131 results_ = Request::Results::Create(true); | 131 results_ = Request::Results::Create(true); |
132 SendResponse(true); | 132 SendResponse(true); |
133 | 133 |
134 Release(); // Balanced in RunImpl(). | 134 Release(); // Balanced in RunAsync(). |
135 } | 135 } |
136 | 136 |
137 void PermissionsRequestFunction::InstallUIAbort(bool user_initiated) { | 137 void PermissionsRequestFunction::InstallUIAbort(bool user_initiated) { |
138 SendResponse(true); | 138 SendResponse(true); |
139 | 139 |
140 Release(); // Balanced in RunImpl(). | 140 Release(); // Balanced in RunAsync(). |
141 } | 141 } |
142 | 142 |
143 PermissionsRequestFunction::~PermissionsRequestFunction() {} | 143 PermissionsRequestFunction::~PermissionsRequestFunction() {} |
144 | 144 |
145 bool PermissionsRequestFunction::RunImpl() { | 145 bool PermissionsRequestFunction::RunAsync() { |
146 results_ = Request::Results::Create(false); | 146 results_ = Request::Results::Create(false); |
147 | 147 |
148 if (!user_gesture() && | 148 if (!user_gesture() && |
149 !ignore_user_gesture_for_tests && | 149 !ignore_user_gesture_for_tests && |
150 extension_->location() != Manifest::COMPONENT) { | 150 extension_->location() != Manifest::COMPONENT) { |
151 error_ = kUserGestureRequiredError; | 151 error_ = kUserGestureRequiredError; |
152 return false; | 152 return false; |
153 } | 153 } |
154 | 154 |
155 scoped_ptr<Request::Params> params(Request::Params::Create(*args_)); | 155 scoped_ptr<Request::Params> params(Request::Params::Create(*args_)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); | 214 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); |
215 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); | 215 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); |
216 install_ui_->ConfirmPermissions( | 216 install_ui_->ConfirmPermissions( |
217 this, GetExtension(), requested_permissions_.get()); | 217 this, GetExtension(), requested_permissions_.get()); |
218 } | 218 } |
219 | 219 |
220 return true; | 220 return true; |
221 } | 221 } |
222 | 222 |
223 } // namespace extensions | 223 } // namespace extensions |
OLD | NEW |