diff options
author | palmer <palmer@chromium.org> | 2015-08-17 17:24:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 00:25:39 +0000 |
commit | d8b2ff0d0fbd45da6e10a0913a9c4189bed684f2 (patch) | |
tree | a7619400adc5470d386a503cb43dade31aa69088 /components/app_modal/javascript_app_modal_dialog.h | |
parent | bfae1d5680d9305f913c03a901f802858734f9b5 (diff) | |
download | chromium_src-d8b2ff0d0fbd45da6e10a0913a9c4189bed684f2.zip chromium_src-d8b2ff0d0fbd45da6e10a0913a9c4189bed684f2.tar.gz chromium_src-d8b2ff0d0fbd45da6e10a0913a9c4189bed684f2.tar.bz2 |
Always show the "Prevent this page from creating additional dialogs" checkbox.
Some sites use alert() boxes to spam people, and they can easily avoid
the previous time-based mitigation. So, always give people the option.
BUG=517477
Review URL: https://codereview.chromium.org/1272633007
Cr-Commit-Position: refs/heads/master@{#343780}
Diffstat (limited to 'components/app_modal/javascript_app_modal_dialog.h')
-rw-r--r-- | components/app_modal/javascript_app_modal_dialog.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/components/app_modal/javascript_app_modal_dialog.h b/components/app_modal/javascript_app_modal_dialog.h index 64883e0..82b6c89 100644 --- a/components/app_modal/javascript_app_modal_dialog.h +++ b/components/app_modal/javascript_app_modal_dialog.h @@ -6,10 +6,10 @@ #define COMPONENTS_APP_MODAL_JAVASCRIPT_APP_MODAL_DIALOG_H_ #include <map> +#include <string> #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/time/time.h" #include "components/app_modal/app_modal_dialog.h" #include "content/public/browser/javascript_dialog_manager.h" @@ -20,8 +20,8 @@ class ChromeJavaScriptDialogExtraData { public: ChromeJavaScriptDialogExtraData(); - // The time that the last JavaScript dialog was dismissed. - base::TimeTicks last_javascript_message_dismissal_; + // True if the user has already seen a JavaScript dialog from the origin. + bool has_already_shown_a_dialog_; // True if the user has decided to block future JavaScript dialogs. bool suppress_javascript_messages_; @@ -31,7 +31,7 @@ class ChromeJavaScriptDialogExtraData { // onbeforeunload dialog boxes. class JavaScriptAppModalDialog : public AppModalDialog { public: - typedef std::map<void*, ChromeJavaScriptDialogExtraData> ExtraDataMap; + typedef std::map<std::string, ChromeJavaScriptDialogExtraData> ExtraDataMap; JavaScriptAppModalDialog( content::WebContents* web_contents, @@ -63,6 +63,11 @@ class JavaScriptAppModalDialog : public AppModalDialog { // its delegate instead of whatever the UI reports. void SetOverridePromptText(const base::string16& prompt_text); + // The serialized form of the origin of the last committed URL in + // |web_contents_|. See |extra_data_map_|. + static std::string GetSerializedOriginForWebContents( + content::WebContents* contents); + // Accessors content::JavaScriptMessageType javascript_message_type() const { return javascript_message_type_; @@ -78,8 +83,8 @@ class JavaScriptAppModalDialog : public AppModalDialog { void NotifyDelegate(bool success, const base::string16& prompt_text, bool suppress_js_messages); - // A map of extra Chrome-only data associated with the delegate_. - // Can be inspected via extra_data_map_[web_contents_]. + // A map of extra Chrome-only data associated with the delegate_. The keys + // come from |GetSerializedOriginForWebContents|. ExtraDataMap* extra_data_map_; // Information about the message box is held in the following variables. |