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

Unified Diff: chrome/browser/extensions/api/page_capture/page_capture_api.h

Issue 2552203007: Public Sessions - prompt the user for pageCapture requests (Closed)
Patch Set: GetAssociatedWebContents, nits Created 4 years 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 side-by-side diff with in-line comments
Download patch
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..a6900badc4d783c79377a5ffa3ebb74163fab8e4 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 HandlePermissionRequest();
+
+#if defined(OS_CHROMEOS)
+ enum PermissionState {
+ NOT_PROMPTED = 0,
+ SHOWN_PROMPT,
+ ALLOWED,
+ DENIED
+ };
+
+ // Sets up the dialog asking the user for permission.
+ void ShowPermissionPrompt();
+
+ // 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();
+
+ 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)
};

Powered by Google App Engine
This is Rietveld 408576698