summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/dom_ui/options/options_ui.cc11
-rw-r--r--chrome/browser/dom_ui/options/options_ui.h5
2 files changed, 14 insertions, 2 deletions
diff --git a/chrome/browser/dom_ui/options/options_ui.cc b/chrome/browser/dom_ui/options/options_ui.cc
index ffd8d78..26f0fbe 100644
--- a/chrome/browser/dom_ui/options/options_ui.cc
+++ b/chrome/browser/dom_ui/options/options_ui.cc
@@ -135,7 +135,8 @@ void OptionsPageUIHandler::UserMetricsRecordAction(
//
////////////////////////////////////////////////////////////////////////////////
-OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
+OptionsUI::OptionsUI(TabContents* contents)
+ : DOMUI(contents), initialized_handlers_(false) {
DictionaryValue* localized_strings = new DictionaryValue();
#if defined(OS_CHROMEOS)
@@ -258,6 +259,14 @@ RefCountedMemory* OptionsUI::GetFaviconResourceBytes() {
void OptionsUI::InitializeHandlers() {
DCHECK(!GetProfile()->IsOffTheRecord());
+ // The reinitialize call from DidBecomeActiveForReusedRenderView end up being
+ // delivered after a new web page DOM has been brought up in an existing
+ // renderer (due to IPC delays), causing this method to be called twice. If
+ // that happens, ignore the second call.
+ if (initialized_handlers_)
+ return;
+ initialized_handlers_ = true;
+
std::vector<DOMMessageHandler*>::iterator iter;
// Skip over the generic handler.
for (iter = handlers_.begin() + 1; iter != handlers_.end(); ++iter) {
diff --git a/chrome/browser/dom_ui/options/options_ui.h b/chrome/browser/dom_ui/options/options_ui.h
index ad1007d..1ceab2ce 100644
--- a/chrome/browser/dom_ui/options/options_ui.h
+++ b/chrome/browser/dom_ui/options/options_ui.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -53,6 +53,7 @@ class OptionsPageUIHandler : public DOMMessageHandler,
virtual void GetLocalizedValues(DictionaryValue* localized_strings) = 0;
// Initialize the page. Called once the DOM is available for manipulation.
+ // This will be called only once.
virtual void Initialize() {}
// Uninitializes the page. Called just before the object is destructed.
@@ -91,6 +92,8 @@ class OptionsUI : public DOMUI {
void AddOptionsPageUIHandler(DictionaryValue* localized_strings,
OptionsPageUIHandler* handler);
+ bool initialized_handlers_;
+
DISALLOW_COPY_AND_ASSIGN(OptionsUI);
};