| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ |
| 6 #define CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ | 6 #define CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "chrome/browser/app_modal_dialog.h" | 11 #include "chrome/browser/app_modal_dialog.h" |
| 12 #include "chrome/browser/browsing_data_local_storage_helper.h" | 12 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 13 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" | 13 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 | 15 |
| 16 #if defined(OS_LINUX) |
| 17 #include "app/gtk_signal.h" |
| 18 #endif |
| 19 |
| 16 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 17 #if __OBJC__ | 21 #if __OBJC__ |
| 18 @class NSWindow; | 22 @class NSWindow; |
| 19 #else | 23 #else |
| 20 class NSWindow; | 24 class NSWindow; |
| 21 #endif | 25 #endif |
| 22 #endif | 26 #endif |
| 23 | 27 |
| 24 class HostContentSettingsMap; | 28 class HostContentSettingsMap; |
| 25 class PrefService; | 29 class PrefService; |
| 26 | 30 |
| 31 #if defined(OS_LINUX) |
| 32 typedef struct _GtkWidget GtkWidget; |
| 33 typedef struct _GParamSpec GParamSpec; |
| 34 #endif |
| 35 |
| 27 // A controller+model class for cookie and local storage warning prompt. | 36 // A controller+model class for cookie and local storage warning prompt. |
| 28 // |NativeDialog| is a platform specific view. | 37 // |NativeDialog| is a platform specific view. |
| 29 class CookiePromptModalDialog : public AppModalDialog { | 38 class CookiePromptModalDialog : public AppModalDialog { |
| 30 public: | 39 public: |
| 31 enum DialogType { | 40 enum DialogType { |
| 32 DIALOG_TYPE_COOKIE = 0, | 41 DIALOG_TYPE_COOKIE = 0, |
| 33 DIALOG_TYPE_LOCAL_STORAGE, | 42 DIALOG_TYPE_LOCAL_STORAGE, |
| 34 DIALOG_TYPE_DATABASE, | 43 DIALOG_TYPE_DATABASE, |
| 35 DIALOG_TYPE_APPCACHE | 44 DIALOG_TYPE_APPCACHE |
| 36 }; | 45 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 const string16& database_name, | 63 const string16& database_name, |
| 55 const string16& display_name, | 64 const string16& display_name, |
| 56 unsigned long estimated_size, | 65 unsigned long estimated_size, |
| 57 CookiePromptModalDialogDelegate* delegate); | 66 CookiePromptModalDialogDelegate* delegate); |
| 58 CookiePromptModalDialog(TabContents* tab_contents, | 67 CookiePromptModalDialog(TabContents* tab_contents, |
| 59 HostContentSettingsMap* host_content_settings_map, | 68 HostContentSettingsMap* host_content_settings_map, |
| 60 const GURL& appcache_manifest_url, | 69 const GURL& appcache_manifest_url, |
| 61 CookiePromptModalDialogDelegate* delegate); | 70 CookiePromptModalDialogDelegate* delegate); |
| 62 virtual ~CookiePromptModalDialog(); | 71 virtual ~CookiePromptModalDialog(); |
| 63 | 72 |
| 64 static void RegisterPrefs(PrefService* prefs); | 73 static void RegisterUserPrefs(PrefService* prefs); |
| 65 | 74 |
| 66 // AppModalDialog overrides. | 75 // AppModalDialog overrides. |
| 67 #if defined(OS_LINUX) || defined(OS_MACOSX) | 76 #if defined(OS_LINUX) || defined(OS_MACOSX) |
| 68 virtual void CreateAndShowDialog(); | 77 virtual void CreateAndShowDialog(); |
| 69 #endif | 78 #endif |
| 70 virtual int GetDialogButtons(); | 79 virtual int GetDialogButtons(); |
| 71 virtual void AcceptWindow(); | 80 virtual void AcceptWindow(); |
| 72 virtual void CancelWindow(); | 81 virtual void CancelWindow(); |
| 73 virtual bool IsValid(); | 82 virtual bool IsValid(); |
| 74 | 83 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 | 98 |
| 90 // Implement CookiePromptModalDialogDelegate. | 99 // Implement CookiePromptModalDialogDelegate. |
| 91 virtual void AllowSiteData(bool remember, bool session_expire); | 100 virtual void AllowSiteData(bool remember, bool session_expire); |
| 92 virtual void BlockSiteData(bool remember); | 101 virtual void BlockSiteData(bool remember); |
| 93 | 102 |
| 94 protected: | 103 protected: |
| 95 // AppModalDialog overrides. | 104 // AppModalDialog overrides. |
| 96 virtual NativeDialog CreateNativeDialog(); | 105 virtual NativeDialog CreateNativeDialog(); |
| 97 #if defined(OS_LINUX) | 106 #if defined(OS_LINUX) |
| 98 virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id); | 107 virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id); |
| 108 CHROMEGTK_CALLBACK_1(CookiePromptModalDialog, |
| 109 void, |
| 110 OnExpanderActivate, |
| 111 GParamSpec*); |
| 99 #endif | 112 #endif |
| 100 | 113 |
| 101 private: | 114 private: |
| 102 | 115 |
| 103 #if defined(OS_MACOSX) | 116 #if defined(OS_MACOSX) |
| 104 NSWindow* dialog_; | 117 NSWindow* dialog_; |
| 105 #endif | 118 #endif |
| 106 | 119 |
| 107 // Used to verify our request is still necessary and when the response should | 120 // Used to verify our request is still necessary and when the response should |
| 108 // persist. | 121 // persist. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 GtkWidget* remember_radio_; | 145 GtkWidget* remember_radio_; |
| 133 | 146 |
| 134 // The cookie view; we keep this to querry the result combobox. | 147 // The cookie view; we keep this to querry the result combobox. |
| 135 GtkWidget* cookie_view_; | 148 GtkWidget* cookie_view_; |
| 136 #endif | 149 #endif |
| 137 | 150 |
| 138 DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog); | 151 DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog); |
| 139 }; | 152 }; |
| 140 | 153 |
| 141 #endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ | 154 #endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ |
| OLD | NEW |