summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-18 08:32:31 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-18 08:32:31 +0000
commit869e4de32ddd3f0f53d31cd319b2692c1ed422b0 (patch)
tree3b00424ffbf90caa17f36d3cc4b0adef5eba7760 /chrome
parent140debc9ab97da79036d70db21859d771cecf134 (diff)
downloadchromium_src-869e4de32ddd3f0f53d31cd319b2692c1ed422b0.zip
chromium_src-869e4de32ddd3f0f53d31cd319b2692c1ed422b0.tar.gz
chromium_src-869e4de32ddd3f0f53d31cd319b2692c1ed422b0.tar.bz2
Revert 44885 - Select and close previous theme info bars when resetting to default theme via the options dialog. As a nice side effect if one tab is showing a theme info bar and the user switches to a different theme in another tab, this change closes the previous theme info bars as well.
BUG=35607 TEST=Install a theme, and with the theme info bar visible open Preferences dialog and click 'reset to default theme' and check the info bar. (full steps given in the above bug entry) Landing http://codereview.chromium.org/1622017/show for Satish. Review URL: http://codereview.chromium.org/1600030 TBR=jorlow@chromium.org Review URL: http://codereview.chromium.org/1599038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44886 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc11
-rw-r--r--chrome/browser/automation/automation_provider.h4
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.cc35
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.h19
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/test/automation/automation_messages_internal.h6
-rw-r--r--chrome/test/automation/automation_proxy.cc8
-rw-r--r--chrome/test/automation/automation_proxy.h11
-rw-r--r--chrome/test/automation/extension_proxy_uitest.cc4
-rw-r--r--chrome/test/pyautolib/pyautolib.cc4
-rw-r--r--chrome/test/pyautolib/pyautolib.h2
-rw-r--r--chrome/test/pyautolib/pyautolib.i2
-rw-r--r--chrome/test/ui/infobars_uitest.cc50
13 files changed, 19 insertions, 138 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index ccba52b..023b337 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -567,7 +567,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForPopupMenuToOpen,
WaitForPopupMenuToOpen)
#endif
- IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme)
IPC_END_MESSAGE_MAP()
}
@@ -2794,7 +2793,7 @@ void AutomationProvider::WaitForExtensionTestResult(
}
void AutomationProvider::InstallExtensionAndGetHandle(
- const FilePath& crx_path, bool with_ui, IPC::Message* reply_message) {
+ const FilePath& crx_path, IPC::Message* reply_message) {
ExtensionsService* service = profile_->GetExtensionsService();
ExtensionProcessManager* manager = profile_->GetExtensionProcessManager();
if (service && manager) {
@@ -2805,12 +2804,10 @@ void AutomationProvider::InstallExtensionAndGetHandle(
AutomationMsg_InstallExtensionAndGetHandle::ID,
reply_message);
- ExtensionInstallUI* client =
- (with_ui ? new ExtensionInstallUI(profile_) : NULL);
scoped_refptr<CrxInstaller> installer(
new CrxInstaller(service->install_directory(),
service,
- client));
+ NULL)); // silent install, no UI
installer->set_allow_privilege_increase(true);
installer->InstallCrx(crx_path);
} else {
@@ -3010,7 +3007,3 @@ void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) {
NOTIMPLEMENTED();
}
#endif // !defined(TOOLKIT_VIEWS)
-
-void AutomationProvider::ResetToDefaultTheme() {
- profile_->ClearTheme();
-}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 9db04eb..0c30ced 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -398,7 +398,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void WaitForExtensionTestResult(IPC::Message* reply_message);
void InstallExtensionAndGetHandle(const FilePath& crx_path,
- bool with_ui,
IPC::Message* reply_message);
void UninstallExtension(int extension_handle,
@@ -561,9 +560,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
bool value,
bool* success);
- // Resets to the default theme.
- void ResetToDefaultTheme();
-
// Gets the current used encoding name of the page in the specified tab.
void GetPageCurrentEncoding(int tab_handle, std::string* current_encoding);
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 345a57f..196f9ff 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -14,28 +14,20 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/notification_service.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate(
TabContents* tab_contents, const Extension* new_theme,
const std::string& previous_theme_id)
- : ConfirmInfoBarDelegate(tab_contents),
- profile_(tab_contents->profile()),
- name_(new_theme->name()),
- theme_id_(new_theme->id()),
- previous_theme_id_(previous_theme_id),
- tab_contents_(tab_contents) {
+ : ConfirmInfoBarDelegate(tab_contents),
+ profile_(tab_contents->profile()),
+ name_(new_theme->name()),
+ previous_theme_id_(previous_theme_id) {
profile_->GetThemeProvider()->OnInfobarDisplayed();
- registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
- NotificationService::AllSources());
}
ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() {
- // We don't want any notifications while we're running our destructor.
- registrar_.RemoveAll();
-
profile_->GetThemeProvider()->OnInfobarDestroyed();
}
@@ -93,22 +85,3 @@ bool ThemeInstalledInfoBarDelegate::Cancel() {
profile_->ClearTheme();
return true;
}
-
-void ThemeInstalledInfoBarDelegate::Observe(
- NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- switch (type.value) {
- case NotificationType::BROWSER_THEME_CHANGED: {
- // If the new theme is different from what this info bar is associated
- // with, close this info bar since it is no longer relevant.
- Extension* extension = Details<Extension>(details).ptr();
- if (!extension || theme_id_ != extension->id())
- tab_contents_->RemoveInfoBar(this);
- break;
- }
-
- default:
- NOTREACHED();
- }
-}
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h
index beb99c6..b8baf41 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.h
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_
#include "chrome/browser/tab_contents/infobar_delegate.h"
-#include "chrome/common/notification_registrar.h"
class Extension;
class SkBitmap;
@@ -14,8 +13,7 @@ class TabContents;
// When a user installs a theme, we display it immediately, but provide an
// infobar allowing them to cancel.
-class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate,
- public NotificationObserver {
+class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
ThemeInstalledInfoBarDelegate(TabContents* tab_contents,
const Extension* new_theme,
@@ -30,30 +28,15 @@ class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate,
ConfirmInfoBarDelegate::InfoBarButton button) const;
virtual bool Cancel();
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
protected:
Profile* profile() { return profile_; }
private:
Profile* profile_;
-
// Name of theme that's just been installed.
std::string name_;
-
- // ID of theme that's just been installed.
- std::string theme_id_;
-
// Used to undo theme install.
std::string previous_theme_id_;
-
- // Tab to which this info bar is associated.
- TabContents* tab_contents_;
-
- // Registers and unregisters us for notifications.
- NotificationRegistrar registrar_;
};
#endif // CHROME_BROWSER_EXTENSIONS_THEME_INSTALLED_INFOBAR_DELEGATE_H_
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 5dc1351..dc8cb1e 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -326,7 +326,6 @@
'test/ui/dromaeo_benchmark_uitest.cc',
'test/ui/fast_shutdown_uitest.cc',
'test/ui/history_uitest.cc',
- 'test/ui/infobars_uitest.cc',
'test/ui/layout_plugin_uitest.cc',
'test/ui/mouseleave_uitest.cc',
'test/ui/npapi_uitest.cc',
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 32caec0..8430172 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -1324,9 +1324,8 @@ IPC_BEGIN_MESSAGES(Automation)
// Installs an extension from the crx file and returns its id.
// On error, |extension handle| will be 0.
- IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_InstallExtensionAndGetHandle,
+ IPC_SYNC_MESSAGE_ROUTED1_1(AutomationMsg_InstallExtensionAndGetHandle,
FilePath /* full path to crx file */,
- bool /* with UI */,
int /* extension handle */)
// Waits for the next extension test result. Sets |test result| as the
@@ -1375,7 +1374,4 @@ IPC_BEGIN_MESSAGES(Automation)
bool /* success */,
std::string /* property value */)
- // Resets to the default theme.
- IPC_SYNC_MESSAGE_ROUTED0_0(AutomationMsg_ResetToDefaultTheme)
-
IPC_END_MESSAGES(Automation)
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index d49ae9a..ecaf5d8 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -234,9 +234,9 @@ bool AutomationProxy::SavePackageShouldPromptUser(bool should_prompt) {
}
scoped_refptr<ExtensionProxy> AutomationProxy::InstallExtension(
- const FilePath& crx_file, bool with_ui) {
+ const FilePath& crx_file) {
int handle = 0;
- if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(0, crx_file, with_ui,
+ if (!Send(new AutomationMsg_InstallExtensionAndGetHandle(0, crx_file,
&handle)))
return NULL;
@@ -531,7 +531,3 @@ bool AutomationProxy::LoginWithUserAndPass(const std::string& username,
return sent && success;
}
#endif
-
-bool AutomationProxy::ResetToDefaultTheme() {
- return Send(new AutomationMsg_ResetToDefaultTheme(0));
-}
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index 45286fe..f68633e 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -183,12 +183,10 @@ class AutomationProxy : public IPC::Channel::Listener,
// sent.
bool SavePackageShouldPromptUser(bool should_prompt) WARN_UNUSED_RESULT;
- // Installs the extension crx. If |with_ui| is true an install confirmation
- // and notification UI is shown, otherwise the install is silent. Returns the
- // ExtensionProxy for the installed extension, or NULL on failure.
+ // Installs the extension crx. Returns the ExtensionProxy for the
+ // installed extension, or NULL on failure.
// Note: Overinstalls and downgrades will return NULL.
- scoped_refptr<ExtensionProxy> InstallExtension(const FilePath& crx_file,
- bool with_ui);
+ scoped_refptr<ExtensionProxy> InstallExtension(const FilePath& crx_file);
// Asserts that the next extension test result is true.
void EnsureExtensionTestResult();
@@ -197,9 +195,6 @@ class AutomationProxy : public IPC::Channel::Listener,
// Returns true on success.
bool GetEnabledExtensions(std::vector<FilePath>* extension_directories);
- // Resets to the default theme. Returns true on success.
- bool ResetToDefaultTheme();
-
#if defined(OS_CHROMEOS)
// Logs in through the Chrome OS login wizard with given |username|
// and |password|. Returns true on success.
diff --git a/chrome/test/automation/extension_proxy_uitest.cc b/chrome/test/automation/extension_proxy_uitest.cc
index 0954f5a..18d385c 100644
--- a/chrome/test/automation/extension_proxy_uitest.cc
+++ b/chrome/test/automation/extension_proxy_uitest.cc
@@ -32,7 +32,7 @@ class ExtensionProxyUITest : public UITest {
scoped_refptr<ExtensionProxy> InstallSimpleBrowserActionExtension() {
return automation()->InstallExtension(
test_data_directory_.AppendASCII("extensions").AppendASCII("uitest").
- AppendASCII("simple_browser_action.crx"), false);
+ AppendASCII("simple_browser_action.crx"));
}
// Installs a extension which, when clicking the browser action, renames
@@ -41,7 +41,7 @@ class ExtensionProxyUITest : public UITest {
scoped_refptr<ExtensionProxy> InstallRenameTabExtension() {
return automation()->InstallExtension(
test_data_directory_.AppendASCII("extensions").AppendASCII("uitest").
- AppendASCII("rename_tab.crx"), false);
+ AppendASCII("rename_tab.crx"));
}
// The google translate extension, which is installed on test setup.
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index fab3832..39a5b32 100644
--- a/chrome/test/pyautolib/pyautolib.cc
+++ b/chrome/test/pyautolib/pyautolib.cc
@@ -156,9 +156,9 @@ bool PyUITestBase::OpenNewBrowserWindow(bool show) {
return automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, show);
}
-bool PyUITestBase::InstallExtension(const FilePath& crx_file, bool with_ui) {
+bool PyUITestBase::InstallExtension(const FilePath& crx_file) {
scoped_refptr<ExtensionProxy> proxy =
- automation()->InstallExtension(crx_file, with_ui);
+ automation()->InstallExtension(crx_file);
return proxy.get() != NULL;
}
diff --git a/chrome/test/pyautolib/pyautolib.h b/chrome/test/pyautolib/pyautolib.h
index 321cfde..1093fda 100644
--- a/chrome/test/pyautolib/pyautolib.h
+++ b/chrome/test/pyautolib/pyautolib.h
@@ -100,7 +100,7 @@ class PyUITestBase : public UITestBase {
// Installs the extension crx. Returns true only if extension was installed
// and loaded successfully. Overinstalls will fail.
- bool InstallExtension(const FilePath& crx_file, bool with_ui);
+ bool InstallExtension(const FilePath& crx_file);
// Returns bookmark bar visibility state.
bool GetBookmarkBarVisibility();
diff --git a/chrome/test/pyautolib/pyautolib.i b/chrome/test/pyautolib/pyautolib.i
index 681fa74..885bea8 100644
--- a/chrome/test/pyautolib/pyautolib.i
+++ b/chrome/test/pyautolib/pyautolib.i
@@ -307,7 +307,7 @@ class PyUITestBase {
%feature("docstring", "Install an extension from the given file. Returns "
"True if successfully installed and loaded.") InstallExtension;
- bool InstallExtension(const FilePath& crx_file, bool with_ui);
+ bool InstallExtension(const FilePath& crx_file);
%feature("docstring", "Get a proxy to the browser window at the given "
"zero-based index.") GetBrowserWindow;
diff --git a/chrome/test/ui/infobars_uitest.cc b/chrome/test/ui/infobars_uitest.cc
deleted file mode 100644
index 4670ad6..0000000
--- a/chrome/test/ui/infobars_uitest.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-#include "chrome/test/automation/browser_proxy.h"
-#include "chrome/test/automation/extension_proxy.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/ui/ui_test.h"
-#include "net/url_request/url_request_unittest.h"
-
-class InfoBarsUITest : public UITest {
- public:
- InfoBarsUITest() {
- show_window_ = true;
- }
-};
-
-TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) {
- const wchar_t kDocRoot[] = L"chrome/test/data";
- scoped_refptr<HTTPTestServer> server =
- HTTPTestServer::CreateServer(kDocRoot, NULL);
- ASSERT_TRUE(server.get() != NULL);
- scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
- ASSERT_TRUE(browser.get());
-
- scoped_refptr<TabProxy> tab_1(browser->GetActiveTab());
- ASSERT_TRUE(tab_1.get());
- EXPECT_TRUE(tab_1->NavigateToURL(
- server->TestServerPageW(L"files/simple.html")));
- scoped_refptr<ExtensionProxy> theme = automation()->InstallExtension(
- test_data_directory_.AppendASCII("extensions").AppendASCII("theme.crx"),
- true);
- ASSERT_TRUE(theme != NULL);
- EXPECT_TRUE(tab_1->WaitForInfoBarCount(1, action_max_timeout_ms()));
-
- EXPECT_TRUE(browser->AppendTab(
- server->TestServerPageW(L"files/simple.html")));
- WaitUntilTabCount(2);
- scoped_refptr<TabProxy> tab_2(browser->GetActiveTab());
- ASSERT_TRUE(tab_2.get());
- theme = automation()->InstallExtension(
- test_data_directory_.AppendASCII("extensions").AppendASCII("theme2.crx"),
- true);
- ASSERT_TRUE(theme != NULL);
- EXPECT_TRUE(tab_2->WaitForInfoBarCount(1, action_max_timeout_ms()));
- EXPECT_TRUE(tab_1->WaitForInfoBarCount(0, action_max_timeout_ms()));
-
- EXPECT_TRUE(automation()->ResetToDefaultTheme());
- EXPECT_TRUE(tab_2->WaitForInfoBarCount(0, action_max_timeout_ms()));
-}