diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 23:16:39 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 23:16:39 +0000 |
commit | 141c26dd8d4fea199546db1cb7b3c6644fff0e06 (patch) | |
tree | 3f6faec7cc978241322807d6fa46462380fe2605 /chrome_frame | |
parent | 1522387612c182c053c952dd2764c4d417ba87d9 (diff) | |
download | chromium_src-141c26dd8d4fea199546db1cb7b3c6644fff0e06.zip chromium_src-141c26dd8d4fea199546db1cb7b3c6644fff0e06.tar.gz chromium_src-141c26dd8d4fea199546db1cb7b3c6644fff0e06.tar.bz2 |
Reverting this CL to see if this fixes chrome frame unit test failures.
Revert 42684 - Implements IDeleteBrowsing history and moves the GCF profile into the IE TIF directory for nonpriv mode users on IE < 8.
Implementation notes:
Earlier work enabled InPrivate browsing detection and mapped it to creation of an incognito profile instance.Privacy features and how they operate with this change:
"Delete Browsing History":
IE 6 & 7: all history (including databases) is deleted if cache is cleared *WITHOUT* an active Chrome process holding references to the profile resources. If GCF is rendering a page when the cache is cleared, history *WILL NOT* be deleted on the GCF side, however GCF will continue to operate and IE will remove all other history artifacts as usual.
IE 8: GCF cache is cleared in alignment with the options specified by the user. Clearing Temporary Internet Files may destroy the profile entirely, and so we need to consider not moving the GCF profile on IE 8.
"InPrivate Filtering":
IE 8 (only): more testing required.
"InPrivate Browsing":
IE 8 (only): pages rendered in GCF *after* entering InPrivate mode are not persisted to disk (use an incognito wrapper on the specified profile). Currently displayed pages are not effected by the switch, although refreshing them will invoke the new behavior. Generally speaking, BHO's are disabled by IE 8 while in InPrivate mode, so entering this state is wonky to begin with but we handle it as well as can be expected.
BUG=22846
TEST=On IE 8, clear the cache entirely, note GCF entries in DbgView (better tests coming)
Review URL: http://codereview.chromium.org/858003
TBR=slightlyoff@chromium.org
Review URL: http://codereview.chromium.org/1353002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42691 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/bho.h | 14 | ||||
-rw-r--r-- | chrome_frame/bho.rgs | 49 | ||||
-rw-r--r-- | chrome_frame/chrome_frame.gyp | 10 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_activex_base.h | 39 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.cc | 36 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_automation.h | 8 | ||||
-rw-r--r-- | chrome_frame/chrome_frame_plugin.h | 15 | ||||
-rw-r--r-- | chrome_frame/delete_chrome_history.cc | 82 | ||||
-rw-r--r-- | chrome_frame/delete_chrome_history.h | 65 | ||||
-rw-r--r-- | chrome_frame/test/automation_client_mock.cc | 33 | ||||
-rw-r--r-- | chrome_frame/test/automation_client_mock.h | 16 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_automation_mock.h | 8 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.cc | 11 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.h | 6 | ||||
-rw-r--r-- | chrome_frame/utils.cc | 29 | ||||
-rw-r--r-- | chrome_frame/utils.h | 3 |
16 files changed, 94 insertions, 330 deletions
diff --git a/chrome_frame/bho.h b/chrome_frame/bho.h index 430436b..9a36795 100644 --- a/chrome_frame/bho.h +++ b/chrome_frame/bho.h @@ -7,7 +7,6 @@ #include <atlbase.h> #include <atlcom.h> -#include <deletebrowsinghistory.h> #include <exdisp.h> #include <exdispid.h> #include <mshtml.h> @@ -17,14 +16,11 @@ #include "base/scoped_comptr_win.h" #include "chrome_tab.h" // NOLINT -#include "chrome_frame/delete_chrome_history.h" #include "chrome_frame/resource.h" #include "chrome_frame/urlmon_moniker.h" #include "chrome_frame/urlmon_url_request.h" #include "grit/chrome_frame_resources.h" -class DeleteChromeHistory; - class PatchHelper { public: enum State { UNKNOWN, PATCH_IBROWSER, PATCH_PROTOCOL }; @@ -59,18 +55,12 @@ class ATL_NO_VTABLE Bho IBrowserService* browser, IShellView* shell_view, BOOL done, VARIANT* in_arg, VARIANT* out_arg); -DECLARE_GET_CONTROLLING_UNKNOWN() DECLARE_REGISTRY_RESOURCEID(IDR_BHO) DECLARE_NOT_AGGREGATABLE(Bho) DECLARE_PROTECT_FINAL_CONSTRUCT() BEGIN_COM_MAP(Bho) COM_INTERFACE_ENTRY(IObjectWithSite) - // When calling DeleteChromeHistory, ensure that only one instance - // is created to avoid mulitple message loops. - COM_INTERFACE_ENTRY_CACHED_TEAR_OFF(IID_IDeleteBrowsingHistory, - DeleteChromeHistory, - delete_chrome_history_.p) END_COM_MAP() BEGIN_SINK_MAP(Bho) @@ -106,10 +96,6 @@ END_SINK_MAP() static void ProcessOptInUrls(IWebBrowser2* browser, BSTR url); - // COM_INTERFACE_ENTRY_CACHED_TEAR_OFF manages the raw pointer from CComPtr - // which ScopedComPtr doesn't expose. - CComPtr<IUnknown> delete_chrome_history_; - protected: bool PatchProtocolHandler(const CLSID& handler_clsid); diff --git a/chrome_frame/bho.rgs b/chrome_frame/bho.rgs index ba057a6..824fd7d 100644 --- a/chrome_frame/bho.rgs +++ b/chrome_frame/bho.rgs @@ -1,26 +1,23 @@ -HKLM { - NoRemove SOFTWARE { - NoRemove Classes { - ChromeFrame.Bho.1 = s 'Bho Class' { - CLSID = s '{ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7}' - } - ChromeFrame.Bho = s 'ChromeFrame BHO' { - CLSID = s '{ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7}' - CurVer = s 'ChromeFrame.Bho.1' - } - NoRemove CLSID { - ForceRemove {ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7} = s 'ChromeFrame BHO' { - ProgID = s 'ChromeFrame.Bho.1' - VersionIndependentProgID = s 'ChromeFrame.Bho' - InprocServer32 = s '%MODULE%' { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{6F2664E1-FF6E-488A-BCD1-F4CA6001DFCC}' - 'Implemented Categories' { - {31CAF6E4-D6AA-4090-A050-A5AC8972E9EF} - } - } - } - } - } -} +HKLM {
+ NoRemove SOFTWARE {
+ NoRemove Classes {
+ ChromeFrame.Bho.1 = s 'Bho Class' {
+ CLSID = s '{ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7}'
+ }
+ ChromeFrame.Bho = s 'ChromeFrame BHO' {
+ CLSID = s '{ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7}'
+ CurVer = s 'ChromeFrame.Bho.1'
+ }
+ NoRemove CLSID {
+ ForceRemove {ECB3C477-1A0A-44bd-BB57-78F9EFE34FA7} = s 'ChromeFrame BHO' {
+ ProgID = s 'ChromeFrame.Bho.1'
+ VersionIndependentProgID = s 'ChromeFrame.Bho'
+ InprocServer32 = s '%MODULE%' {
+ val ThreadingModel = s 'Apartment'
+ }
+ 'TypeLib' = s '{6F2664E1-FF6E-488A-BCD1-F4CA6001DFCC}'
+ }
+ }
+ }
+ }
+}
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index d0fc620..66514ef 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -1,4 +1,4 @@ -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -604,10 +604,10 @@ 'chrome_active_document.rgs', 'chrome_frame_activex.cc', 'chrome_frame_activex.h', - 'chrome_frame_activex.rgs', 'chrome_frame_activex_base.h', - 'chrome_frame_histograms.cc', + 'chrome_frame_activex.rgs', 'chrome_frame_histograms.h', + 'chrome_frame_histograms.cc', 'chrome_frame_reporting.cc', 'chrome_frame_reporting.h', 'chrome_protocol.cc', @@ -619,14 +619,12 @@ 'com_message_event.h', 'com_type_info_holder.cc', 'com_type_info_holder.h', - 'delete_chrome_history.cc', - 'delete_chrome_history.h', 'find_dialog.cc', 'find_dialog.h', 'function_stub.h', - 'http_negotiate.cc', 'function_stub.cc', 'http_negotiate.h', + 'http_negotiate.cc', 'iids.cc', 'in_place_menu.h', 'ole_document_impl.h', diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index 2b9d60d..d29eb65 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,21 @@ #include <atlcom.h> #include <atlctl.h> #include <wininet.h> + +// Copied min/max defs from windows headers to appease atlimage.h. +// TODO(slightlyoff): Figure out of more recent platform SDK's (> 6.1) +// undo the janky "#define NOMINMAX" train wreck. See: +// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100703 +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) // NOLINT +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) // NOLINT +#endif +#include <atlimage.h> +#undef max +#undef min + #include <shdeprecated.h> // for IBrowserService2 #include <shlguid.h> @@ -21,23 +36,19 @@ #include "base/scoped_variant_win.h" #include "base/string_util.h" #include "grit/chrome_frame_resources.h" -#include "chrome/common/url_constants.h" #include "chrome_frame/chrome_frame_plugin.h" #include "chrome_frame/com_message_event.h" #include "chrome_frame/com_type_info_holder.h" #include "chrome_frame/simple_resource_loader.h" #include "chrome_frame/urlmon_url_request.h" #include "chrome_frame/urlmon_url_request_private.h" -#include "chrome_frame/utils.h" +#include "chrome/common/url_constants.h" #include "grit/generated_resources.h" #include "net/base/cookie_monster.h" // Include without path to make GYP build see it. #include "chrome_tab.h" // NOLINT -static const wchar_t kIexploreProfileName[] = L"iexplore"; -static const wchar_t kRundllProfileName[] = L"rundll32"; - // Connection point class to support firing IChromeFrameEvents (dispinterface). template<class T> class ATL_NO_VTABLE ProxyDIChromeFrameEvents @@ -350,22 +361,6 @@ END_MSG_MAP() } protected: - virtual void GetProfilePath(const std::wstring& profile_name, - FilePath* profile_path) { - bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || - (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); - // Browsers without IDeleteBrowsingHistory in non-priv mode - // have their profiles moved into "Temporary Internet Files". - if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { - *profile_path = GetIETemporaryFilesFolder(); - *profile_path = profile_path->Append(L"Google Chrome Frame"); - } else { - ChromeFramePlugin::GetProfilePath(profile_name, profile_path); - } - DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); - } - - void OnLoad(int tab_handle, const GURL& url) { if (ready_state_ < READYSTATE_COMPLETE) { ready_state_ = READYSTATE_COMPLETE; diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index 8c1fb45..2c5d238 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,6 +19,8 @@ #include "base/waitable_event.h" #include "chrome/app/client_util.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome_frame/chrome_launcher.h" @@ -269,9 +271,20 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry, if (IsHeadlessMode()) command_line->AppendSwitch(switches::kFullMemoryCrashReport); - DLOG(INFO) << "Profile path: " << params.profile_path.value(); - command_line->AppendSwitchWithValue(switches::kUserDataDir, - params.profile_path.value()); + // Place the profile directory in + // "<chrome_exe_path>\..\User Data\<profile-name>" + if (!entry->profile_name.empty()) { + FilePath profile_path; + if (chrome::GetChromeFrameUserDataDirectory(&profile_path)) { + profile_path = profile_path.Append(entry->profile_name); + command_line->AppendSwitchWithValue(switches::kUserDataDir, + profile_path.value()); + } else { + // Can't get the profile dir :-( We need one to work, so fail. + // We have no code for launch failure. + entry->launch_result = AutomationLaunchResult(-1); + } + } std::wstring command_line_string(command_line->command_line_string()); // If there are any extra arguments, append them to the command line. @@ -326,6 +339,8 @@ void ProxyFactory::CreateProxy(ProxyFactory::ProxyCacheEntry* entry, } bool ProxyFactory::ReleaseAutomationServer(void* server_id) { + DLOG(INFO) << __FUNCTION__; + if (!server_id) { NOTREACHED(); return false; @@ -442,7 +457,7 @@ bool ChromeFrameAutomationClient::Initialize( ChromeFrameDelegate* chrome_frame_delegate, int automation_server_launch_timeout, bool perform_version_check, - const FilePath& profile_path, + const std::wstring& profile_name, const std::wstring& extra_chrome_arguments, bool incognito) { DCHECK(!IsWindow()); @@ -482,8 +497,7 @@ bool ChromeFrameAutomationClient::Initialize( chrome_launch_params_.automation_server_launch_timeout = automation_server_launch_timeout; - chrome_launch_params_.profile_path = profile_path; - chrome_launch_params_.profile_name = profile_path.BaseName().value(); + chrome_launch_params_.profile_name = profile_name; chrome_launch_params_.extra_chrome_arguments = extra_chrome_arguments; chrome_launch_params_.perform_version_check = perform_version_check; chrome_launch_params_.url = navigate_after_initialization_ ? GURL() : url_; @@ -497,6 +511,8 @@ bool ChromeFrameAutomationClient::Initialize( } void ChromeFrameAutomationClient::Uninitialize() { + DLOG(INFO) << __FUNCTION__; + if (init_state_ == UNINITIALIZED) { DLOG(WARNING) << __FUNCTION__ << ": Automation client not initialized"; return; @@ -914,7 +930,6 @@ void ChromeFrameAutomationClient::LaunchComplete( NULL, NULL, NULL); automation_server_->SendAsAsync(message, NewCallback(this, &ChromeFrameAutomationClient::CreateExternalTabComplete), this); - DLOG(INFO) << __FUNCTION__ << ": sending CreateExternalTabComplete"; } } } else { @@ -1084,6 +1099,7 @@ void ChromeFrameAutomationClient::SetParentWindow(HWND parent_window) { } void ChromeFrameAutomationClient::ReleaseAutomationServer() { + DLOG(INFO) << __FUNCTION__; if (automation_server_id_) { // Cache the server id and clear the automation_server_id_ before // calling ReleaseAutomationServer. The reason we do this is that @@ -1201,10 +1217,6 @@ void ChromeFrameAutomationClient::SetPageFontSize( new AutomationMsg_SetPageFontSize(0, tab_handle_, font_size)); } -void ChromeFrameAutomationClient::RemoveBrowsingData(int remove_mask) { - automation_server_->Send( - new AutomationMsg_RemoveBrowsingData(0, remove_mask)); -} ////////////////////////////////////////////////////////////////////////// // PluginUrlRequestDelegate implementation. diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index 8a7c54a..f01d1b4 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -88,7 +88,6 @@ struct ChromeFrameLaunchParams { std::wstring extra_chrome_arguments; bool perform_version_check; bool incognito_mode; - FilePath profile_path; }; // We must create and destroy automation proxy in a thread with a message loop. @@ -161,7 +160,7 @@ class ChromeFrameAutomationClient virtual bool Initialize(ChromeFrameDelegate* chrome_frame_delegate, int automation_server_launch_timeout, bool perform_version_check, - const FilePath& profile_path, + const std::wstring& profile_name, const std::wstring& extra_chrome_arguments, bool incognito); void Uninitialize(); @@ -263,9 +262,6 @@ class ChromeFrameAutomationClient void SetPageFontSize(enum AutomationPageFontSize); - // For IDeleteBrowsingHistorySupport - void RemoveBrowsingData(int remove_mask); - ChromeFrameAutomationProxy* automation_server() { return automation_server_; } diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h index 7f397e6..17fb6572 100644 --- a/chrome_frame/chrome_frame_plugin.h +++ b/chrome_frame/chrome_frame_plugin.h @@ -8,8 +8,6 @@ #include "base/ref_counted.h" #include "base/win_util.h" #include "chrome_frame/chrome_frame_automation.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_paths_internal.h" #include "chrome_frame/simple_resource_loader.h" #include "chrome_frame/utils.h" @@ -37,7 +35,6 @@ BEGIN_MSG_MAP(T) END_MSG_MAP() bool Initialize() { - DLOG(INFO) << __FUNCTION__; DCHECK(!automation_client_.get()); automation_client_ = CreateAutomationClient(); if (!automation_client_.get()) { @@ -49,7 +46,6 @@ END_MSG_MAP() } void Uninitialize() { - DLOG(INFO) << __FUNCTION__; if (IsValid()) { automation_client_->Uninitialize(); automation_client_ = NULL; @@ -63,10 +59,8 @@ END_MSG_MAP() // We don't want to do incognito when privileged, since we're // running in browser chrome or some other privileged context. bool incognito_mode = !is_privileged_ && incognito; - FilePath profile_path; - GetProfilePath(profile_name, &profile_path); return automation_client_->Initialize(this, kCommandExecutionTimeout, true, - profile_path, extra_chrome_arguments, + profile_name, extra_chrome_arguments, incognito_mode); } @@ -217,13 +211,6 @@ END_MSG_MAP() } } - virtual void GetProfilePath(const std::wstring& profile_name, - FilePath* profile_path) { - chrome::GetChromeFrameUserDataDirectory(profile_path); - *profile_path = profile_path->Append(profile_name); - DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); - } - protected: // Our gateway to chrome land scoped_refptr<ChromeFrameAutomationClient> automation_client_; diff --git a/chrome_frame/delete_chrome_history.cc b/chrome_frame/delete_chrome_history.cc deleted file mode 100644 index 994d609..0000000 --- a/chrome_frame/delete_chrome_history.cc +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Implementation of DeleteChromeHistory -#include "chrome_frame/delete_chrome_history.h" - -#include "chrome_frame/chrome_frame_activex.h" -#include "chrome/browser/browsing_data_remover.h" -#include "utils.h" - -// Below other header to avoid symbol pollution. -#define INITGUID -#include <deletebrowsinghistory.h> - -DeleteChromeHistory::DeleteChromeHistory() - : remove_mask_(0) { - DLOG(INFO) << __FUNCTION__; -} - -DeleteChromeHistory::~DeleteChromeHistory() { -} - - -HRESULT DeleteChromeHistory::FinalConstruct() { - DLOG(INFO) << __FUNCTION__; - Initialize(); - return S_OK; -} - -void DeleteChromeHistory::OnAutomationServerReady() { - DLOG(INFO) << __FUNCTION__; - automation_client_->RemoveBrowsingData(remove_mask_); - loop_.Quit(); -} - -void DeleteChromeHistory::OnAutomationServerLaunchFailed( - AutomationLaunchResult reason, const std::string& server_version) { - DLOG(WARNING) << __FUNCTION__; - loop_.Quit(); -} - -void DeleteChromeHistory::GetProfilePath(const std::wstring& profile_name, - FilePath* profile_path) { - ChromeFramePlugin::GetProfilePath(kIexploreProfileName, profile_path); -} - -STDMETHODIMP DeleteChromeHistory::DeleteBrowsingHistory(DWORD flags) { - DLOG(INFO) << __FUNCTION__; - // Usually called inside a quick startup/tear-down routine by RunDLL32. You - // can simulate the process by calling: - // RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255 - // Since automation setup isn't synchronous, we can be tearing down while - // being only partially set-up, causing even synchronous IPCs to be dropped. - // Since the *Chrome* startup/tear-down occurs synchronously from the - // perspective of automation, we can add a flag to the chrome.exe invocation - // in lieu of sending an IPC when it seems appropriate. Since we assume this - // happens in one-off fashion, don't attempt to pack REMOVE_* arguments. - // Instead, have the browser process clobber all history. - if (!InitializeAutomation(GetHostProcessName(false), L"", false)) { - return E_UNEXPECTED; - } - - if (flags & DELETE_BROWSING_HISTORY_COOKIES) - remove_mask_ |= BrowsingDataRemover::REMOVE_COOKIES; - if (flags & DELETE_BROWSING_HISTORY_TIF) - remove_mask_ |= BrowsingDataRemover::REMOVE_CACHE; - if (flags & DELETE_BROWSING_HISTORY_FORMDATA) - remove_mask_ |= BrowsingDataRemover::REMOVE_FORM_DATA; - if (flags & DELETE_BROWSING_HISTORY_PASSWORDS) - remove_mask_ |= BrowsingDataRemover::REMOVE_PASSWORDS; - if (flags & DELETE_BROWSING_HISTORY_HISTORY) - remove_mask_ |= BrowsingDataRemover::REMOVE_HISTORY; - - loop_.PostDelayedTask(FROM_HERE, - new MessageLoop::QuitTask, 1000 * 600); - loop_.MessageLoop::Run(); - - return S_OK; -} - - diff --git a/chrome_frame/delete_chrome_history.h b/chrome_frame/delete_chrome_history.h deleted file mode 100644 index 947f673..0000000 --- a/chrome_frame/delete_chrome_history.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_FRAME_DELETE_CHROME_HISTORY_H_ -#define CHROME_FRAME_DELETE_CHROME_HISTORY_H_ - -#include <atlbase.h> -#include <atlwin.h> -#include <atlcom.h> - -#include <deletebrowsinghistory.h> - -#include "base/message_loop.h" -#include "chrome_frame/bho.h" -#include "chrome_frame/chrome_frame_plugin.h" -#include "grit/chrome_frame_resources.h" - -// Include without path to make GYP build see it. -#include "chrome_tab.h" // NOLINT - -class Bho; - -// DeleteChromeHistory: Implements IDeleteBrowsingHistory and -// pumps cache clearing operations over automation. Blocks the UI -// thread while operating. You have been warned. -class ATL_NO_VTABLE DeleteChromeHistory - : public CComTearOffObjectBase<Bho, CComSingleThreadModel>, - public CWindowImpl<DeleteChromeHistory>, - public ChromeFramePlugin<DeleteChromeHistory>, - public IDeleteBrowsingHistory { - public: - DeleteChromeHistory(); - ~DeleteChromeHistory(); - - HRESULT FinalConstruct(); - -DECLARE_CLASSFACTORY_SINGLETON(DeleteChromeHistory) - -BEGIN_COM_MAP(DeleteChromeHistory) - COM_INTERFACE_ENTRY(IDeleteBrowsingHistory) -END_COM_MAP() - -BEGIN_MSG_MAP(DeleteChromeHistory) - CHAIN_MSG_MAP(ChromeFramePlugin<DeleteChromeHistory>) -END_MSG_MAP() - - // IDeleteBrowsingHistory methods - STDMETHOD(DeleteBrowsingHistory)(DWORD flags); - - protected: - // ChromeFrameDelegate overrides - virtual void OnAutomationServerReady(); - virtual void OnAutomationServerLaunchFailed( - AutomationLaunchResult reason, const std::string& server_version); - - virtual void GetProfilePath(const std::wstring& profile_name, - FilePath* profile_path); - - private: - unsigned long remove_mask_; - MessageLoopForUI loop_; -}; - -#endif // CHROME_FRAME_DELETE_CHROME_HISTORY_H_ diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc index 36edc57..f699635 100644 --- a/chrome_frame/test/automation_client_mock.cc +++ b/chrome_frame/test/automation_client_mock.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome_frame/test/automation_client_mock.h" @@ -44,7 +44,7 @@ void MockProxyFactory::GetServerImpl(ChromeFrameAutomationProxy* pxy, void CFACMockTest::SetAutomationServerOk() { EXPECT_CALL(factory_, GetAutomationServer(testing::NotNull(), testing::Field(&ChromeFrameLaunchParams::profile_name, - testing::StrEq(profile_path_.BaseName().ToWStringHack())), + testing::StrEq(profile_)), testing::NotNull())) .Times(1) .WillOnce(testing::Invoke(CreateFunctor(&factory_, @@ -91,8 +91,7 @@ TEST(CFACWithChrome, CreateTooFast) { MockCFDelegate cfd; chrome_frame_test::TimedMsgLoop loop; int timeout = 0; // Chrome cannot send Hello message so fast. - const FilePath profile_path( - chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")); + const std::wstring profile = L"Adam.N.Epilinter"; scoped_refptr<ChromeFrameAutomationClient> client; client = new ChromeFrameAutomationClient(); @@ -101,8 +100,7 @@ TEST(CFACWithChrome, CreateTooFast) { .Times(1) .WillOnce(QUIT_LOOP(loop)); - EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"", - false)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); } @@ -114,8 +112,7 @@ TEST(CFACWithChrome, CreateTooFast) { TEST(CFACWithChrome, CreateNotSoFast) { MockCFDelegate cfd; chrome_frame_test::TimedMsgLoop loop; - const FilePath profile_path( - chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")); + const std::wstring profile = L"Adam.N.Epilinter"; int timeout = 10000; scoped_refptr<ChromeFrameAutomationClient> client; @@ -128,8 +125,7 @@ TEST(CFACWithChrome, CreateNotSoFast) { EXPECT_CALL(cfd, OnAutomationServerLaunchFailed(_, _)) .Times(0); - EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"", - false)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(11); client->Uninitialize(); @@ -139,9 +135,8 @@ TEST(CFACWithChrome, CreateNotSoFast) { TEST(CFACWithChrome, NavigateOk) { MockCFDelegate cfd; chrome_frame_test::TimedMsgLoop loop; + const std::wstring profile = L"Adam.N.Epilinter"; const std::string url = "about:version"; - const FilePath profile_path( - chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")); int timeout = 10000; scoped_refptr<ChromeFrameAutomationClient> client; @@ -170,8 +165,7 @@ TEST(CFACWithChrome, NavigateOk) { .WillOnce(QUIT_LOOP(loop)); } - EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"", - false)); + EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); client = NULL; @@ -180,8 +174,7 @@ TEST(CFACWithChrome, NavigateOk) { TEST(CFACWithChrome, NavigateFailed) { MockCFDelegate cfd; chrome_frame_test::TimedMsgLoop loop; - const FilePath profile_path( - chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")); + const std::wstring profile = L"Adam.N.Epilinter"; const std::string url = "http://127.0.0.3:65412/"; const URLRequestStatus connection_failed(URLRequestStatus::FAILED, net::ERR_INVALID_URL); @@ -211,8 +204,7 @@ TEST(CFACWithChrome, NavigateFailed) { .Times(1) .WillOnce(QUIT_LOOP_SOON(loop, 2)); - EXPECT_TRUE(client->Initialize(&cfd, 10000, false, profile_path, L"", - false)); + EXPECT_TRUE(client->Initialize(&cfd, 10000, false, profile, L"", false)); loop.RunFor(10); client->Uninitialize(); @@ -245,8 +237,7 @@ TEST_F(CFACMockTest, MockedCreateTabOk) { EXPECT_CALL(proxy_, CancelAsync(_)).Times(testing::AnyNumber()); // Here we go! - EXPECT_TRUE(client_->Initialize(&cfd_, timeout, false, profile_path_, L"", - false)); + EXPECT_TRUE(client_->Initialize(&cfd_, timeout, false, profile_, L"", false)); loop_.RunFor(10); client_->Uninitialize(); } @@ -271,7 +262,7 @@ TEST_F(CFACMockTest, MockedCreateTabFailed) { Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED); // Here we go! - EXPECT_TRUE(client_->Initialize(&cfd_, timeout_, false, profile_path_, L"", + EXPECT_TRUE(client_->Initialize(&cfd_, timeout_, false, profile_, L"", false)); loop_.RunFor(4); client_->Uninitialize(); diff --git a/chrome_frame/test/automation_client_mock.h b/chrome_frame/test/automation_client_mock.h index 4f65bbb..b81a582 100644 --- a/chrome_frame/test/automation_client_mock.h +++ b/chrome_frame/test/automation_client_mock.h @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ -#define CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ +#ifndef CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ +#define CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ #include <windows.h> #include <string> @@ -137,7 +137,7 @@ class CFACMockTest : public testing::Test { // the victim of all tests scoped_refptr<ChromeFrameAutomationClient> client_; - FilePath profile_path_; + std::wstring profile_; int timeout_; void* id_; // Automation server id we are going to return int tab_handle_; // Tab handle. Any non-zero value is Ok. @@ -156,10 +156,8 @@ class CFACMockTest : public testing::Test { void Set_CFD_LaunchFailed(AutomationLaunchResult result); protected: - CFACMockTest() - : tracker_(NULL), timeout_(500), - profile_path_( - chrome_frame_test::GetProfilePath(L"Adam.N.Epilinter")) { + CFACMockTest() : tracker_(NULL), timeout_(500), + profile_(L"Adam.N.Epilinter") { id_ = reinterpret_cast<void*>(5); tab_handle_ = 3; } @@ -174,5 +172,5 @@ class CFACMockTest : public testing::Test { }; -#endif // CHROME_FRAME_TEST_AUTOMATION_CLIENT_MOCK_H_ +#endif // CHROME_FRAME_AUTOMATION_CLIENT_MOCK_H_ diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h index 11d186f..6fea200 100644 --- a/chrome_frame/test/chrome_frame_automation_mock.h +++ b/chrome_frame/test/chrome_frame_automation_mock.h @@ -11,8 +11,6 @@ #include "chrome_frame/chrome_frame_automation.h" #include "chrome_frame/chrome_frame_plugin.h" #include "chrome_frame/test/http_server.h" -#include "chrome_frame/test/chrome_frame_test_utils.h" -#include "chrome_frame/utils.h" template <typename T> class AutomationMockDelegate @@ -26,13 +24,9 @@ class AutomationMockDelegate : caller_message_loop_(caller_message_loop), is_connected_(false), navigation_result_(false) { test_server_.SetUp(); - - FilePath profile_path( - chrome_frame_test::GetProfilePath(profile_name)); - automation_client_ = new ChromeFrameAutomationClient; automation_client_->Initialize(this, launch_timeout, perform_version_check, - profile_path, extra_chrome_arguments, incognito); + profile_name, extra_chrome_arguments, incognito); } ~AutomationMockDelegate() { if (automation_client_.get()) { diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 9c82b20..c2f0abb 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,10 +18,7 @@ #include "base/utf_string_conversions.h" #include "base/win_util.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_paths_internal.h" #include "chrome_frame/utils.h" - #include "testing/gtest/include/gtest/gtest.h" namespace chrome_frame_test { @@ -364,12 +361,6 @@ HRESULT LaunchIEAsComServer(IWebBrowser2** web_browser) { return hr; } -FilePath GetProfilePath(const std::wstring& profile_name) { - FilePath profile_path; - chrome::GetChromeFrameUserDataDirectory(&profile_path); - return profile_path.Append(profile_name); -} - _ATL_FUNC_INFO WebBrowserEventSink::kNavigateErrorInfo = { CC_STDCALL, VT_EMPTY, 5, { VT_DISPATCH, diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index 9040d9a..c766861 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -115,8 +115,6 @@ class TimedMsgLoop { // Returns S_OK on success. HRESULT LaunchIEAsComServer(IWebBrowser2** web_browser); -FilePath GetProfilePath(const std::wstring& suffix); - #ifndef DISPID_NEWPROCESS #define DISPID_NEWPROCESS 284 #endif // DISPID_NEWPROCESS @@ -257,7 +255,7 @@ END_SINK_MAP() virtual void OnNewBrowserWindow(IDispatch* new_window, const wchar_t* url) {} // Window watchdog override - virtual void OnWindowDetected(HWND hwnd, const std::string& caption) {} + virtual void OnWindowDetected(HWND hwnd, const std::string& caption) {}; IWebBrowser2* web_browser2() { return web_browser2_.get(); diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 85d4880..7fcdde8 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -13,7 +13,6 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/registry.h" -#include "base/scoped_bstr_win.h" #include "base/scoped_comptr_win.h" #include "base/scoped_variant_win.h" #include "base/string_util.h" @@ -412,34 +411,6 @@ IEVersion GetIEVersion() { return ie_version; } -FilePath GetIETemporaryFilesFolder() { - DCHECK_EQ(BROWSER_IE, GetBrowserType()); - - LPITEMIDLIST tif_pidl = NULL; - HRESULT hr = SHGetFolderLocation(NULL, CSIDL_INTERNET_CACHE, NULL, - SHGFP_TYPE_CURRENT, &tif_pidl); - DCHECK(SUCCEEDED(hr) && tif_pidl); - - ScopedComPtr<IShellFolder> parent_folder; - LPCITEMIDLIST relative_pidl = NULL; - hr = SHBindToParent(tif_pidl, IID_IShellFolder, - reinterpret_cast<void**>(parent_folder.Receive()), - &relative_pidl); - DCHECK(SUCCEEDED(hr) && relative_pidl); - - STRRET path = {0}; - hr = parent_folder->GetDisplayNameOf(relative_pidl, - SHGDN_NORMAL | SHGDN_FORPARSING, - &path); - DCHECK(SUCCEEDED(hr)); - ScopedBstr tif_bstr; - StrRetToBSTR(&path, relative_pidl, tif_bstr.Receive()); - FilePath tif(static_cast<BSTR>(tif_bstr)); - - ILFree(tif_pidl); - return tif; -} - bool IsIEInPrivate() { typedef BOOL (WINAPI* IEIsInPrivateBrowsingPtr)(); bool incognito_mode = false; diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index ffa4b08..8c387c5 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -13,7 +13,6 @@ #include <string> #include "base/basictypes.h" -#include "base/file_path.h" #include "base/histogram.h" #include "base/lock.h" #include "base/logging.h" @@ -173,8 +172,6 @@ typedef enum IEVersion { // will be returned. IEVersion GetIEVersion(); -FilePath GetIETemporaryFilesFolder(); - // Retrieves the file version from a module handle without extra round trips // to the disk (as happens with the regular GetFileVersionInfo API). // |