Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" | |
| 6 | |
| 7 #include "chrome/browser/chromeos/extensions/public_session_permission_helper_im pl.h" | |
| 8 #include "content/public/browser/browser_thread.h" | |
| 9 #include "extensions/common/extension.h" | |
| 10 | |
| 11 namespace extensions { | |
| 12 namespace permission_helper { | |
| 13 | |
| 14 // static | |
| 15 PublicSessionPermissionHelper& PublicSessionPermissionHelper::Instance() { | |
| 16 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 17 CR_DEFINE_STATIC_LOCAL(PublicSessionPermissionHelper, instance, ()); | |
|
Devlin
2017/01/23 22:59:48
usually for something like this, we prefer LazyIns
Ivan Šandrk
2017/01/24 19:57:22
Why?
Devlin
2017/01/25 16:00:31
Mostly just because it is the canonical, known-to-
Ivan Šandrk
2017/01/26 18:53:21
I meant why as in why LazyInstance over CR_DEFINE_
| |
| 18 return instance; | |
| 19 } | |
| 20 | |
| 21 void PublicSessionPermissionHelper::HandlePermissionRequest( | |
| 22 const Extension* extension, | |
| 23 PermissionHelperSet requested_permissions, | |
| 24 content::WebContents* web_contents, | |
| 25 const base::Closure& success_callback, | |
| 26 const base::Closure& failure_callback) { | |
| 27 CHECK(extension); | |
| 28 impl_[extension->id()].HandlePermissionRequest( | |
| 29 extension, | |
| 30 requested_permissions, | |
| 31 web_contents, | |
| 32 success_callback, | |
| 33 failure_callback); | |
| 34 } | |
| 35 | |
| 36 PermissionState PublicSessionPermissionHelper::GetUserChoice( | |
| 37 ExtensionId extension_id, APIPermission::ID permission_id) { | |
| 38 return impl_[extension_id].GetUserChoice(permission_id); | |
| 39 } | |
| 40 | |
| 41 PublicSessionPermissionHelper::PublicSessionPermissionHelper() {} | |
| 42 | |
| 43 PublicSessionPermissionHelper::~PublicSessionPermissionHelper() {} | |
| 44 | |
| 45 } // namespace permission_helper | |
| 46 } // namespace extensions | |
| OLD | NEW |