summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/app/theme/theme_resources.grd1
-rw-r--r--chrome/browser/ui/collected_cookies_infobar_delegate.cc45
-rw-r--r--chrome/browser/ui/collected_cookies_infobar_delegate.h33
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.cc10
-rw-r--r--chrome/browser/ui/views/collected_cookies_win.h2
-rw-r--r--chrome/chrome_browser.gypi2
7 files changed, 98 insertions, 1 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3430c44..e9d84ad 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7326,6 +7326,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_TAB_LABEL" desc="The label in a tabbed pane that holds the UI controls for the cookies blocked while loading the page.">
Blocked
</message>
+ <message name="IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE" desc="The string shown in the infobar after the user has changed the allowed/blocked state of a cookie, reminding them to reload the page in order for the new cookies to take effect.">
+ New cookie settings will take effect after reloading the page.
+ </message>
+ <message name="IDS_COLLECTED_COOKIES_INFOBAR_BUTTON" desc="The string used in the infobar button allowing the user to reload the page directly from the infobar.">
+ Reload
+ </message>
<!-- Cookies Window -->
<message name="IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE" desc="The title of the redesigned Cookies Window that lets you manage cookies, storage quota for websites and other permissions per-website">
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 69361d7..050edee 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -202,6 +202,7 @@
<include name="IDR_INFOBAR_SAVE_PASSWORD" file="infobar_savepassword.png" type="BINDATA" />
<include name="IDR_INFOBAR_SSL_WARNING" file="infobar_insecure.png" type="BINDATA" />
<include name="IDR_INFOBAR_THEME" file="infobar_theme.png" type="BINDATA" />
+ <include name="IDR_INFOBAR_COOKIE" file="infobar_cookie.png" type="BINDATA" />
<if expr="pp_ifdef('_google_chrome')">
<include name="IDR_INFOBAR_TRANSLATE" file="google_chrome/infobar_translate.png" type="BINDATA" />
</if>
diff --git a/chrome/browser/ui/collected_cookies_infobar_delegate.cc b/chrome/browser/ui/collected_cookies_infobar_delegate.cc
new file mode 100644
index 0000000..0f1d279
--- /dev/null
+++ b/chrome/browser/ui/collected_cookies_infobar_delegate.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
+
+#include "base/logging.h"
+#include "content/browser/tab_contents/tab_contents.h"
+#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
+
+CollectedCookiesInfoBarDelegate::CollectedCookiesInfoBarDelegate(
+ TabContents* tab_contents)
+ : ConfirmInfoBarDelegate(tab_contents),
+ tab_contents_(tab_contents) {
+}
+
+SkBitmap* CollectedCookiesInfoBarDelegate::GetIcon() const {
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_INFOBAR_COOKIE);
+}
+
+InfoBarDelegate::Type CollectedCookiesInfoBarDelegate::GetInfoBarType() const {
+ return PAGE_ACTION_TYPE;
+}
+
+string16 CollectedCookiesInfoBarDelegate::GetMessageText() const {
+ return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_MESSAGE);
+}
+
+int CollectedCookiesInfoBarDelegate::GetButtons() const {
+ return BUTTON_OK;
+}
+
+string16 CollectedCookiesInfoBarDelegate::GetButtonLabel(InfoBarButton button)
+ const {
+ DCHECK_EQ(BUTTON_OK, button);
+ return l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_INFOBAR_BUTTON);
+}
+
+bool CollectedCookiesInfoBarDelegate::Accept() {
+ tab_contents_->controller().Reload(true);
+ return true;
+}
diff --git a/chrome/browser/ui/collected_cookies_infobar_delegate.h b/chrome/browser/ui/collected_cookies_infobar_delegate.h
new file mode 100644
index 0000000..8e76221
--- /dev/null
+++ b/chrome/browser/ui/collected_cookies_infobar_delegate.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 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_UI_COLLECTED_COOKIES_INFOBAR_DELEGATE_H_
+#define CHROME_BROWSER_UI_COLLECTED_COOKIES_INFOBAR_DELEGATE_H_
+
+#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
+
+// This class configures an infobar shown when the collected cookies dialog
+// is closed and the settings for one or more cookies have been changed. The
+// user is shown a message indicating that a reload of the page is
+// required for the changes to take effect, and presented a button to perform
+// the reload right from the infobar.
+class CollectedCookiesInfoBarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ explicit CollectedCookiesInfoBarDelegate(TabContents* tab_contents);
+
+ private:
+ // ConfirmInfoBarDelegate overrides.
+ virtual SkBitmap* GetIcon() const;
+ virtual Type GetInfoBarType() const;
+ virtual string16 GetMessageText() const;
+ virtual int GetButtons() const;
+ virtual string16 GetButtonLabel(InfoBarButton button) const;
+ virtual bool Accept();
+
+ TabContents* tab_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(CollectedCookiesInfoBarDelegate);
+};
+
+#endif // CHROME_BROWSER_UI_COLLECTED_COOKIES_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index 316db23..ef1ac91 100644
--- a/chrome/browser/ui/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/cookies_tree_model.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
#include "chrome/browser/ui/views/cookie_info_view.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/notification_details.h"
@@ -169,7 +170,8 @@ CollectedCookiesWin::CollectedCookiesWin(gfx::NativeWindow parent_window,
block_allowed_button_(NULL),
allow_blocked_button_(NULL),
for_session_blocked_button_(NULL),
- infobar_(NULL) {
+ infobar_(NULL),
+ status_changed_(false) {
TabSpecificContentSettings* content_settings =
tab_contents->GetTabSpecificContentSettings();
registrar_.Add(this, NotificationType::COLLECTED_COOKIES_SHOWN,
@@ -370,6 +372,11 @@ void CollectedCookiesWin::DeleteDelegate() {
}
bool CollectedCookiesWin::Cancel() {
+ if (status_changed_) {
+ tab_contents_->AddInfoBar(
+ new CollectedCookiesInfoBarDelegate(tab_contents_));
+ }
+
return true;
}
@@ -476,6 +483,7 @@ void CollectedCookiesWin::AddContentException(views::TreeView* tree_view,
gfx::Size size = GetRootView()->GetPreferredSize();
bounds.SetRect(topleft.x, topleft.y, size.width(), size.height());
GetWidget()->SetBounds(bounds);
+ status_changed_ = true;
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/views/collected_cookies_win.h b/chrome/browser/ui/views/collected_cookies_win.h
index a578d45..8e6e61b 100644
--- a/chrome/browser/ui/views/collected_cookies_win.h
+++ b/chrome/browser/ui/views/collected_cookies_win.h
@@ -106,6 +106,8 @@ class CollectedCookiesWin : public ConstrainedDialogDelegate,
InfobarView* infobar_;
+ bool status_changed_;
+
DISALLOW_COPY_AND_ASSIGN(CollectedCookiesWin);
};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 8e63d6e..5c13b5e 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2472,6 +2472,8 @@
'browser/ui/cocoa/wrench_menu/wrench_menu_button_cell.mm',
'browser/ui/cocoa/wrench_menu/wrench_menu_controller.h',
'browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm',
+ 'browser/ui/collected_cookies_infobar_delegate.h',
+ 'browser/ui/collected_cookies_infobar_delegate.cc',
'browser/ui/crypto_module_password_dialog.h',
'browser/ui/crypto_module_password_dialog_nss.cc',
'browser/ui/crypto_module_password_dialog_openssl.cc',