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

Side by Side Diff: chrome/browser/ui/views/clear_browsing_data_view.cc

Issue 5964008: Add UI to the Clear Browsing Data dialog to remove Flash LSO data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 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/views/clear_browsing_data_view.h ('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) 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/views/clear_browsing_data_view.h" 5 #include "chrome/browser/views/clear_browsing_data_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_window.h" 10 #include "chrome/browser/browser_window.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 allow_clear_(true), 45 allow_clear_(true),
46 throbber_view_(NULL), 46 throbber_view_(NULL),
47 throbber_(NULL), 47 throbber_(NULL),
48 status_label_(NULL), 48 status_label_(NULL),
49 delete_all_label_(NULL), 49 delete_all_label_(NULL),
50 del_history_checkbox_(NULL), 50 del_history_checkbox_(NULL),
51 del_downloads_checkbox_(NULL), 51 del_downloads_checkbox_(NULL),
52 del_cache_checkbox_(NULL), 52 del_cache_checkbox_(NULL),
53 del_cookies_checkbox_(NULL), 53 del_cookies_checkbox_(NULL),
54 del_passwords_checkbox_(NULL), 54 del_passwords_checkbox_(NULL),
55 del_lso_data_checkbox_(NULL),
55 del_form_data_checkbox_(NULL), 56 del_form_data_checkbox_(NULL),
56 time_period_label_(NULL), 57 time_period_label_(NULL),
57 time_period_combobox_(NULL), 58 time_period_combobox_(NULL),
58 clear_browsing_data_button_(NULL), 59 clear_browsing_data_button_(NULL),
59 delete_in_progress_(false), 60 delete_in_progress_(false),
60 profile_(profile), 61 profile_(profile),
61 remover_(NULL) { 62 remover_(NULL) {
62 DCHECK(profile); 63 DCHECK(profile);
63 Init(); 64 Init();
64 InitControlLayout(); 65 InitControlLayout();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache)); 105 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache));
105 106
106 del_cookies_checkbox_ = 107 del_cookies_checkbox_ =
107 AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX), 108 AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX),
108 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies)); 109 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies));
109 110
110 del_passwords_checkbox_ = 111 del_passwords_checkbox_ =
111 AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX), 112 AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX),
112 profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords)); 113 profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords));
113 114
115 del_lso_data_checkbox_ =
116 AddCheckbox(l10n_util::GetString(IDS_DEL_FLASH_DATA_CHKBOX),
117 profile_->GetPrefs()->GetBoolean(prefs::kDeleteLSOData));
118
114 del_form_data_checkbox_ = 119 del_form_data_checkbox_ =
115 AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX), 120 AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX),
116 profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData)); 121 profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData));
117 122
118 clear_browsing_data_button_ = new views::NativeButton( 123 clear_browsing_data_button_ = new views::NativeButton(
119 this, l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_BUTTON)); 124 this, l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_BUTTON));
120 125
121 // Add a label which appears before the combo box for the time period. 126 // Add a label which appears before the combo box for the time period.
122 time_period_label_ = new views::Label( 127 time_period_label_ = new views::Label(
123 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL)); 128 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 206
202 layout->StartRow(0, indented_column_set_id); 207 layout->StartRow(0, indented_column_set_id);
203 layout->AddView(del_cookies_checkbox_); 208 layout->AddView(del_cookies_checkbox_);
204 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 209 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
205 210
206 layout->StartRow(0, indented_column_set_id); 211 layout->StartRow(0, indented_column_set_id);
207 layout->AddView(del_passwords_checkbox_); 212 layout->AddView(del_passwords_checkbox_);
208 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 213 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
209 214
210 layout->StartRow(0, indented_column_set_id); 215 layout->StartRow(0, indented_column_set_id);
216 layout->AddView(del_lso_data_checkbox_);
217 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
218
219 layout->StartRow(0, indented_column_set_id);
211 layout->AddView(del_form_data_checkbox_); 220 layout->AddView(del_form_data_checkbox_);
212 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 221 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
213 222
214 // Time period label is next below the combo boxes followed by time 223 // Time period label is next below the combo boxes followed by time
215 // period combo box 224 // period combo box
216 layout->StartRow(0, two_column_set_id); 225 layout->StartRow(0, two_column_set_id);
217 layout->AddView(time_period_label_); 226 layout->AddView(time_period_label_);
218 time_period_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 227 time_period_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
219 layout->AddView(time_period_combobox_, 1, 1, views::GridLayout::LEADING, 228 layout->AddView(time_period_combobox_, 1, 1, views::GridLayout::LEADING,
220 views::GridLayout::CENTER); 229 views::GridLayout::CENTER);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory, 277 profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory,
269 del_history_checkbox_->checked() ? true : false); 278 del_history_checkbox_->checked() ? true : false);
270 profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory, 279 profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory,
271 del_downloads_checkbox_->checked() ? true : false); 280 del_downloads_checkbox_->checked() ? true : false);
272 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache, 281 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache,
273 del_cache_checkbox_->checked() ? true : false); 282 del_cache_checkbox_->checked() ? true : false);
274 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies, 283 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies,
275 del_cookies_checkbox_->checked() ? true : false); 284 del_cookies_checkbox_->checked() ? true : false);
276 profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords, 285 profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords,
277 del_passwords_checkbox_->checked() ? true : false); 286 del_passwords_checkbox_->checked() ? true : false);
287 profile_->GetPrefs()->SetBoolean(prefs::kDeleteLSOData,
288 del_lso_data_checkbox_->checked() ? true : false);
278 profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData, 289 profile_->GetPrefs()->SetBoolean(prefs::kDeleteFormData,
279 del_form_data_checkbox_->checked() ? true : false); 290 del_form_data_checkbox_->checked() ? true : false);
280 clear_data_parent_window_->StartClearingBrowsingData(); 291 clear_data_parent_window_->StartClearingBrowsingData();
281 OnDelete(); 292 OnDelete();
282 } 293 }
283 294
284 // When no checkbox is checked we should not have the action button enabled. 295 // When no checkbox is checked we should not have the action button enabled.
285 // This forces the button to evaluate what state they should be in. 296 // This forces the button to evaluate what state they should be in.
286 UpdateControlEnabledState(); 297 UpdateControlEnabledState();
287 } 298 }
(...skipping 16 matching lines...) Expand all
304 checkbox->set_listener(this); 315 checkbox->set_listener(this);
305 return checkbox; 316 return checkbox;
306 } 317 }
307 318
308 void ClearBrowsingDataView2::UpdateControlEnabledState() { 319 void ClearBrowsingDataView2::UpdateControlEnabledState() {
309 del_history_checkbox_->SetEnabled(!delete_in_progress_); 320 del_history_checkbox_->SetEnabled(!delete_in_progress_);
310 del_downloads_checkbox_->SetEnabled(!delete_in_progress_); 321 del_downloads_checkbox_->SetEnabled(!delete_in_progress_);
311 del_cache_checkbox_->SetEnabled(!delete_in_progress_); 322 del_cache_checkbox_->SetEnabled(!delete_in_progress_);
312 del_cookies_checkbox_->SetEnabled(!delete_in_progress_); 323 del_cookies_checkbox_->SetEnabled(!delete_in_progress_);
313 del_passwords_checkbox_->SetEnabled(!delete_in_progress_); 324 del_passwords_checkbox_->SetEnabled(!delete_in_progress_);
325 del_lso_data_checkbox_->SetEnabled(!delete_in_progress_);
314 del_form_data_checkbox_->SetEnabled(!delete_in_progress_); 326 del_form_data_checkbox_->SetEnabled(!delete_in_progress_);
315 time_period_combobox_->SetEnabled(!delete_in_progress_); 327 time_period_combobox_->SetEnabled(!delete_in_progress_);
316 328
317 status_label_->SetVisible(delete_in_progress_); 329 status_label_->SetVisible(delete_in_progress_);
318 throbber_->SetVisible(delete_in_progress_); 330 throbber_->SetVisible(delete_in_progress_);
319 if (delete_in_progress_) 331 if (delete_in_progress_)
320 throbber_->Start(); 332 throbber_->Start();
321 else 333 else
322 throbber_->Stop(); 334 throbber_->Stop();
323 335
324 clear_browsing_data_button_->SetEnabled( 336 clear_browsing_data_button_->SetEnabled(
325 allow_clear_ && 337 allow_clear_ &&
326 !delete_in_progress_ && 338 !delete_in_progress_ &&
327 (del_history_checkbox_->checked() || 339 (del_history_checkbox_->checked() ||
328 del_downloads_checkbox_->checked() || 340 del_downloads_checkbox_->checked() ||
329 del_cache_checkbox_->checked() || 341 del_cache_checkbox_->checked() ||
330 del_cookies_checkbox_->checked() || 342 del_cookies_checkbox_->checked() ||
331 del_passwords_checkbox_->checked() || 343 del_passwords_checkbox_->checked() ||
344 del_lso_data_checkbox_->checked() ||
332 del_form_data_checkbox_->checked())); 345 del_form_data_checkbox_->checked()));
333 } 346 }
334 347
335 // Convenience method that returns true if the supplied checkbox is selected 348 // Convenience method that returns true if the supplied checkbox is selected
336 // and enabled. 349 // and enabled.
337 static bool IsCheckBoxEnabledAndSelected(views::Checkbox* cb) { 350 static bool IsCheckBoxEnabledAndSelected(views::Checkbox* cb) {
338 return (cb->IsEnabled() && cb->checked()); 351 return (cb->IsEnabled() && cb->checked());
339 } 352 }
340 353
341 void ClearBrowsingDataView2::OnDelete() { 354 void ClearBrowsingDataView2::OnDelete() {
342 int period_selected = time_period_combobox_->selected_item(); 355 int period_selected = time_period_combobox_->selected_item();
343 356
344 int remove_mask = 0; 357 int remove_mask = 0;
345 if (IsCheckBoxEnabledAndSelected(del_history_checkbox_)) 358 if (IsCheckBoxEnabledAndSelected(del_history_checkbox_))
346 remove_mask |= BrowsingDataRemover::REMOVE_HISTORY; 359 remove_mask |= BrowsingDataRemover::REMOVE_HISTORY;
347 if (IsCheckBoxEnabledAndSelected(del_downloads_checkbox_)) 360 if (IsCheckBoxEnabledAndSelected(del_downloads_checkbox_))
348 remove_mask |= BrowsingDataRemover::REMOVE_DOWNLOADS; 361 remove_mask |= BrowsingDataRemover::REMOVE_DOWNLOADS;
349 if (IsCheckBoxEnabledAndSelected(del_cookies_checkbox_)) 362 if (IsCheckBoxEnabledAndSelected(del_cookies_checkbox_))
350 remove_mask |= BrowsingDataRemover::REMOVE_COOKIES; 363 remove_mask |= BrowsingDataRemover::REMOVE_COOKIES;
351 if (IsCheckBoxEnabledAndSelected(del_passwords_checkbox_)) 364 if (IsCheckBoxEnabledAndSelected(del_passwords_checkbox_))
352 remove_mask |= BrowsingDataRemover::REMOVE_PASSWORDS; 365 remove_mask |= BrowsingDataRemover::REMOVE_PASSWORDS;
366 if (IsCheckBoxEnabledAndSelected(del_lso_data_checkbox_))
367 remove_mask |= BrowsingDataRemover::REMOVE_LSO_DATA;
353 if (IsCheckBoxEnabledAndSelected(del_form_data_checkbox_)) 368 if (IsCheckBoxEnabledAndSelected(del_form_data_checkbox_))
354 remove_mask |= BrowsingDataRemover::REMOVE_FORM_DATA; 369 remove_mask |= BrowsingDataRemover::REMOVE_FORM_DATA;
355 if (IsCheckBoxEnabledAndSelected(del_cache_checkbox_)) 370 if (IsCheckBoxEnabledAndSelected(del_cache_checkbox_))
356 remove_mask |= BrowsingDataRemover::REMOVE_CACHE; 371 remove_mask |= BrowsingDataRemover::REMOVE_CACHE;
357 372
358 delete_in_progress_ = true; 373 delete_in_progress_ = true;
359 UpdateControlEnabledState(); 374 UpdateControlEnabledState();
360 375
361 // BrowsingDataRemover deletes itself when done. 376 // BrowsingDataRemover deletes itself when done.
362 remover_ = new BrowsingDataRemover(profile_, 377 remover_ = new BrowsingDataRemover(profile_,
363 static_cast<BrowsingDataRemover::TimePeriod>(period_selected), 378 static_cast<BrowsingDataRemover::TimePeriod>(period_selected),
364 base::Time()); 379 base::Time());
365 remover_->AddObserver(this); 380 remover_->AddObserver(this);
366 remover_->Remove(remove_mask); 381 remover_->Remove(remove_mask);
367 } 382 }
368 383
369 void ClearBrowsingDataView2::OnBrowsingDataRemoverDone() { 384 void ClearBrowsingDataView2::OnBrowsingDataRemoverDone() {
370 clear_data_parent_window_->StopClearingBrowsingData(); 385 clear_data_parent_window_->StopClearingBrowsingData();
371 } 386 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/clear_browsing_data_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698