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

Unified Diff: chrome/browser/views/cookie_prompt_view.h

Issue 560030: Refactored out JS specific part of modal dialog stack into its own class, exp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/cookie_info_view.cc ('k') | chrome/browser/views/cookie_prompt_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/cookie_prompt_view.h
===================================================================
--- chrome/browser/views/cookie_prompt_view.h (revision 38222)
+++ chrome/browser/views/cookie_prompt_view.h (working copy)
@@ -9,8 +9,10 @@
#include "base/task.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
+#include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
#include "chrome/browser/views/cookie_info_view.h"
-#include "net/base/cookie_monster.h"
+#include "chrome/browser/views/modal_dialog_delegate.h"
+#include "googleurl/src/gurl.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
#include "views/view.h"
@@ -23,57 +25,37 @@
}
class CookieInfoView;
+class CookiePromptModalDialog;
class LocalStorageInfoView;
class Profile;
class Timer;
-class CookiesPromptViewDelegate {
- public:
- // Allow site data to be set. If |remember| is true, record this decision
- // for this host.
- virtual void AllowSiteData(bool remember, bool session_expire) = 0;
-
- // Block site data from being stored. If |remember| is true, record this
- // decision for this host.
- virtual void BlockSiteData(bool remember) = 0;
-
- protected:
- virtual ~CookiesPromptViewDelegate() {}
-};
-
// Cookie alert dialog UI.
-class CookiesPromptView : public views::View,
- public views::DialogDelegate,
+class CookiePromptView : public views::View,
+ public ModalDialogDelegate,
public views::ButtonListener,
public views::LinkController,
public CookieInfoViewDelegate {
public:
// Show the Cookies Window, creating one if necessary.
- static void ShowCookiePromptWindow(
- gfx::NativeWindow parent,
+ CookiePromptView(
+ CookiePromptModalDialog* parent,
+ gfx::NativeWindow root_window,
Profile* profile,
- const std::string& domain,
- const net::CookieMonster::CanonicalCookie& cookie,
- CookiesPromptViewDelegate* delegate);
+ const GURL& url,
+ const std::string& cookie_line,
+ CookiePromptModalDialogDelegate* delegate);
- static void CookiesPromptView::ShowLocalStoragePromptWindow(
- gfx::NativeWindow parent,
+ CookiePromptView(
+ CookiePromptModalDialog* parent,
+ gfx::NativeWindow root_window,
Profile* profile,
- const std::string& domain,
const BrowsingDataLocalStorageHelper::LocalStorageInfo&
local_storage_info,
- CookiesPromptViewDelegate* delegate);
+ CookiePromptModalDialogDelegate* delegate);
- virtual ~CookiesPromptView();
+ virtual ~CookiePromptView();
- // Initializes component for displaying cookie information.
- void SetCookie(const std::string& domain,
- const net::CookieMonster::CanonicalCookie& cookie_node);
-
- // Initializes component for displaying locale storage information.
- void SetLocalStorage(const std::string& domain,
- const BrowsingDataLocalStorageHelper::LocalStorageInfo);
-
protected:
// views::View overrides.
virtual gfx::Size GetPreferredSize();
@@ -81,11 +63,15 @@
views::View* parent,
views::View* child);
+ // ModalDialogDelegate overrides.
+ virtual gfx::NativeWindow GetDialogRootWindow();
+
// views::DialogDelegate overrides.
virtual bool CanResize() const { return false; }
virtual std::wstring GetWindowTitle() const;
virtual void WindowClosing();
virtual views::View* GetContentsView();
+ virtual bool IsModal() const { return true; }
// views::ButtonListener overrides.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
@@ -103,8 +89,8 @@
private:
// Use the static factory method to show.
- explicit CookiesPromptView(Profile* profile,
- CookiesPromptViewDelegate* delegate);
+ explicit CookiePromptView(Profile* profile,
+ CookiePromptModalDialogDelegate* delegate);
// Initialize the dialog layout.
void Init();
@@ -141,24 +127,29 @@
// Whether we're showing cookie UI as opposed to other site data.
bool cookie_ui_;
- CookiesPromptViewDelegate* delegate_;
+ // A pointer to the AppModalDialog that owns us.
+ CookiePromptModalDialog* parent_;
- // Cookie domain.
+ gfx::NativeWindow root_window_;
+
+ // The Profile for which Cookies are displayed.
+ Profile* profile_;
+
+ // Cookie / local storage domain.
std::string domain_;
- // Cookie domain formatted for displaying (removed leading '.').
+ // Domain name formatted for displaying (removed leading '.').
std::wstring display_domain_;
- // Displayed cookie. Only used when |cookie_ui_| is true.
- net::CookieMonster::CanonicalCookie cookie_;
+ // Displayed cookie. Only used when |cookie_ui_| is true.
+ std::string cookie_line_;
// Displayed local storage info. Only used when |cookie_ui_| is false.
BrowsingDataLocalStorageHelper::LocalStorageInfo local_storage_info_;
- // The Profile for which Cookies are displayed.
- Profile* profile_;
+ CookiePromptModalDialogDelegate* delegate_;
- DISALLOW_COPY_AND_ASSIGN(CookiesPromptView);
+ DISALLOW_COPY_AND_ASSIGN(CookiePromptView);
};
#endif // CHROME_BROWSER_VIEWS_COOKIE_PROMPT_VIEW_H_
« no previous file with comments | « chrome/browser/views/cookie_info_view.cc ('k') | chrome/browser/views/cookie_prompt_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698