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

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

Issue 275483005: Fix initial focus, and the way elements are disabled on the 'Clear browsing data' dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed final round of comments. Created 6 years, 6 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
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 allow_deleting_browser_history_.Init( 48 allow_deleting_browser_history_.Init(
49 prefs::kAllowDeletingBrowserHistory, 49 prefs::kAllowDeletingBrowserHistory,
50 prefs, 50 prefs,
51 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged, 51 base::Bind(&ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged,
52 base::Unretained(this))); 52 base::Unretained(this)));
53 } 53 }
54 54
55 void ClearBrowserDataHandler::InitializePage() { 55 void ClearBrowserDataHandler::InitializePage() {
56 UpdateInfoBannerVisibility(); 56 UpdateInfoBannerVisibility();
57 OnBrowsingHistoryPrefChanged(); 57 OnBrowsingHistoryPrefChanged();
58
59 bool removal_in_progress = !!remover_; 58 bool removal_in_progress = !!remover_;
60 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.setClearing", 59 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.setClearing",
61 base::FundamentalValue(removal_in_progress)); 60 base::FundamentalValue(removal_in_progress));
61
62 web_ui()->CallJavascriptFunction(
63 "ClearBrowserDataOverlay.markInitializationComplete");
62 } 64 }
63 65
64 void ClearBrowserDataHandler::UpdateInfoBannerVisibility() { 66 void ClearBrowserDataHandler::UpdateInfoBannerVisibility() {
65 Profile* profile = Profile::FromWebUI(web_ui()); 67 Profile* profile = Profile::FromWebUI(web_ui());
66 base::Time lastClearBrowsingDataTime = base::Time::FromInternalValue( 68 base::Time lastClearBrowsingDataTime = base::Time::FromInternalValue(
67 profile->GetPrefs()->GetInt64(prefs::kLastClearBrowsingDataTime)); 69 profile->GetPrefs()->GetInt64(prefs::kLastClearBrowsingDataTime));
68 70
69 const int64 kHoursPerDay = 24; 71 const int64 kHoursPerDay = 24;
70 bool visible = (base::Time::Now() - lastClearBrowsingDataTime) <= 72 bool visible = (base::Time::Now() - lastClearBrowsingDataTime) <=
71 base::TimeDelta::FromHours(kHoursPerDay); 73 base::TimeDelta::FromHours(kHoursPerDay);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 211
210 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() { 212 void ClearBrowserDataHandler::OnBrowsingDataRemoverDone() {
211 // No need to remove ourselves as an observer as BrowsingDataRemover deletes 213 // No need to remove ourselves as an observer as BrowsingDataRemover deletes
212 // itself after we return. 214 // itself after we return.
213 remover_ = NULL; 215 remover_ = NULL;
214 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing"); 216 web_ui()->CallJavascriptFunction("ClearBrowserDataOverlay.doneClearing");
215 } 217 }
216 218
217 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() { 219 void ClearBrowserDataHandler::OnBrowsingHistoryPrefChanged() {
218 web_ui()->CallJavascriptFunction( 220 web_ui()->CallJavascriptFunction(
219 "ClearBrowserDataOverlay.updateHistoryCheckboxes", 221 "ClearBrowserDataOverlay.setAllowDeletingHistory",
220 base::FundamentalValue(*allow_deleting_browser_history_)); 222 base::FundamentalValue(*allow_deleting_browser_history_));
221 } 223 }
222 224
223 } // namespace options 225 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/clear_browser_data_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698