diff options
author | dhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 19:17:31 +0000 |
---|---|---|
committer | dhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 19:17:31 +0000 |
commit | 9ee17e8cc5429a85d4754468c7233f8e2f8ef980 (patch) | |
tree | 9af1909f26530c58b773088ba4681488055e8a51 /chrome/browser/dom_ui | |
parent | 11f0757a69e1c1fca3cd4787a339885e82d59b46 (diff) | |
download | chromium_src-9ee17e8cc5429a85d4754468c7233f8e2f8ef980.zip chromium_src-9ee17e8cc5429a85d4754468c7233f8e2f8ef980.tar.gz chromium_src-9ee17e8cc5429a85d4754468c7233f8e2f8ef980.tar.bz2 |
Fixing filebrowser so it opens with a panel with no location bar. making it so only one can be opened, and making it so that it expands on getting a new download.
BUG=chromium-os:4995
TEST=verify that all the above happens (tested on device)
Review URL: http://codereview.chromium.org/3094001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/filebrowse_ui.cc | 26 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_browsertest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_ui.cc | 6 |
3 files changed, 28 insertions, 8 deletions
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc index 3637f41..84c813f 100644 --- a/chrome/browser/dom_ui/filebrowse_ui.cc +++ b/chrome/browser/dom_ui/filebrowse_ui.cc @@ -747,7 +747,7 @@ void FilebrowseHandler::OpenNewWindow(const Value* value, bool popup) { } Browser* browser; if (popup) { - browser = Browser::CreateForPopup(profile_); + browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile_); } else { browser = BrowserList::GetLastActive(); } @@ -1109,7 +1109,7 @@ Browser* FileBrowseUI::OpenPopup(Profile* profile, // Create new browser if no matching pop up found. if (browser == NULL) { - browser = Browser::CreateForPopup(profile); + browser = Browser::CreateForType(Browser::TYPE_APP_PANEL, profile); std::string url; if (hashArgument.empty()) { url = chrome::kChromeUIFileBrowseURL; @@ -1127,15 +1127,33 @@ Browser* FileBrowseUI::OpenPopup(Profile* profile, height)); browser->window()->Show(); + } else { + browser->window()->Show(); } return browser; } Browser* FileBrowseUI::GetPopupForPath(const std::string& path) { + std::string current_path = path; + if (current_path.empty()) { + Profile* profile = BrowserList::GetLastActive()->profile(); + PrefService* pref_service = profile->GetPrefs(); + bool is_enabled = pref_service->GetBoolean( + prefs::kLabsAdvancedFilesystemEnabled); + if (!is_enabled) { + FilePath default_download_path; + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, + &default_download_path)) { + NOTREACHED(); + } + current_path = default_download_path.value(); + } + } + for (BrowserList::const_iterator it = BrowserList::begin(); it != BrowserList::end(); ++it) { - if ((*it)->type() == Browser::TYPE_POPUP) { + if (((*it)->type() == Browser::TYPE_APP_PANEL)) { TabContents* tab_contents = (*it)->GetSelectedTabContents(); DCHECK(tab_contents); if (!tab_contents) @@ -1144,7 +1162,7 @@ Browser* FileBrowseUI::GetPopupForPath(const std::string& path) { if (url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUIFileBrowseHost && - url.ref() == path) { + url.ref() == current_path) { return (*it); } } diff --git a/chrome/browser/dom_ui/mediaplayer_browsertest.cc b/chrome/browser/dom_ui/mediaplayer_browsertest.cc index e2c582f..e1d7263 100644 --- a/chrome/browser/dom_ui/mediaplayer_browsertest.cc +++ b/chrome/browser/dom_ui/mediaplayer_browsertest.cc @@ -28,7 +28,7 @@ class MediaPlayerBrowserTest : public InProcessBrowserTest { bool IsPlayerVisible() { for (BrowserList::const_iterator it = BrowserList::begin(); it != BrowserList::end(); ++it) { - if ((*it)->type() == Browser::TYPE_POPUP) { + if ((*it)->type() == Browser::TYPE_APP_PANEL) { const GURL& url = (*it)->GetTabContentsAt((*it)->selected_index())->GetURL(); @@ -44,7 +44,7 @@ class MediaPlayerBrowserTest : public InProcessBrowserTest { bool IsPlaylistVisible() { for (BrowserList::const_iterator it = BrowserList::begin(); it != BrowserList::end(); ++it) { - if ((*it)->type() == Browser::TYPE_POPUP) { + if ((*it)->type() == Browser::TYPE_APP_PANEL) { const GURL& url = (*it)->GetTabContentsAt((*it)->selected_index())->GetURL(); diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc index b142559..d28ef79 100644 --- a/chrome/browser/dom_ui/mediaplayer_ui.cc +++ b/chrome/browser/dom_ui/mediaplayer_ui.cc @@ -516,7 +516,8 @@ void MediaPlayer::RemoveHandler(MediaplayerHandler* handler) { void MediaPlayer::PopupPlaylist(Browser* creator) { Profile* profile = BrowserList::GetLastActive()->profile(); - playlist_browser_ = Browser::CreateForPopup(profile); + playlist_browser_ = Browser::CreateForType(Browser::TYPE_APP_PANEL, + profile); playlist_browser_->AddTabWithURL( GURL(kMediaplayerPlaylistURL), GURL(), PageTransition::LINK, -1, TabStripModel::ADD_SELECTED, NULL, std::string()); @@ -536,7 +537,8 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) { return; } Profile* profile = BrowserList::GetLastActive()->profile(); - mediaplayer_browser_ = Browser::CreateForPopup(profile); + mediaplayer_browser_ = Browser::CreateForType(Browser::TYPE_APP_PANEL, + profile); #if defined(OS_CHROMEOS) // Since we are on chromeos, popups should be a PanelBrowserView, // so we can just cast it. |