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

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: Moved CrOS only code to a separate file 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.
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 extensions::Extension* extension,
25 PrefService* prefs,
26 base::Callback<void()> success_callback,
Devlin 2017/01/06 20:45:49 nit: base::Closure
Devlin 2017/01/06 20:45:49 nit: these can be const &
Ivan Šandrk 2017/01/09 13:14:56 Done.
Ivan Šandrk 2017/01/09 13:14:56 Done.
27 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 UserChoiceSet(PermissionState value);
Devlin 2017/01/06 20:45:49 nit: prefer SetUserChoice and GetUserChoice
Ivan Šandrk 2017/01/09 13:14:56 Done. They do sound better, was thinking of this
53 PermissionState UserChoiceGet();
54
55 std::unique_ptr<ExtensionInstallPrompt> prompt_;
56 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
57 const extensions::Extension* extension_;
Devlin 2017/01/06 20:45:49 nit: no extensions:: prefix
Ivan Šandrk 2017/01/09 13:14:56 Done.
58 PrefService* prefs_;
59 base::Callback<void()> success_callback_;
Devlin 2017/01/06 20:45:49 nit: base::Closure
Ivan Šandrk 2017/01/09 13:14:56 Done.
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