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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10806034: Ability to clear old history Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 // Sample json output: {} 3623 // Sample json output: {}
3624 void TestingAutomationProvider::ClearBrowsingData( 3624 void TestingAutomationProvider::ClearBrowsingData(
3625 Browser* browser, 3625 Browser* browser,
3626 DictionaryValue* args, 3626 DictionaryValue* args,
3627 IPC::Message* reply_message) { 3627 IPC::Message* reply_message) {
3628 std::map<std::string, BrowsingDataRemover::TimePeriod> string_to_time_period; 3628 std::map<std::string, BrowsingDataRemover::TimePeriod> string_to_time_period;
3629 string_to_time_period["LAST_HOUR"] = BrowsingDataRemover::LAST_HOUR; 3629 string_to_time_period["LAST_HOUR"] = BrowsingDataRemover::LAST_HOUR;
3630 string_to_time_period["LAST_DAY"] = BrowsingDataRemover::LAST_DAY; 3630 string_to_time_period["LAST_DAY"] = BrowsingDataRemover::LAST_DAY;
3631 string_to_time_period["LAST_WEEK"] = BrowsingDataRemover::LAST_WEEK; 3631 string_to_time_period["LAST_WEEK"] = BrowsingDataRemover::LAST_WEEK;
3632 string_to_time_period["FOUR_WEEKS"] = BrowsingDataRemover::FOUR_WEEKS; 3632 string_to_time_period["FOUR_WEEKS"] = BrowsingDataRemover::FOUR_WEEKS;
3633 string_to_time_period["EXCEPT_LAST_HOUR"] =
3634 BrowsingDataRemover::EXCEPT_LAST_HOUR;
3635 string_to_time_period["EXCEPT_LAST_DAY"] =
3636 BrowsingDataRemover::EXCEPT_LAST_DAY;
3637 string_to_time_period["EXCEPT_LAST_WEEK"] =
3638 BrowsingDataRemover::EXCEPT_LAST_WEEK;
3639 string_to_time_period["EXCEPT_FOUR_WEEKS"] =
3640 BrowsingDataRemover::EXCEPT_FOUR_WEEKS;
3633 string_to_time_period["EVERYTHING"] = BrowsingDataRemover::EVERYTHING; 3641 string_to_time_period["EVERYTHING"] = BrowsingDataRemover::EVERYTHING;
3634 3642
3635 std::map<std::string, int> string_to_mask_value; 3643 std::map<std::string, int> string_to_mask_value;
3636 string_to_mask_value["HISTORY"] = BrowsingDataRemover::REMOVE_HISTORY; 3644 string_to_mask_value["HISTORY"] = BrowsingDataRemover::REMOVE_HISTORY;
3637 string_to_mask_value["DOWNLOADS"] = BrowsingDataRemover::REMOVE_DOWNLOADS; 3645 string_to_mask_value["DOWNLOADS"] = BrowsingDataRemover::REMOVE_DOWNLOADS;
3638 string_to_mask_value["COOKIES"] = BrowsingDataRemover::REMOVE_SITE_DATA; 3646 string_to_mask_value["COOKIES"] = BrowsingDataRemover::REMOVE_SITE_DATA;
3639 string_to_mask_value["PASSWORDS"] = BrowsingDataRemover::REMOVE_PASSWORDS; 3647 string_to_mask_value["PASSWORDS"] = BrowsingDataRemover::REMOVE_PASSWORDS;
3640 string_to_mask_value["FORM_DATA"] = BrowsingDataRemover::REMOVE_FORM_DATA; 3648 string_to_mask_value["FORM_DATA"] = BrowsingDataRemover::REMOVE_FORM_DATA;
3641 string_to_mask_value["CACHE"] = BrowsingDataRemover::REMOVE_CACHE; 3649 string_to_mask_value["CACHE"] = BrowsingDataRemover::REMOVE_CACHE;
3642 3650
(...skipping 20 matching lines...) Expand all
3663 remove_mask |= string_to_mask_value[removal]; 3671 remove_mask |= string_to_mask_value[removal];
3664 } 3672 }
3665 3673
3666 if (!ContainsKey(string_to_time_period, time_period)) { 3674 if (!ContainsKey(string_to_time_period, time_period)) {
3667 AutomationJSONReply(this, reply_message) 3675 AutomationJSONReply(this, reply_message)
3668 .SendError("Invalid string for time_period."); 3676 .SendError("Invalid string for time_period.");
3669 return; 3677 return;
3670 } 3678 }
3671 3679
3672 BrowsingDataRemover* remover = new BrowsingDataRemover( 3680 BrowsingDataRemover* remover = new BrowsingDataRemover(
3673 profile(), string_to_time_period[time_period], base::Time()); 3681 profile(), string_to_time_period[time_period]);
3674 3682
3675 remover->AddObserver( 3683 remover->AddObserver(
3676 new AutomationProviderBrowsingDataObserver(this, reply_message)); 3684 new AutomationProviderBrowsingDataObserver(this, reply_message));
3677 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB); 3685 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB);
3678 // BrowsingDataRemover deletes itself using DeleteHelper. 3686 // BrowsingDataRemover deletes itself using DeleteHelper.
3679 // The observer also deletes itself after sending the reply. 3687 // The observer also deletes itself after sending the reply.
3680 } 3688 }
3681 3689
3682 namespace { 3690 namespace {
3683 3691
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after
6751 void TestingAutomationProvider::OnRemoveProvider() { 6759 void TestingAutomationProvider::OnRemoveProvider() {
6752 if (g_browser_process) 6760 if (g_browser_process)
6753 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6761 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6754 } 6762 }
6755 6763
6756 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 6764 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
6757 WebContents* tab) { 6765 WebContents* tab) {
6758 if (chrome::GetActiveWebContents(browser) != tab) 6766 if (chrome::GetActiveWebContents(browser) != tab)
6759 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); 6767 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true);
6760 } 6768 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/browsing_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698