Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1981)

Unified Diff: chrome/browser/importer/importer_host.cc

Issue 10750018: Remove browser::FindLastActiveWithProfile call in importer code. There are many ways to create an I… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/importer_host.h ('k') | chrome/browser/ui/webui/options2/import_data_handler2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+}
« no previous file with comments | « chrome/browser/importer/importer_host.h ('k') | chrome/browser/ui/webui/options2/import_data_handler2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698