summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 03:30:22 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 03:30:22 +0000
commit59560e0ba999d5edc33453d4a0fbf44831025817 (patch)
treef365944f6f0eca593a28747a7fed4caf169578fb /chrome/browser/automation
parent4d2868972ff25746d39ecea58e88480ae0463145 (diff)
downloadchromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.zip
chromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.tar.gz
chromium_src-59560e0ba999d5edc33453d4a0fbf44831025817.tar.bz2
Move download shelf from per-tab to per-window. Also disable auto-hiding of
the shelf. BUG=9025 TEST=Download file in one tab, open new tab, and check that download shelf is still open. Also try the shelf's close button and the "show all downloads" link. When saving a file, the download animation should not show up. Review URL: http://codereview.chromium.org/115740 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc24
-rw-r--r--chrome/browser/automation/automation_provider.h1
2 files changed, 22 insertions, 3 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index c2e0877..7fce063 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/download/download_manager.h"
+#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/find_bar.h"
#include "chrome/browser/find_bar_controller.h"
#include "chrome/browser/find_notification_details.h"
@@ -1082,6 +1083,7 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_WindowTitle, GetWindowTitle)
IPC_MESSAGE_HANDLER(AutomationMsg_SetEnableExtensionAutomation,
SetEnableExtensionAutomation)
+ IPC_MESSAGE_HANDLER(AutomationMsg_SetShelfVisibility, SetShelfVisibility)
IPC_END_MESSAGE_MAP()
}
@@ -1956,11 +1958,27 @@ void AutomationProvider::ExecuteJavascript(int handle,
void AutomationProvider::GetShelfVisibility(int handle, bool* visible) {
*visible = false;
- TabContents* tab_contents = GetTabContentsForHandle(handle, NULL);
- if (tab_contents)
- *visible = tab_contents->IsDownloadShelfVisible();
+ if (browser_tracker_->ContainsHandle(handle)) {
+ Browser* browser = browser_tracker_->GetResource(handle);
+ if (browser) {
+ *visible = browser->window()->IsDownloadShelfVisible();
+ }
+ }
+}
+
+void AutomationProvider::SetShelfVisibility(int handle, bool visible) {
+ if (browser_tracker_->ContainsHandle(handle)) {
+ Browser* browser = browser_tracker_->GetResource(handle);
+ if (browser) {
+ if (visible)
+ browser->window()->GetDownloadShelf()->Show();
+ else
+ browser->window()->GetDownloadShelf()->Close();
+ }
+ }
}
+
void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) {
*count = -1; // -1 is the error code
if (tab_tracker_->ContainsHandle(handle)) {
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 1506868..8673bed 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -215,6 +215,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
const std::wstring& script,
IPC::Message* reply_message);
void GetShelfVisibility(int handle, bool* visible);
+ void SetShelfVisibility(int handle, bool visible);
void SetFilteredInet(const IPC::Message& message, bool enabled);
void SetProxyConfig(const std::string& new_proxy_config);