OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" | 5 #include "chrome/browser/dom_ui/clear_browser_data_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/pref_service.h" | 10 #include "chrome/browser/pref_service.h" |
11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "grit/chromium_strings.h" | 13 #include "grit/chromium_strings.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "grit/locale_settings.h" | 15 #include "grit/locale_settings.h" |
16 | 16 |
17 ClearBrowserDataHandler::ClearBrowserDataHandler() { | 17 ClearBrowserDataHandler::ClearBrowserDataHandler() : remover_(NULL) { |
18 } | 18 } |
19 | 19 |
20 ClearBrowserDataHandler::~ClearBrowserDataHandler() { | 20 ClearBrowserDataHandler::~ClearBrowserDataHandler() { |
| 21 if (remover_) { |
| 22 remover_->RemoveObserver(this); |
| 23 } |
21 } | 24 } |
22 | 25 |
23 void ClearBrowserDataHandler::GetLocalizedValues( | 26 void ClearBrowserDataHandler::GetLocalizedValues( |
24 DictionaryValue* localized_strings) { | 27 DictionaryValue* localized_strings) { |
25 DCHECK(localized_strings); | 28 DCHECK(localized_strings); |
26 localized_strings->SetString(L"clearBrowsingDataTitle", | 29 localized_strings->SetString(L"clearBrowsingDataTitle", |
27 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE)); | 30 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE)); |
28 localized_strings->SetString(L"clearBrowsingDataLabel", | 31 localized_strings->SetString(L"clearBrowsingDataLabel", |
29 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL)); | 32 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL)); |
30 localized_strings->SetString(L"clearBrowsingDataTimeLabel", | 33 localized_strings->SetString(L"clearBrowsingDataTimeLabel", |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 120 } |
118 | 121 |
119 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { | 122 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { |
120 // No need to remove ourselves as an observer as BrowsingDataRemover deletes | 123 // No need to remove ourselves as an observer as BrowsingDataRemover deletes |
121 // itself after we return. | 124 // itself after we return. |
122 remover_ = NULL; | 125 remover_ = NULL; |
123 DCHECK(dom_ui_); | 126 DCHECK(dom_ui_); |
124 dom_ui_->CallJavascriptFunction(L"clearBrowserDataDismiss"); | 127 dom_ui_->CallJavascriptFunction(L"clearBrowserDataDismiss"); |
125 } | 128 } |
126 | 129 |
OLD | NEW |