diff options
-rw-r--r-- | chrome/browser/browser_init.cc | 3 | ||||
-rw-r--r-- | chrome/browser/chromeos/usb_mount_observer.cc | 22 | ||||
-rw-r--r-- | chrome/browser/chromeos/usb_mount_observer.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_browsertest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_ui.cc | 16 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_ui.h | 7 |
6 files changed, 20 insertions, 33 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 301d7db..db5d173 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -410,9 +410,6 @@ bool BrowserInit::LaunchBrowser( chromeos::MountLibrary* lib = chromeos::CrosLibrary::Get()->GetMountLibrary(); chromeos::USBMountObserver* observe = chromeos::USBMountObserver::Get(); - MediaPlayer* player = MediaPlayer::Get(); - player->set_profile(profile); - observe->set_profile(profile); lib->AddObserver(observe); // Connect the chromeos notifications diff --git a/chrome/browser/chromeos/usb_mount_observer.cc b/chrome/browser/chromeos/usb_mount_observer.cc index 83b9266..c6d5db4 100644 --- a/chrome/browser/chromeos/usb_mount_observer.cc +++ b/chrome/browser/chromeos/usb_mount_observer.cc @@ -39,14 +39,16 @@ void USBMountObserver::Observe(NotificationType type, void USBMountObserver::OpenFileBrowse(const std::string& url, const std::string& device_path, bool small) { - Browser *browser; + Browser* browser; + Profile* profile; + profile = BrowserList::GetLastActive()->profile(); if (small) { - browser = FileBrowseUI::OpenPopup(profile_, + browser = FileBrowseUI::OpenPopup(profile, url, FileBrowseUI::kSmallPopupWidth, FileBrowseUI::kSmallPopupHeight); } else { - browser = FileBrowseUI::OpenPopup(profile_, + browser = FileBrowseUI::OpenPopup(profile, url, FileBrowseUI::kPopupWidth, FileBrowseUI::kPopupHeight); @@ -152,12 +154,14 @@ void USBMountObserver::RemoveBrowserFromVector(const std::string& path) { for (BrowserList::const_iterator it = BrowserList::begin(); it != BrowserList::end(); ++it) { if ((*it)->type() == Browser::TYPE_POPUP) { - const GURL& url = - (*it)->GetTabContentsAt((*it)->selected_index())->GetURL(); - if (url.SchemeIs(chrome::kChromeUIScheme) && - url.host() == chrome::kChromeUIFileBrowseHost && - url.ref().find(mount_path) != std::string::npos) { - close_these.push_back(*it); + if (*it && (*it)->GetTabContentsAt((*it)->selected_index())) { + const GURL& url = + (*it)->GetTabContentsAt((*it)->selected_index())->GetURL(); + if (url.SchemeIs(chrome::kChromeUIScheme) && + url.host() == chrome::kChromeUIFileBrowseHost && + url.ref().find(mount_path) != std::string::npos) { + close_these.push_back(*it); + } } } } diff --git a/chrome/browser/chromeos/usb_mount_observer.h b/chrome/browser/chromeos/usb_mount_observer.h index 6b309a5..0c4d93e 100644 --- a/chrome/browser/chromeos/usb_mount_observer.h +++ b/chrome/browser/chromeos/usb_mount_observer.h @@ -33,8 +33,6 @@ class USBMountObserver : public chromeos::MountLibrary::Observer, USBMountObserver() {} ~USBMountObserver() {} - void set_profile(Profile* profile) { profile_ = profile; } - static USBMountObserver* Get() { return Singleton<USBMountObserver>::get(); } @@ -57,7 +55,6 @@ class USBMountObserver : public chromeos::MountLibrary::Observer, const std::string& device_path, bool small); - Profile* profile_; std::vector<BrowserWithPath> browsers_; NotificationRegistrar registrar_; diff --git a/chrome/browser/dom_ui/mediaplayer_browsertest.cc b/chrome/browser/dom_ui/mediaplayer_browsertest.cc index 0f95715..83c2065 100644 --- a/chrome/browser/dom_ui/mediaplayer_browsertest.cc +++ b/chrome/browser/dom_ui/mediaplayer_browsertest.cc @@ -63,7 +63,6 @@ IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) { ui_test_utils::NavigateToURL(browser(), GURL("chrome://downloads")); MediaPlayer* player = MediaPlayer::Get(); - player->set_profile(browser()->profile()); // Check that its not currently visible ASSERT_FALSE(IsPlayerVisible()); @@ -78,7 +77,6 @@ IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, PopupPlaylist) { ui_test_utils::NavigateToURL(browser(), GURL("chrome://downloads")); MediaPlayer* player = MediaPlayer::Get(); - player->set_profile(browser()->profile()); player->EnqueueMediaURL(GetMusicTestURL()); diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc index cd362f9..12421e5 100644 --- a/chrome/browser/dom_ui/mediaplayer_ui.cc +++ b/chrome/browser/dom_ui/mediaplayer_ui.cc @@ -18,6 +18,7 @@ #include "base/weak_ptr.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" +#include "chrome/browser/browser_list.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" @@ -121,8 +122,6 @@ class MediaplayerHandler : public DOMMessageHandler, void SetCurrentPlaylist(const std::vector<GURL>& playlist, int offset); private: - // Profile to use when opening up new browsers. - Profile* profile_; // The current playlist of urls. std::vector<GURL> current_playlist_; // The offset into the current_playlist_ of the currently playing item. @@ -184,8 +183,7 @@ void MediaplayerUIHTMLSource::StartDataRequest(const std::string& path, // //////////////////////////////////////////////////////////////////////////////// MediaplayerHandler::MediaplayerHandler(bool is_playlist) - : profile_(NULL), - current_offset_(0), + : current_offset_(0), is_playlist_(is_playlist) { } @@ -200,7 +198,6 @@ DOMMessageHandler* MediaplayerHandler::Attach(DOMUI* dom_ui) { Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); - profile_ = dom_ui->GetProfile(); return DOMMessageHandler::Attach(dom_ui); } @@ -474,7 +471,8 @@ void MediaPlayer::RemoveHandler(MediaplayerHandler* handler) { } void MediaPlayer::PopupPlaylist() { - playlist_browser_ = Browser::CreateForPopup(profile_); + Profile* profile = BrowserList::GetLastActive()->profile(); + playlist_browser_ = Browser::CreateForPopup(profile); playlist_browser_->AddTabWithURL( GURL(kMediaplayerPlaylistURL), GURL(), PageTransition::LINK, true, -1, false, NULL); @@ -492,7 +490,8 @@ void MediaPlayer::PopupMediaPlayer() { NewRunnableMethod(this, &MediaPlayer::PopupMediaPlayer)); return; } - mediaplayer_browser_ = Browser::CreateForPopup(profile_); + Profile* profile = BrowserList::GetLastActive()->profile(); + mediaplayer_browser_ = Browser::CreateForPopup(profile); mediaplayer_browser_->AddTabWithURL( GURL(kMediaplayerURL), GURL(), PageTransition::LINK, true, -1, false, NULL); @@ -540,8 +539,7 @@ URLRequestJob* MediaPlayer::MaybeInterceptResponse( } MediaPlayer::MediaPlayer() - : profile_(NULL), - handler_(NULL), + : handler_(NULL), playlist_(NULL), playlist_browser_(NULL), mediaplayer_browser_(NULL), diff --git a/chrome/browser/dom_ui/mediaplayer_ui.h b/chrome/browser/dom_ui/mediaplayer_ui.h index 7704ef8..5f565dd 100644 --- a/chrome/browser/dom_ui/mediaplayer_ui.h +++ b/chrome/browser/dom_ui/mediaplayer_ui.h @@ -94,10 +94,6 @@ class MediaPlayer : public NotificationObserver, return Singleton<MediaPlayer>::get(); } - // Sets the profile to use when opening up new browser - // windows. - void set_profile(Profile* profile) { profile_ = profile; } - private: MediaPlayer(); @@ -112,9 +108,6 @@ class MediaPlayer : public NotificationObserver, // Registers the listeners for the close events on the browser windows. void RegisterListeners(); - // Should be set via a set_profile before Popup*() is called. - Profile* profile_; - // Set when the register handler is called. When the media player is // closed, this pointer is set back to NULL. MediaplayerHandler* handler_; |