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

Side by Side Diff: chrome/browser/ui/webui/options/clear_browser_data_handler.cc

Issue 7554008: Removal of Profile from content part 6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Profile helper function, rebase Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/clear_browser_data_handler.h" 5 #include "chrome/browser/ui/webui/options/clear_browser_data_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void ClearBrowserDataHandler::RegisterMessages() { 85 void ClearBrowserDataHandler::RegisterMessages() {
86 // Setup handlers specific to this panel. 86 // Setup handlers specific to this panel.
87 DCHECK(web_ui_); 87 DCHECK(web_ui_);
88 web_ui_->RegisterMessageCallback("performClearBrowserData", 88 web_ui_->RegisterMessageCallback("performClearBrowserData",
89 NewCallback(this, &ClearBrowserDataHandler::HandleClearBrowserData)); 89 NewCallback(this, &ClearBrowserDataHandler::HandleClearBrowserData));
90 } 90 }
91 91
92 void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) { 92 void ClearBrowserDataHandler::HandleClearBrowserData(const ListValue* value) {
93 Profile* profile = web_ui_->GetProfile(); 93 Profile* profile = Profile::FromWebUI(web_ui_);
94 PrefService* prefs = profile->GetPrefs(); 94 PrefService* prefs = profile->GetPrefs();
95 95
96 int remove_mask = 0; 96 int remove_mask = 0;
97 if (prefs->GetBoolean(prefs::kDeleteBrowsingHistory)) 97 if (prefs->GetBoolean(prefs::kDeleteBrowsingHistory))
98 remove_mask |= BrowsingDataRemover::REMOVE_HISTORY; 98 remove_mask |= BrowsingDataRemover::REMOVE_HISTORY;
99 if (prefs->GetBoolean(prefs::kDeleteDownloadHistory)) 99 if (prefs->GetBoolean(prefs::kDeleteDownloadHistory))
100 remove_mask |= BrowsingDataRemover::REMOVE_DOWNLOADS; 100 remove_mask |= BrowsingDataRemover::REMOVE_DOWNLOADS;
101 if (prefs->GetBoolean(prefs::kDeleteCache)) 101 if (prefs->GetBoolean(prefs::kDeleteCache))
102 remove_mask |= BrowsingDataRemover::REMOVE_CACHE; 102 remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
103 if (prefs->GetBoolean(prefs::kDeleteCookies)) { 103 if (prefs->GetBoolean(prefs::kDeleteCookies)) {
(...skipping 25 matching lines...) Expand all
129 remover_->Remove(remove_mask); 129 remover_->Remove(remove_mask);
130 } 130 }
131 131
132 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { 132 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
133 // No need to remove ourselves as an observer as BrowsingDataRemover deletes 133 // No need to remove ourselves as an observer as BrowsingDataRemover deletes
134 // itself after we return. 134 // itself after we return.
135 remover_ = NULL; 135 remover_ = NULL;
136 DCHECK(web_ui_); 136 DCHECK(web_ui_);
137 web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing"); 137 web_ui_->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
138 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698