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

Side by Side Diff: chrome/browser/views/clear_browsing_data.cc

Issue 3014: Google Chrome doesn't remember settings for 'Clear browing data'. Added preferences for the clear b (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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/browser.cc ('k') | chrome/common/pref_names.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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.h" 5 #include "chrome/browser/views/clear_browsing_data.h"
6 6
7 #include "chrome/app/locales/locale_settings.h" 7 #include "chrome/app/locales/locale_settings.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/standard_layout.h" 9 #include "chrome/browser/standard_layout.h"
10 #include "chrome/browser/template_url_model.h" 10 #include "chrome/browser/template_url_model.h"
11 #include "chrome/common/l10n_util.h" 11 #include "chrome/common/l10n_util.h"
12 #include "chrome/views/background.h" 12 #include "chrome/views/background.h"
13 #include "chrome/views/checkbox.h" 13 #include "chrome/views/checkbox.h"
14 #include "chrome/views/label.h" 14 #include "chrome/views/label.h"
15 #include "chrome/views/native_button.h" 15 #include "chrome/views/native_button.h"
16 #include "chrome/views/throbber.h" 16 #include "chrome/views/throbber.h"
17 #include "chrome/views/window.h" 17 #include "chrome/views/window.h"
18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/pref_service.h"
18 #include "net/url_request/url_request_context.h" 20 #include "net/url_request/url_request_context.h"
19 21
20 #include "generated_resources.h" 22 #include "generated_resources.h"
21 23
22 // The combo box is vertically aligned to the 'time-period' label, which makes 24 // The combo box is vertically aligned to the 'time-period' label, which makes
23 // the combo box look a little too close to the check box above it when we use 25 // the combo box look a little too close to the check box above it when we use
24 // standard layout to separate them. We therefore add a little extra margin to 26 // standard layout to separate them. We therefore add a little extra margin to
25 // the label, giving it a little breathing space. 27 // the label, giving it a little breathing space.
26 static const int kExtraMarginForTimePeriodLabel = 3; 28 static const int kExtraMarginForTimePeriodLabel = 3;
27 29
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 status_label_.SetVisible(false); 65 status_label_.SetVisible(false);
64 status_label_.SetParentOwned(false); 66 status_label_.SetParentOwned(false);
65 67
66 // Regular view controls we draw by ourself. First, we add the dialog label. 68 // Regular view controls we draw by ourself. First, we add the dialog label.
67 delete_all_label_ = new ChromeViews::Label( 69 delete_all_label_ = new ChromeViews::Label(
68 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL)); 70 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL));
69 AddChildView(delete_all_label_); 71 AddChildView(delete_all_label_);
70 72
71 // Add all the check-boxes. 73 // Add all the check-boxes.
72 del_history_checkbox_ = 74 del_history_checkbox_ =
73 AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX), true); 75 AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX),
76 profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory));
74 77
75 del_downloads_checkbox_ = 78 del_downloads_checkbox_ =
76 AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX), true); 79 AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX),
80 profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory));
77 81
78 del_cache_checkbox_ = 82 del_cache_checkbox_ =
79 AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX), true); 83 AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX),
84 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache));
80 85
81 del_cookies_checkbox_ = 86 del_cookies_checkbox_ =
82 AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX), true); 87 AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX),
88 profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies));
83 89
84 del_passwords_checkbox_ = 90 del_passwords_checkbox_ =
85 AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX), false); 91 AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX),
92 profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords));
86 93
87 // Add a label which appears before the combo box for the time period. 94 // Add a label which appears before the combo box for the time period.
88 time_period_label_ = new ChromeViews::Label( 95 time_period_label_ = new ChromeViews::Label(
89 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL)); 96 l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL));
90 AddChildView(time_period_label_); 97 AddChildView(time_period_label_);
91 98
92 // Add the combo box showing how far back in time we want to delete. 99 // Add the combo box showing how far back in time we want to delete.
93 time_period_combobox_ = new ChromeViews::ComboBox(this); 100 time_period_combobox_ = new ChromeViews::ComboBox(this);
94 AddChildView(time_period_combobox_); 101 AddChildView(time_period_combobox_);
95 } 102 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 case 3: return l10n_util::GetString(IDS_CLEAR_DATA_EVERYTHING); 302 case 3: return l10n_util::GetString(IDS_CLEAR_DATA_EVERYTHING);
296 default: NOTREACHED() << L"Missing item"; 303 default: NOTREACHED() << L"Missing item";
297 return L"?"; 304 return L"?";
298 } 305 }
299 } 306 }
300 307
301 //////////////////////////////////////////////////////////////////////////////// 308 ////////////////////////////////////////////////////////////////////////////////
302 // ClearBrowsingDataView, ChromeViews::ButtonListener implementation: 309 // ClearBrowsingDataView, ChromeViews::ButtonListener implementation:
303 310
304 void ClearBrowsingDataView::ButtonPressed(ChromeViews::NativeButton* sender) { 311 void ClearBrowsingDataView::ButtonPressed(ChromeViews::NativeButton* sender) {
312 if (sender == del_history_checkbox_)
313 profile_->GetPrefs()->SetBoolean(prefs::kDeleteBrowsingHistory,
314 del_history_checkbox_->IsSelected() ? true : false);
315 else if (sender == del_downloads_checkbox_)
316 profile_->GetPrefs()->SetBoolean(prefs::kDeleteDownloadHistory,
317 del_downloads_checkbox_->IsSelected() ? true : false);
318 else if (sender == del_cache_checkbox_)
319 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCache,
320 del_cache_checkbox_->IsSelected() ? true : false);
321 else if (sender == del_cookies_checkbox_)
322 profile_->GetPrefs()->SetBoolean(prefs::kDeleteCookies,
323 del_cookies_checkbox_->IsSelected() ? true : false);
324 else if (sender == del_passwords_checkbox_)
325 profile_->GetPrefs()->SetBoolean(prefs::kDeletePasswords,
326 del_passwords_checkbox_->IsSelected() ? true : false);
327
305 // When no checkbox is checked we should not have the action button enabled. 328 // When no checkbox is checked we should not have the action button enabled.
306 // This forces the button to evaluate what state they should be in. 329 // This forces the button to evaluate what state they should be in.
307 GetDialogClientView()->UpdateDialogButtons(); 330 GetDialogClientView()->UpdateDialogButtons();
308 } 331 }
309 332
310 //////////////////////////////////////////////////////////////////////////////// 333 ////////////////////////////////////////////////////////////////////////////////
311 // ClearBrowsingDataView, private: 334 // ClearBrowsingDataView, private:
312 335
313 ChromeViews::CheckBox* ClearBrowsingDataView::AddCheckbox( 336 ChromeViews::CheckBox* ClearBrowsingDataView::AddCheckbox(
314 const std::wstring& text, bool checked) { 337 const std::wstring& text, bool checked) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 remover_->Remove(remove_mask); 406 remover_->Remove(remove_mask);
384 } 407 }
385 408
386 void ClearBrowsingDataView::OnBrowsingDataRemoverDone() { 409 void ClearBrowsingDataView::OnBrowsingDataRemoverDone() {
387 // No need to remove ourselves as an observer as BrowsingDataRemover deletes 410 // No need to remove ourselves as an observer as BrowsingDataRemover deletes
388 // itself after we return. 411 // itself after we return.
389 remover_ = NULL; 412 remover_ = NULL;
390 window()->Close(); 413 window()->Close();
391 } 414 }
392 415
OLDNEW
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698