summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cookie_modal_dialog.h
blob: d36bb9313cf4aaef1305c7910b8e5a552df89123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_
#define CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_

#include <string>

#include "chrome/browser/app_modal_dialog.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
#include "googleurl/src/gurl.h"

class PrefService;

// A controller+model class for cookie and local storage warning prompt.
// |NativeDialog| is a platform specific view.
class CookiePromptModalDialog : public AppModalDialog {
 public:
  // A union of data necessary to determine the type of message box to
  // show.
  CookiePromptModalDialog(TabContents* tab_contents,
                          const std::string& host,
                          const std::string& cookie_line,
                          CookiePromptModalDialogDelegate* delegate);
  CookiePromptModalDialog(
      TabContents* tab_contents,
      const BrowsingDataLocalStorageHelper::LocalStorageInfo& storage_info,
      CookiePromptModalDialogDelegate* delegate);
  virtual ~CookiePromptModalDialog() {}

  static void RegisterPrefs(PrefService* prefs);

  // AppModalDialog overrides.
  virtual int GetDialogButtons();
  virtual void AcceptWindow();
  virtual void CancelWindow();

 protected:
  // AppModalDialog overrides.
  virtual NativeDialog CreateNativeDialog();
#if defined(OS_LINUX)
  virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id);
#endif

 private:
  // Cookie host.
  std::string host_;

  // Cookie to display.
  std::string cookie_line_;

  // Local storage info to display.
  BrowsingDataLocalStorageHelper::LocalStorageInfo storage_info_;

  // Whether we're showing cookie UI as opposed to other site data.
  bool cookie_ui_;

  // Delegate. The caller should provide one in order to receive results
  // from this delegate.
  CookiePromptModalDialogDelegate* delegate_;

  DISALLOW_COPY_AND_ASSIGN(CookiePromptModalDialog);
};

#endif  // CHROME_BROWSER_COOKIE_MODAL_DIALOG_H_