Chromium Code Reviews| Index: chrome/browser/safe_browsing/malware_details_history.h |
| =================================================================== |
| --- chrome/browser/safe_browsing/malware_details_history.h (revision 0) |
| +++ chrome/browser/safe_browsing/malware_details_history.h (revision 0) |
| @@ -0,0 +1,70 @@ |
| +// Copyright (c) 2011 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_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ |
| +#define CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ |
| +#pragma once |
| + |
| +// A class that gets url redirets from the history service |
| + |
| +#include <string> |
| +#include <vector> |
| +#include "base/hash_tables.h" |
| +#include "base/memory/linked_ptr.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "chrome/browser/history/history.h" |
| +#include "net/base/completion_callback.h" |
| + |
| +class TabContents; |
| + |
| +class MalwareDetailsRedirectsCollector |
| + : public base::RefCountedThreadSafe<MalwareDetailsRedirectsCollector> { |
| + |
| + public: |
| + MalwareDetailsRedirectsCollector(); |
| + virtual ~MalwareDetailsRedirectsCollector(); |
| + |
| + void StartHistoryCollection(const std::vector<GURL>& urls, |
|
panayiotis
2011/05/13 21:15:26
comment about the method and args.
mention that |
kewang
2011/05/16 07:11:51
Done.
|
| + TabContents* tab_contents, |
| + Task* callback); |
| + |
| + // Returns whether or not StartCacheCollection has been called. |
| + bool HasStarted(); |
| + |
| + // Returns the rediret urls we get from history service |
|
panayiotis
2011/05/13 21:15:26
typo: redirect
we probably want to return a refer
kewang
2011/05/16 07:11:51
Done.
|
| + std::vector<std::vector<GURL> > GetCollectedUrls(); |
| + |
| + // We need to reset it in unittest |
| + HistoryService* history_; |
|
panayiotis
2011/05/13 21:15:26
maybe expose an accessor instead (GetHistory()) ?
kewang
2011/05/16 07:11:51
Put a SetHistory() for unittest.
|
| + |
| + private: |
| + TabContents* tab_contents_; |
| + |
| + // Method we call when we are done. The caller must be alive for the |
| + // whole time, we are modifying its state (see above). |
| + Task* callback_; |
| + |
| + // Set to true once StartHistoryCollection is called |
| + bool has_started_; |
| + |
| + // The urls we need to get redirects for |
| + std::vector<GURL> urls_; |
| + // The iterator goes over urls_ |
| + std::vector<GURL>::iterator urls_it_; |
| + // The collected directs from history service |
| + std::vector<std::vector<GURL> > redirects_urls_; |
|
panayiotis
2011/05/13 21:15:26
maybe we can create a typedef RedirectChain = st
kewang
2011/05/16 07:11:51
Done.
|
| + |
| + void StartGetRedirects(const std::vector<GURL>& urls); |
| + void GetRedirects(const GURL& url); |
| + void OnGotQueryRedirectsTo(HistoryService::Handle handle, |
| + GURL url, |
| + bool success, |
| + history::RedirectList* redirect_list); |
| + |
| + void AllDone(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MalwareDetailsRedirectsCollector); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_SAFE_BROWSING_MALWARE_DETAILS_HISTORY_H_ |
| Property changes on: chrome/browser/safe_browsing/malware_details_history.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |