| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/views/clear_browsing_data.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string16.h" |
| 9 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 10 #include "chrome/browser/pref_service.h" | 12 #include "chrome/browser/pref_service.h" |
| 11 #include "chrome/browser/profile.h" | 13 #include "chrome/browser/profile.h" |
| 12 #include "chrome/browser/search_engines/template_url_model.h" | 14 #include "chrome/browser/search_engines/template_url_model.h" |
| 13 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 14 #include "gfx/insets.h" | 16 #include "gfx/insets.h" |
| 15 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 16 #include "grit/locale_settings.h" | 18 #include "grit/locale_settings.h" |
| 17 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 return client_view; | 332 return client_view; |
| 331 } | 333 } |
| 332 | 334 |
| 333 //////////////////////////////////////////////////////////////////////////////// | 335 //////////////////////////////////////////////////////////////////////////////// |
| 334 // ClearBrowsingDataView, ComboboxModel implementation: | 336 // ClearBrowsingDataView, ComboboxModel implementation: |
| 335 | 337 |
| 336 int ClearBrowsingDataView::GetItemCount() { | 338 int ClearBrowsingDataView::GetItemCount() { |
| 337 return 5; | 339 return 5; |
| 338 } | 340 } |
| 339 | 341 |
| 340 std::wstring ClearBrowsingDataView::GetItemAt(int index) { | 342 string16 ClearBrowsingDataView::GetItemAt(int index) { |
| 341 switch (index) { | 343 switch (index) { |
| 342 case 0: return l10n_util::GetString(IDS_CLEAR_DATA_HOUR); | 344 case 0: return l10n_util::GetStringUTF16(IDS_CLEAR_DATA_HOUR); |
| 343 case 1: return l10n_util::GetString(IDS_CLEAR_DATA_DAY); | 345 case 1: return l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DAY); |
| 344 case 2: return l10n_util::GetString(IDS_CLEAR_DATA_WEEK); | 346 case 2: return l10n_util::GetStringUTF16(IDS_CLEAR_DATA_WEEK); |
| 345 case 3: return l10n_util::GetString(IDS_CLEAR_DATA_4WEEKS); | 347 case 3: return l10n_util::GetStringUTF16(IDS_CLEAR_DATA_4WEEKS); |
| 346 case 4: return l10n_util::GetString(IDS_CLEAR_DATA_EVERYTHING); | 348 case 4: return l10n_util::GetStringUTF16(IDS_CLEAR_DATA_EVERYTHING); |
| 347 default: NOTREACHED() << L"Missing item"; | 349 default: NOTREACHED() << "Missing item"; |
| 348 return L"?"; | 350 return ASCIIToUTF16("?"); |
| 349 } | 351 } |
| 350 } | 352 } |
| 351 | 353 |
| 352 //////////////////////////////////////////////////////////////////////////////// | 354 //////////////////////////////////////////////////////////////////////////////// |
| 353 // ClearBrowsingDataView, views::ComboBoxListener implementation: | 355 // ClearBrowsingDataView, views::ComboBoxListener implementation: |
| 354 | 356 |
| 355 void ClearBrowsingDataView::ItemChanged(views::Combobox* sender, | 357 void ClearBrowsingDataView::ItemChanged(views::Combobox* sender, |
| 356 int prev_index, int new_index) { | 358 int prev_index, int new_index) { |
| 357 if (sender == time_period_combobox_ && prev_index != new_index) | 359 if (sender == time_period_combobox_ && prev_index != new_index) |
| 358 profile_->GetPrefs()->SetInteger(prefs::kDeleteTimePeriod, new_index); | 360 profile_->GetPrefs()->SetInteger(prefs::kDeleteTimePeriod, new_index); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 remover_->AddObserver(this); | 464 remover_->AddObserver(this); |
| 463 remover_->Remove(remove_mask); | 465 remover_->Remove(remove_mask); |
| 464 } | 466 } |
| 465 | 467 |
| 466 void ClearBrowsingDataView::OnBrowsingDataRemoverDone() { | 468 void ClearBrowsingDataView::OnBrowsingDataRemoverDone() { |
| 467 // No need to remove ourselves as an observer as BrowsingDataRemover deletes | 469 // No need to remove ourselves as an observer as BrowsingDataRemover deletes |
| 468 // itself after we return. | 470 // itself after we return. |
| 469 remover_ = NULL; | 471 remover_ = NULL; |
| 470 window()->Close(); | 472 window()->Close(); |
| 471 } | 473 } |
| OLD | NEW |