Chromium Code Reviews| 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 "chrome/browser/app_modal_dialog.h" | 10 #include "chrome/browser/app_modal_dialog.h" |
| 11 #include "chrome/browser/browsing_data_local_storage_helper.h" | 11 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 12 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" | 12 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 class PrefService; | 15 class PrefService; |
| 16 | 16 |
| 17 // A controller+model class for cookie and local storage warning prompt. | 17 // A controller+model class for cookie and local storage warning prompt. |
| 18 // |NativeDialog| is a platform specific view. | 18 // |NativeDialog| is a platform specific view. |
| 19 class CookiePromptModalDialog : public AppModalDialog { | 19 class CookiePromptModalDialog : public AppModalDialog { |
| 20 public: | 20 public: |
| 21 enum DialogType { | |
| 22 DIALOG_TYPE_COOKIE=0, | |
|
darin (slow to review)
2010/02/12 20:55:52
_COOKIE = 0 <-- whitespace
jorlow
2010/02/12 21:22:42
Doing...
| |
| 23 DIALOG_TYPE_LOCAL_STORAGE | |
| 24 // TODO(jorlow): Database | |
| 25 // TODO(michaeln): AppCache | |
| 26 }; | |
| 27 | |
| 21 // A union of data necessary to determine the type of message box to | 28 // A union of data necessary to determine the type of message box to |
| 22 // show. | 29 // show. |
| 23 CookiePromptModalDialog(TabContents* tab_contents, | 30 CookiePromptModalDialog(TabContents* tab_contents, |
| 24 const std::string& host, | 31 const std::string& host, |
| 25 const std::string& cookie_line, | 32 const std::string& cookie_line, |
| 26 CookiePromptModalDialogDelegate* delegate); | 33 CookiePromptModalDialogDelegate* delegate); |
| 27 CookiePromptModalDialog( | 34 CookiePromptModalDialog( |
| 28 TabContents* tab_contents, | 35 TabContents* tab_contents, |
| 29 const BrowsingDataLocalStorageHelper::LocalStorageInfo& storage_info, | 36 const std::string& host, |
| 37 const string16& key, | |
| 38 const string16& value, | |
| 30 CookiePromptModalDialogDelegate* delegate); | 39 CookiePromptModalDialogDelegate* delegate); |
| 31 virtual ~CookiePromptModalDialog() {} | 40 virtual ~CookiePromptModalDialog() {} |
| 32 | 41 |
| 33 static void RegisterPrefs(PrefService* prefs); | 42 static void RegisterPrefs(PrefService* prefs); |
| 34 | 43 |
| 35 // AppModalDialog overrides. | 44 // AppModalDialog overrides. |
| 36 virtual int GetDialogButtons(); | 45 virtual int GetDialogButtons(); |
| 37 virtual void AcceptWindow(); | 46 virtual void AcceptWindow(); |
| 38 virtual void CancelWindow(); | 47 virtual void CancelWindow(); |
| 39 | 48 |
| 49 DialogType dialog_type() const { return dialog_type_; } | |
| 50 const std::string& host() const { return host_; } | |
| 51 const std::string& cookie_line() const { return cookie_line_; } | |
| 52 const string16& local_storage_key() const { return local_storage_key_; } | |
| 53 const string16& local_storage_value() const { return local_storage_value_; } | |
| 54 CookiePromptModalDialogDelegate* GetDelegate() { return delegate_; } | |
| 55 | |
| 40 protected: | 56 protected: |
| 41 // AppModalDialog overrides. | 57 // AppModalDialog overrides. |
| 42 virtual NativeDialog CreateNativeDialog(); | 58 virtual NativeDialog CreateNativeDialog(); |
| 43 #if defined(OS_LINUX) | 59 #if defined(OS_LINUX) |
| 44 virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id); | 60 virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id); |
| 45 #endif | 61 #endif |
| 46 | 62 |
| 47 private: | 63 private: |
| 48 // Cookie host. | 64 const DialogType dialog_type_; |
| 49 std::string host_; | 65 |
| 66 // The host connected to this request. | |
| 67 const std::string host_; | |
| 50 | 68 |
| 51 // Cookie to display. | 69 // Cookie to display. |
| 52 std::string cookie_line_; | 70 const std::string cookie_line_; |
| 53 | 71 |
| 54 // Local storage info to display. | 72 // LocalStorage key/value. |
| 55 BrowsingDataLocalStorageHelper::LocalStorageInfo storage_info_; | 73 const string16 local_storage_key_; |
| 56 | 74 const string16 local_storage_value_; |
| 57 // Whether we're showing cookie UI as opposed to other site data. | |
| 58 bool cookie_ui_; | |
| 59 | 75 |
| 60 // Delegate. The caller should provide one in order to receive results | 76 // Delegate. The caller should provide one in order to receive results |
| 61 // from this delegate. | 77 // from this delegate. |
| 62 CookiePromptModalDialogDelegate* delegate_; | 78 CookiePromptModalDialogDelegate* delegate_; |
| 63 | 79 |
| 64 DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog); | 80 DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog); |
| 65 }; | 81 }; |
| 66 | 82 |
| 67 #endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ | 83 #endif // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_ |
| 68 | 84 |
| OLD | NEW |