| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Implementation of DeleteChromeHistory | |
| 6 #include "chrome_frame/delete_chrome_history.h" | |
| 7 | |
| 8 #include "chrome/browser/browsing_data/browsing_data_remover.h" | |
| 9 | |
| 10 #include "base/win/windows_version.h" | |
| 11 #include "chrome_frame/chrome_frame_activex.h" | |
| 12 #include "chrome_frame/utils.h" | |
| 13 | |
| 14 // Below other header to avoid symbol pollution. | |
| 15 #define INITGUID | |
| 16 #include <deletebrowsinghistory.h> | |
| 17 | |
| 18 DeleteChromeHistory::DeleteChromeHistory() | |
| 19 : remove_mask_(0) { | |
| 20 DVLOG(1) << __FUNCTION__; | |
| 21 } | |
| 22 | |
| 23 DeleteChromeHistory::~DeleteChromeHistory() { | |
| 24 } | |
| 25 | |
| 26 | |
| 27 HRESULT DeleteChromeHistory::FinalConstruct() { | |
| 28 DVLOG(1) << __FUNCTION__; | |
| 29 Initialize(); | |
| 30 return S_OK; | |
| 31 } | |
| 32 | |
| 33 void DeleteChromeHistory::OnAutomationServerReady() { | |
| 34 } | |
| 35 | |
| 36 void DeleteChromeHistory::OnAutomationServerLaunchFailed( | |
| 37 AutomationLaunchResult reason, const std::string& server_version) { | |
| 38 DLOG(WARNING) << __FUNCTION__; | |
| 39 loop_.Quit(); | |
| 40 } | |
| 41 | |
| 42 void DeleteChromeHistory::GetProfilePath(const std::wstring& profile_name, | |
| 43 base::FilePath* profile_path) { | |
| 44 ChromeFramePlugin::GetProfilePath(kIexploreProfileName, profile_path); | |
| 45 } | |
| 46 | |
| 47 STDMETHODIMP DeleteChromeHistory::DeleteBrowsingHistory(DWORD flags) { | |
| 48 DVLOG(1) << __FUNCTION__; | |
| 49 // Usually called inside a quick startup/tear-down routine by RunDLL32. You | |
| 50 // can simulate the process by calling: | |
| 51 // RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 | |
| 52 // Since automation setup isn't synchronous, we can be tearing down while | |
| 53 // being only partially set-up, causing even synchronous IPCs to be dropped. | |
| 54 // Since the *Chrome* startup/tear-down occurs synchronously from the | |
| 55 // perspective of automation, we can add a flag to the chrome.exe invocation | |
| 56 // in lieu of sending an IPC when it seems appropriate. Since we assume this | |
| 57 // happens in one-off fashion, don't attempt to pack REMOVE_* arguments. | |
| 58 // Instead, have the browser process clobber all history. | |
| 59 // | |
| 60 // IE8 on Vista launches us twice when the user asks to delete browsing data - | |
| 61 // once in low integrity and once in medium integrity. The low integrity | |
| 62 // instance will fail to connect to the automation server and restart it in an | |
| 63 // effort to connect. Thus, we detect if we are in that circumstance and exit | |
| 64 // silently. | |
| 65 base::IntegrityLevel integrity_level; | |
| 66 if (base::win::GetVersion() >= base::win::VERSION_VISTA && | |
| 67 !base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), | |
| 68 &integrity_level)) { | |
| 69 return E_UNEXPECTED; | |
| 70 } | |
| 71 if (integrity_level == base::LOW_INTEGRITY) { | |
| 72 return S_OK; | |
| 73 } | |
| 74 if (!InitializeAutomation(GetHostProcessName(false), false, false, | |
| 75 GURL(), GURL(), true)) { | |
| 76 return E_UNEXPECTED; | |
| 77 } | |
| 78 | |
| 79 if (flags & DELETE_BROWSING_HISTORY_COOKIES) | |
| 80 remove_mask_ |= BrowsingDataRemover::REMOVE_SITE_DATA; | |
| 81 if (flags & DELETE_BROWSING_HISTORY_TIF) | |
| 82 remove_mask_ |= BrowsingDataRemover::REMOVE_CACHE; | |
| 83 if (flags & DELETE_BROWSING_HISTORY_FORMDATA) | |
| 84 remove_mask_ |= BrowsingDataRemover::REMOVE_FORM_DATA; | |
| 85 if (flags & DELETE_BROWSING_HISTORY_PASSWORDS) | |
| 86 remove_mask_ |= BrowsingDataRemover::REMOVE_PASSWORDS; | |
| 87 if (flags & DELETE_BROWSING_HISTORY_HISTORY) | |
| 88 remove_mask_ |= BrowsingDataRemover::REMOVE_HISTORY; | |
| 89 | |
| 90 loop_.PostDelayedTask(FROM_HERE, | |
| 91 base::MessageLoop::QuitClosure(), base::TimeDelta::FromMinutes(10)); | |
| 92 loop_.base::MessageLoop::Run(); | |
| 93 | |
| 94 return S_OK; | |
| 95 } | |
| 96 | |
| 97 | |
| OLD | NEW |