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

Side by Side Diff: chrome/browser/extensions/api/page_capture/page_capture_permission_helper.h

Issue 2552203007: Public Sessions - prompt the user for pageCapture requests (Closed)
Patch Set: Devlin's comments Created 3 years, 11 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
Devlin 2017/01/09 18:05:07 not 2016 anymore
Ivan Šandrk 2017/01/09 18:33:51 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HELPE R_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HELPE R_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/callback_forward.h"
12 #include "chrome/browser/extensions/extension_install_prompt.h"
13 #include "components/prefs/pref_service.h"
14 #include "content/public/browser/web_contents.h"
15
16 class PrefChangeRegistrar;
17
18 namespace extensions {
19 class Extension;
20
21 class PageCapturePermissionHelper {
22 public:
23 PageCapturePermissionHelper(
24 const Extension* extension,
25 PrefService* prefs,
26 const base::Closure& success_callback,
27 const base::Callback<void(const std::string&)>& failure_callback);
28
29 ~PageCapturePermissionHelper();
30
31 // Handles permission checking inside of Public Sessions.
32 void HandlePermissionRequest(content::WebContents* web_contents);
33
34 private:
35 enum PermissionState {
36 NOT_PROMPTED = 0,
37 SHOWN_PROMPT,
38 ALLOWED,
39 DENIED
40 };
41
42 // Sets up the dialog asking the user for permission.
43 void ShowPermissionPrompt(content::WebContents* web_contents);
44
45 // Handles the user decision of whether to allow page capture.
46 void ResolvePermissionPrompt(ExtensionInstallPrompt::Result prompt_result);
47
48 // Continues with the page capture (if user allowed it), or returns failure
49 // (user denied permission).
50 void ResolvePermissionRequest();
51
52 void SetUserChoice(PermissionState value);
53 PermissionState GetUserChoice();
54
55 std::unique_ptr<ExtensionInstallPrompt> prompt_;
56 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
57 const Extension* extension_;
58 PrefService* prefs_;
59 base::Closure success_callback_;
60 base::Callback<void(const std::string&)> failure_callback_;
61 };
62
63 } // namespace extensions
64
65 #endif // CHROME_BROWSER_EXTENSIONS_API_PAGE_CAPTURE_PAGE_CAPTURE_PERMISSION_HE LPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698