summaryrefslogtreecommitdiffstats
path: root/chrome_frame/delete_chrome_history.h
blob: 947f6735eea652a71e8362a06a0045edc08329bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// 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_