Index: chrome/browser/importer/importer_host.cc |
=================================================================== |
--- chrome/browser/importer/importer_host.cc (revision 145643) |
+++ chrome/browser/importer/importer_host.cc (working copy) |
@@ -20,7 +20,6 @@ |
#include "chrome/browser/search_engines/template_url.h" |
#include "chrome/browser/search_engines/template_url_service.h" |
#include "chrome/browser/search_engines/template_url_service_factory.h" |
-#include "chrome/browser/ui/browser_finder.h" |
#include "chrome/browser/ui/browser_tabstrip.h" |
#include "chrome/browser/ui/simple_message_box.h" |
#include "chrome/common/chrome_notification_types.h" |
@@ -40,7 +39,9 @@ |
importer_(NULL), |
headless_(false), |
parent_window_(NULL), |
+ browser_(NULL), |
observer_(NULL) { |
+ BrowserList::AddObserver(this); |
} |
void ImporterHost::ShowWarningDialog() { |
@@ -163,10 +164,8 @@ |
chrome::MESSAGE_BOX_TYPE_INFORMATION); |
GURL url("https://accounts.google.com/ServiceLogin"); |
- DCHECK(profile_); |
- Browser* browser = browser::FindLastActiveWithProfile(profile_); |
- if (browser) |
- chrome::AddSelectedTabWithURL(browser, url, |
+ if (browser_) |
+ chrome::AddSelectedTabWithURL(browser_, url, |
content::PAGE_TRANSITION_TYPED); |
MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
@@ -184,6 +183,7 @@ |
} |
ImporterHost::~ImporterHost() { |
+ BrowserList::RemoveObserver(this); |
if (NULL != importer_) |
importer_->Release(); |
@@ -266,3 +266,8 @@ |
registrar_.RemoveAll(); |
InvokeTaskIfDone(); |
} |
+ |
+void ImporterHost::OnBrowserRemoved(Browser* browser) { |
+ if (browser_ == browser) |
+ browser_ = NULL; |
Ben Goodger (Google)
2012/07/10 15:13:10
idle thinking... would be cool if this could someh
|
+} |