| Index: chrome/browser/extensions/api/page_capture/page_capture_permission_helper.h
|
| diff --git a/chrome/browser/extensions/api/page_capture/page_capture_permission_helper.h b/chrome/browser/extensions/api/page_capture/page_capture_permission_helper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..257a64d7d7a4bab4aea9df5040f37cd8574b9e6e
|
| --- /dev/null
|
| +++ b/chrome/browser/extensions/api/page_capture/page_capture_permission_helper.h
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HELPER_H_
|
| +#define CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HELPER_H_
|
| +
|
| +#include <memory>
|
| +#include <string>
|
| +
|
| +#include "base/callback_forward.h"
|
| +#include "chrome/browser/extensions/extension_install_prompt.h"
|
| +#include "components/prefs/pref_service.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +
|
| +class PrefChangeRegistrar;
|
| +
|
| +namespace extensions {
|
| +class Extension;
|
| +
|
| +class PageCapturePermissionHelper {
|
| + public:
|
| + PageCapturePermissionHelper(
|
| + const Extension* extension,
|
| + PrefService* prefs,
|
| + const base::Closure& success_callback,
|
| + const base::Callback<void(const std::string&)>& failure_callback);
|
| +
|
| + ~PageCapturePermissionHelper();
|
| +
|
| + // Handles permission checking inside of Public Sessions.
|
| + void HandlePermissionRequest(content::WebContents* web_contents);
|
| +
|
| + private:
|
| + enum PermissionState {
|
| + NOT_PROMPTED = 0,
|
| + SHOWN_PROMPT,
|
| + ALLOWED,
|
| + DENIED
|
| + };
|
| +
|
| + // Sets up the dialog asking the user for permission.
|
| + void ShowPermissionPrompt(content::WebContents* web_contents);
|
| +
|
| + // Handles the user decision of whether to allow page capture.
|
| + void ResolvePermissionPrompt(ExtensionInstallPrompt::Result prompt_result);
|
| +
|
| + // Continues with the page capture (if user allowed it), or returns failure
|
| + // (user denied permission).
|
| + void ResolvePermissionRequest();
|
| +
|
| + void SetUserChoice(PermissionState value);
|
| + PermissionState GetUserChoice();
|
| +
|
| + std::unique_ptr<ExtensionInstallPrompt> prompt_;
|
| + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
|
| + const Extension* extension_;
|
| + PrefService* prefs_;
|
| + base::Closure success_callback_;
|
| + base::Callback<void(const std::string&)> failure_callback_;
|
| +};
|
| +
|
| +} // namespace extensions
|
| +
|
| +#endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HELPER_H_
|
|
|