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

Side by Side Diff: chrome/browser/cookie_modal_dialog.h

Issue 3299020: Remove vestigial cookie/web app permissions prompting UI now that the async U... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_
6 #define CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/ref_counted.h"
12 #include "chrome/browser/app_modal_dialog.h"
13 #include "chrome/browser/browsing_data_local_storage_helper.h"
14 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
15 #include "googleurl/src/gurl.h"
16
17 #if defined(OS_LINUX)
18 #include "app/gtk_signal.h"
19 #endif
20
21 #if defined(OS_MACOSX)
22 #if __OBJC__
23 @class NSWindow;
24 #else
25 class NSWindow;
26 #endif
27 #endif
28
29 class HostContentSettingsMap;
30 class PrefService;
31
32 #if defined(OS_LINUX)
33 typedef struct _GtkWidget GtkWidget;
34 typedef struct _GParamSpec GParamSpec;
35 #endif
36
37 // A controller+model class for cookie and local storage warning prompt.
38 // |NativeDialog| is a platform specific view.
39 class CookiePromptModalDialog : public AppModalDialog {
40 public:
41 enum DialogType {
42 DIALOG_TYPE_COOKIE = 0,
43 DIALOG_TYPE_LOCAL_STORAGE,
44 DIALOG_TYPE_DATABASE,
45 DIALOG_TYPE_APPCACHE
46 };
47
48 // A union of data necessary to determine the type of message box to
49 // show.
50 CookiePromptModalDialog(TabContents* tab_contents,
51 HostContentSettingsMap* host_content_settings_map,
52 const GURL& origin,
53 const std::string& cookie_line,
54 CookiePromptModalDialogDelegate* delegate);
55 CookiePromptModalDialog(TabContents* tab_contents,
56 HostContentSettingsMap* host_content_settings_map,
57 const GURL& origin,
58 const string16& key,
59 const string16& value,
60 CookiePromptModalDialogDelegate* delegate);
61 CookiePromptModalDialog(TabContents* tab_contents,
62 HostContentSettingsMap* host_content_settings_map,
63 const GURL& origin,
64 const string16& database_name,
65 const string16& display_name,
66 unsigned long estimated_size,
67 CookiePromptModalDialogDelegate* delegate);
68 CookiePromptModalDialog(TabContents* tab_contents,
69 HostContentSettingsMap* host_content_settings_map,
70 const GURL& appcache_manifest_url,
71 CookiePromptModalDialogDelegate* delegate);
72 virtual ~CookiePromptModalDialog();
73
74 static void RegisterUserPrefs(PrefService* prefs);
75
76 // AppModalDialog overrides.
77 #if defined(OS_POSIX)
78 virtual void CreateAndShowDialog();
79 #endif
80 virtual int GetDialogButtons();
81 virtual void AcceptWindow();
82 virtual void CancelWindow();
83 virtual bool IsValid();
84
85 #if defined(OS_MACOSX)
86 virtual void CloseModalDialog();
87 #endif
88
89 DialogType dialog_type() const { return dialog_type_; }
90 const GURL& origin() const { return origin_; }
91 const std::string& cookie_line() const { return cookie_line_; }
92 const string16& local_storage_key() const { return local_storage_key_; }
93 const string16& local_storage_value() const { return local_storage_value_; }
94 const string16& database_name() const { return database_name_; }
95 const string16& display_name() const { return display_name_; }
96 unsigned long estimated_size() const { return estimated_size_; }
97 const GURL& appcache_manifest_url() const { return appcache_manifest_url_; }
98 TabContents* tab_contents() const { return tab_contents_; }
99
100 // Implement CookiePromptModalDialogDelegate.
101 virtual void AllowSiteData(bool remember, bool session_expire);
102 virtual void BlockSiteData(bool remember);
103
104 protected:
105 // AppModalDialog overrides.
106 virtual NativeDialog CreateNativeDialog();
107 #if defined(TOOLKIT_USES_GTK)
108 virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id);
109 CHROMEGTK_CALLBACK_1(CookiePromptModalDialog,
110 void,
111 OnExpanderActivate,
112 GParamSpec*);
113 #endif
114
115 private:
116
117 #if defined(OS_MACOSX)
118 NSWindow* dialog_;
119 #endif
120
121 // Used to verify our request is still necessary and when the response should
122 // persist.
123 scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
124
125 const DialogType dialog_type_;
126
127 // The origin connected to this request.
128 const GURL origin_;
129
130 // Which data members are relevant depends on the dialog_type.
131 const std::string cookie_line_;
132 const string16 local_storage_key_;
133 const string16 local_storage_value_;
134 const string16 database_name_;
135 const string16 display_name_;
136 unsigned long estimated_size_;
137 const GURL appcache_manifest_url_;
138
139 // The caller should provide a delegate in order to receive results
140 // from this delegate. Any time after calling one of these methods, the
141 // delegate could be deleted
142 CookiePromptModalDialogDelegate* delegate_;
143
144 #if defined(TOOLKIT_USES_GTK)
145 // The "remember this choice" radio button in the dialog.
146 GtkWidget* remember_radio_;
147
148 // The cookie view; we keep this to querry the result combobox.
149 GtkWidget* cookie_view_;
150 #endif
151
152 DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog);
153 };
154
155 #endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698