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

Unified Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 10154004: re-use WebUIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WeakPtr solution Created 8 years, 8 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/ui/webui/downloads_dom_handler.h ('k') | chrome/browser/ui/webui/gpu_internals_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/downloads_dom_handler.cc
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
index 71b75158cd1c85090aae64a589fd8d3cb30e33cd..0d10854b64b551583f4fcc44b0240677cb3f294b 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -92,6 +92,7 @@ DownloadsDOMHandler::DownloadsDOMHandler(content::DownloadManager* dlm)
: search_text_(),
download_manager_(dlm),
original_profile_download_manager_(NULL),
+ initialized_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
// Create our fileicon data source.
Profile* profile = Profile::FromBrowserContext(dlm->GetBrowserContext());
@@ -115,6 +116,10 @@ DownloadsDOMHandler::~DownloadsDOMHandler() {
// DownloadsDOMHandler, public: -----------------------------------------------
void DownloadsDOMHandler::OnPageLoaded(const base::ListValue* args) {
+ if (initialized_)
+ return;
+ initialized_ = true;
+
download_manager_->AddObserver(this);
if (original_profile_download_manager_)
original_profile_download_manager_->AddObserver(this);
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.h ('k') | chrome/browser/ui/webui/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698