summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/filebrowse_ui.cc
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-05 18:19:25 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-05 18:19:25 +0000
commitf5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c (patch)
tree98b1017d118b3157a449d0b917b3c1ce57869f81 /chrome/browser/dom_ui/filebrowse_ui.cc
parentcd023e807914d91d64e325391bde25ff0bdea3f3 (diff)
downloadchromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.zip
chromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.tar.gz
chromium_src-f5bf8ccfcaa51e3f8b12e7eaf4bb26fa6bf2d69c.tar.bz2
Show the filebrowse ui rather than the download shelf in chromeos.
This cl displays the filebrowse ui rather than download shelf for downloads in chrom(e|ium) os. It conditionally replaces (with preprocessor macros) the Browser::OnStartDownload method to do this. The cl adds a static FileBrowseUI::OpenPopup(profile, hashArgument), which opens the file browse ui and passes it the provided hash argument. This is invoked directly from Browser::OnStartDownload. The USBMountObserver code was changed to call this static method, rather than open the popup by hand as it had been doing. I'm not sure about ownership of the Browser* returned by OpenPopup, but based on other code in the tree I assume chrome will deal with freeing it when appropriate. Before this change, USBMountObserver would add the window to registrar_ *before* showing it. Now that FileBrowseUI::OpenPopup returns a which which is already visible, this is no longer the case. I assume this won't be a problem. Commit this for rginda. Original review: http://codereview.chromium.org/555167 BUG=none TEST=none Review URL: http://codereview.chromium.org/564022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/filebrowse_ui.cc')
-rw-r--r--chrome/browser/dom_ui/filebrowse_ui.cc29
1 files changed, 28 insertions, 1 deletions
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 103ab07..b6d4498 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -54,6 +54,12 @@ static const std::string kPicasawebDefault = "/albumid/default";
static const std::string kPicasawebDropBox = "/DropBox";
static const std::string kPicasawebBaseUrl = "http://picasaweb.google.com/";
+static const char* kFilebrowseURLHash = "chrome://filebrowse#";
+static const int kPopupLeft = 0;
+static const int kPopupTop = 0;
+static const int kPopupWidth = 250;
+static const int kPopupHeight = 300;
+
class FileBrowseUIHTMLSource : public ChromeURLDataManager::DataSource {
public:
FileBrowseUIHTMLSource();
@@ -678,7 +684,7 @@ void FilebrowseHandler::SendCurrentDownloads() {
////////////////////////////////////////////////////////////////////////////////
//
-// FileBrowseUIContents
+// FileBrowseUI
//
////////////////////////////////////////////////////////////////////////////////
@@ -696,3 +702,24 @@ FileBrowseUI::FileBrowseUI(TabContents* contents) : HtmlDialogUI(contents) {
&ChromeURLDataManager::AddDataSource,
make_scoped_refptr(html_source)));
}
+
+// static
+Browser *FileBrowseUI::OpenPopup(Profile *profile,
+ const std::string hashArgument) {
+ Browser* browser = Browser::CreateForPopup(profile);
+
+ std::string url(kFilebrowseURLHash);
+ url.append(hashArgument);
+
+ browser->AddTabWithURL(
+ GURL(url), GURL(), PageTransition::LINK,
+ true, -1, false, NULL);
+ browser->window()->SetBounds(gfx::Rect(kPopupLeft,
+ kPopupTop,
+ kPopupWidth,
+ kPopupHeight));
+
+ browser->window()->Show();
+
+ return browser;
+}