Chromium Code Reviews| Index: chrome/browser/extensions/api/page_capture/page_capture_api.h |
| diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.h b/chrome/browser/extensions/api/page_capture/page_capture_api.h |
| index f72ea849c06178aa2a8b4c18110c9abda8d145d6..b07592b36488c0707ad89ec77bcc99219441ce8a 100644 |
| --- a/chrome/browser/extensions/api/page_capture/page_capture_api.h |
| +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.h |
| @@ -7,11 +7,15 @@ |
| #include <stdint.h> |
| +#include <memory> |
| #include <string> |
| #include "base/memory/ref_counted.h" |
| #include "chrome/browser/extensions/chrome_extension_function.h" |
| +#include "chrome/browser/extensions/extension_install_prompt.h" |
| #include "chrome/common/extensions/api/page_capture.h" |
| +#include "components/prefs/pref_change_registrar.h" |
| +#include "components/prefs/pref_service.h" |
| #include "storage/browser/blob/shareable_file_reference.h" |
| namespace base { |
| @@ -56,6 +60,33 @@ class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction { |
| // Returns the WebContents we are associated with, NULL if it's been closed. |
| content::WebContents* GetWebContents(); |
| + // Handles permission checking inside of Public Sessions. |
| + void HandlePermission(); |
| + |
| +#if defined(OS_CHROMEOS) |
|
Devlin
2016/12/12 20:09:37
This is a fair amount of cros-only code. I think
Ivan Šandrk
2016/12/13 16:32:47
That's a good point. Are you fine with me doing a
Devlin
2016/12/13 21:51:29
Is there a reason not to do it here? I don't feel
Ivan Šandrk
2017/01/04 17:09:59
Done.
|
| + enum PermissionState { |
| + NOT_PROMPTED = 0, |
| + SHOWN_PROMPT, |
| + ALLOWED, |
| + DENIED |
| + }; |
| + |
| + // Sets up the dialog asking the user for permission. |
| + void ShowPermissionPrompt(); |
| + |
| + // Function used to resolve user decision regarding allowing page capture. |
|
Devlin
2016/12/12 20:09:37
nit: typically, we don't need "Function used to"-t
Ivan Šandrk
2016/12/13 16:32:47
True, done.
|
| + void ResolvePermissionPrompt(ExtensionInstallPrompt::Result prompt_result); |
| + |
| + // Helper function that continues with the page capture (if user allowed it), |
| + // or returns failure (user denied permission). |
| + void ChainRunAsync(); |
|
Devlin
2016/12/12 20:09:37
I'm not sure the "ChainRunAsync" name makes sense
Ivan Šandrk
2016/12/13 16:32:47
Does ResolvePermissionRequest sound better?
|
| + |
| + PrefService* GetPrefs(); |
| + |
| + void UserChoiceSet(PermissionState value); |
| + PermissionState UserChoiceGet(); |
| +#endif // defined(OS_CHROMEOS) |
| + |
| std::unique_ptr<extensions::api::page_capture::SaveAsMHTML::Params> params_; |
| // The path to the temporary file containing the MHTML data. |
| @@ -64,6 +95,11 @@ class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction { |
| // The file containing the MHTML. |
| scoped_refptr<storage::ShareableFileReference> mhtml_file_; |
| +#if defined(OS_CHROMEOS) |
| + std::unique_ptr<ExtensionInstallPrompt> prompt_; |
| + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| +#endif // defined(OS_CHROMEOS) |
| + |
| DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) |
| }; |