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

Side by Side Diff: chrome/browser/ui/tabs/tab_finder.h

Issue 10631009: Removes TabFinder. We're not going to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git rm tab_finder.cc Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/tabs/tab_finder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef CHROME_BROWSER_UI_TABS_TAB_FINDER_H_
6 #define CHROME_BROWSER_UI_TABS_TAB_FINDER_H_
7 #pragma once
8
9 #include <map>
10 #include <set>
11
12 #include "base/basictypes.h"
13 #include "base/memory/singleton.h"
14 #include "chrome/browser/cancelable_request.h"
15 #include "chrome/browser/history/history_types.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
18
19 class Browser;
20 class GURL;
21
22 namespace content {
23 class WebContents;
24 struct FrameNavigateParams;
25 struct LoadCommittedDetails;
26 }
27
28 // TabFinder is used to locate a tab by URL. TabFinder matches tabs based
29 // on the tabs current url, or the start of the redirect chain.
30 //
31 // TODO: if we end up keeping this (moving it out of about:flags) then we
32 // should persist the start of the redirect chain in the navigation entry.
33 class TabFinder : public content::NotificationObserver {
34 public:
35 // Returns the TabFinder, or NULL if TabFinder is not enabled.
36 static TabFinder* GetInstance();
37
38 // Returns true if TabFinder is enabled.
39 static bool IsEnabled();
40
41 // Returns the tab that matches the specified url. If a tab is found the
42 // browser containing the tab is set in |existing_browser|. This searches
43 // in |browser| first before checking any other browsers.
44 content::WebContents* FindTab(Browser* browser,
45 const GURL& url,
46 Browser** existing_browser);
47
48 // content::NotificationObserver overrides:
49 virtual void Observe(int type,
50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE;
52
53 private:
54 friend struct DefaultSingletonTraits<TabFinder>;
55
56 class WebContentsObserverImpl;
57
58 typedef std::map<content::WebContents*, GURL> WebContentsToURLMap;
59 typedef std::set<WebContentsObserverImpl*> WebContentsObservers;
60
61 TabFinder();
62 virtual ~TabFinder();
63
64 // Forwarded from WebContentsObserverImpl.
65 void DidNavigateAnyFrame(
66 content::WebContents* source,
67 const content::LoadCommittedDetails& details,
68 const content::FrameNavigateParams& params);
69
70 // Returns true if the tab's current url is |url|, or the start of the
71 // redirect chain for the tab is |url|.
72 bool TabMatchesURL(content::WebContents* web_contents, const GURL& url);
73
74 // Returns the first tab in the specified browser that matches the specified
75 // url. Returns NULL if there are no tabs matching the specified url.
76 content::WebContents* FindTabInBrowser(Browser* browser, const GURL& url);
77
78 // If we're not currently tracking |tab| this creates a
79 // WebContentsObserverImpl to listen for navigations.
80 void TrackTab(content::WebContents* tab);
81
82 // Invoked when a WebContents is being destroyed.
83 void TabDestroyed(WebContentsObserverImpl* observer);
84
85 // Cancels any pending requests for the specified tabs redirect chain.
86 void CancelRequestsFor(content::WebContents* web_contents);
87
88 // Starts the fetch for the redirect chain of the specified WebContents.
89 // QueryRedirectsToComplete is invoked when the redirect chain is retrieved.
90 void FetchRedirectStart(content::WebContents* tab);
91
92 // Callback when we get the redirect list for a tab.
93 void QueryRedirectsToComplete(CancelableRequestProvider::Handle handle,
94 GURL url,
95 bool success,
96 history::RedirectList* redirects);
97
98 // Maps from WebContents to the start of the redirect chain.
99 WebContentsToURLMap web_contents_to_url_;
100
101 CancelableRequestConsumerTSimple<content::WebContents*> callback_consumer_;
102
103 content::NotificationRegistrar registrar_;
104
105 WebContentsObservers tab_contents_observers_;
106
107 DISALLOW_COPY_AND_ASSIGN(TabFinder);
108 };
109
110 #endif // CHROME_BROWSER_UI_TABS_TAB_FINDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/tabs/tab_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698